File association fails in Win XP; with workaround

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
klepton
Posts: 5
Joined: Fri Feb 11, 2005 1:25 am
Location: San Francisco, CA

File association fails in Win XP; with workaround

Post by klepton »

File associations doesn't work

(added 2/22/05: This problem occurred for user without administrator privilege; user with admin privilege was able to use associations OK.)

After installing TextPad 4.7.3 under Windows XP service pack 2, I found that any file association entered (in Configure, Preferences, Associated Files dialog) disappears after the dialog closes, and files do not become associated with TextPad in Windows Explorer. I do not have full administrative rights on this machine, so the problem may be related to that, but I doubt it. (Several other posts mentioned a similar problem; but I suppose if it were widespread, there would probably be a deluge of such posts.)

One workaround is to use Windows Explorer, Tools, Folder Options to associate an extension file with TextPad; that creates an action for Explorer, allowing you to double-click the file to open in TextPad. But there will be no corresponding entry or file description in TextPad's own file association dialogue, and also, for me the icon was not changed to that of TextPad.

A more complete workaround is to install the registry file below. This does what TextPad's file association dialog is supposed to. Paste the lines between the BEGIN and END lines (including the conclusing empty line) into a separate plain ASCII text file, change all the "aaa"'s and the "aaa type description" to the extension and description you want to associate, then save the file with a ".reg" extension. To install, double-click in Windows Explorer, or right-click and select Merge.

Note 1: It's always a good idea to back up your registry before making any such changes!!

Note 2: If ".aaa" is already associated with some other program, then change its TextPad Associations entry so it points to the previous association. E.g. if ".aaa" was previously associated with NotePad, its existing Registry entry will be "txtfile". So, instead of:
".aaa"=""
one would use:
".aaa"="txtfile"
under the HKCU\Software\Helios\TextPad 4\Associations branch.

Note 3: The same registry file should probably work under other windows versions, but e.g., under Windows 98 the first line must be "REGEDIT4".


====== BEGIN Windows XP .reg file to assoc. .aaa w/ TextPad =====
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.aaa]
@="TextPad.aaa"

[HKEY_CURRENT_USER\Software\Helios\TextPad 4\Associations]
".aaa"=""

[HKEY_CLASSES_ROOT\TextPad.aaa]
@="aaa type description"

[HKEY_CLASSES_ROOT\TextPad.aaa\DefaultIcon]
@="\"C:\\Program Files\\TextPad 4\\TextPad.exe\",1"

[HKEY_CLASSES_ROOT\TextPad.aaa\shell]
@=""

[HKEY_CLASSES_ROOT\TextPad.aaa\shell\open]
@=""

[HKEY_CLASSES_ROOT\TextPad.aaa\shell\open\command]
@="\"C:\\Program Files\\TextPad 4\\TextPad.exe\" -s"

[HKEY_CLASSES_ROOT\TextPad.aaa\shell\open\ddeexec]
@="[open(\"%1\")]"

[HKEY_CLASSES_ROOT\TextPad.aaa\shell\open\ddeexec\application]
@="TextPad"

[HKEY_CLASSES_ROOT\TextPad.aaa\shell\open\ddeexec\topic]
@="system"

[HKEY_CLASSES_ROOT\TextPad.aaa\shell\print]

[HKEY_CLASSES_ROOT\TextPad.aaa\shell\print\command]
@="\"C:\\Program Files\\TextPad 4\\TextPad.exe\" -s -p \"%1\""

[HKEY_CLASSES_ROOT\TextPad.aaa\shell\printto]

[HKEY_CLASSES_ROOT\TextPad.aaa\shell\printto\command]
@="\"C:\\Program Files\\TextPad 4\\TextPad.exe\" -s -pt \"%1\" \"%2\" \"%3\" \"%4\""

====== END WinXP .reg file - note last empty line =====
Last edited by klepton on Tue Feb 22, 2005 5:32 pm, edited 1 time in total.
User avatar
Ajax4Hire
Posts: 4
Joined: Thu Feb 17, 2005 3:53 pm
Location: Planet Earth
Contact:

Post by Ajax4Hire »

Problem with regedit changes is that some(many) programs just shell NOTEPAD.EXE for text files. Even worse, Microsoft WinX will rob the text (.txt) association back to Notepad.exe.

An alternative solution to the registry edit is to rename/replace NOTEPAD.EXE with textpad.exe in the c:\windows directory (and win\system32\dllcache) directory. Note: this takes some finesse because as you replace notepad.exe with textpad.exe, windows comes in behind you and replaces notepad with the back. Must replace both at the same time. Copy first to make a backup of notepad.exe then copy textpad.exe on top of both quickly; ignore the dire windows warning and your ready to go.

This will work for any NOTEPAD.EXE file association until you get a filename with spaces. Then replace %1 with "%1" in the registry wherever notepad.exe appears. Quoting the %1 parameter will tell textpad that this is a single filename and not multiple files separated by a space.

This will work until you try to access any pre-made, personalized macros.
Then textpad.exe will search the windows directory for windows\samples for macros (*.tpm) and windows\system for syntax (*.syn), fail and complain.

I still like the rename solution because I get textpad.exe for anything that is text and any program that does a shell:notepad.exe
Lostgallifreyan
Posts: 25
Joined: Mon Feb 14, 2005 10:51 am

Post by Lostgallifreyan »

Not sure if it's still around on the TextPad site, but there was a tiny app that launched TextPad from its own directory (probably consulting the app paths registry entry for TextPad).

Edit: it is. :) http://www.textpad.com/add-ons/index.html
Look for txplink...

What I do is call it Notepad.exe, then call the original Notepad.exe "Note-pad.exe", then dump the launch app beside it. You'll need to switch off Windows File Protection in WXP and I think in W2K to do this, then search for all occurences of Notepad.exe and replace them after renaming. The link in SendTo (appears on right click context menus in Explorer) now calls for the real Notepad (now Note-pad), in case you really must use it, and all other associations that call for Notepad will open Textpad.

I once tried what Ajax says, in W2K I think it was. One of three or even four sources of Notepad.exe is the master of the others. Try deleting one and waiting to see if it returns. If not, you've found the master copy. Replace it, then delete the rest, and they'll be updated with yours. (Hell knows why they need so much backup, I found four that time, in all...)

Apart from file renames, and careful negotiation of Windows File Protection in those OS's that have it, and an update to a shortcut, there is nothing to do. All registry stuff can be left as it is.

Other special associations with TextPad are set up from within TextPad as usual. At least it should. :twisted: Looks like the first post here is revealing a different problem...


More edit:
That reg file looks like it will work the same in W98 and W95. Just head it with REGEDIT4, as this will then work in W2K and WXP as well. As far as I know, this will work in all Windows OS's, it's only the new header that restricts their use to later systems.
Post Reply