AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Managing AHK's Edit, Open and Compile verbs

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
JDN



Joined: 24 Mar 2004
Posts: 135

PostPosted: Fri Nov 23, 2007 1:51 pm    Post subject: Managing AHK's Edit, Open and Compile verbs Reply with quote

The AutoHotkey Help says: The Edit command opens the current script for editing using the associated "edit" verb in the registry (or Notepad if no verb). Does anyone know where the association between .AHK files (file extension .AHK) and the Notepad editor (C:\Windows\Notepad.exe) is stored? I would expect to find it somewhere in the System Registry (in the HKEY_CLASSES_ROOT key and AHK subkey) but can't find it anywhere. There is a folder under AHK called ShellNew but I can't seem to find any Editors, Compilers or the main AHK program anywhere in the Registry.

Does anyone know where in the registry this info is stored? I'd like to know how to make changes to the associations between the Edit, Open (aka Run) and Compile verbs and their associated programs. If possible, I'd like to avoid using Windows Explorer to make those changes. Ideally, I'd like to know if there are commands similar to ASSOC and FTYPE that will let me set or change the Compile Script, Edit Script and Run Script verbs.

I'm asking because I'm also concerned with other apps besides AHK. Every app can create their own kinds of verbs for various purposes and I vaguely know how to manage those verbs using Windows Explorer but my knowledge of this area is not good.

I understand there are two system commands ASSOC and FTYPE. ASSOC lets me associate the file extension .AHK with the file type
"AutoHotkeyScript" (i.e. .AHK=AutoHotkeyScript). FTYPE lets me associate the file type "AutoHotkeyScript" with the main AHK program.
FTYPE reports that AutoHotkeyScript="C:\Program Files\AutoHotkey\AutoHotkey.exe".

The Run verb (aka Open verb) associates .AHK script files with the main AHK program ("C:\Program Files\AutoHotkey\AutoHotkey.exe").
The Compile verb associates .AHK script files with the AHK compiler ("C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe").
The Edit verb associates .AHK script files with an editor (C:\Windows\Notepad.exe) so that script files may be easily edited.

I believe that when AHK is installed, it automatically creates the three verbs: Compile, Edit and Open(or Run), and associates the proper executable programs with AHK script files by storing the appropriate info somewhere in the System Registry.

I'd like to know if anyone knows of any alternatives to managing these verbs aside from using Windows Explorer's "Folder Options" and "File Types". For example, does anyone know if I can use the FTYPE command (or any equivalent) to set or change the edit verb or compile verb? As it stands, it appears the only verb that FTYPE can manage is the Open verb (aka Run). It would seem to be either a deficiency in Windows documentation of the FTYPE command or perhaps it is due to my lack of knowledge regarding these operations? It would not be the first time I have experienced problems due to my lack of knowledge.

Also, would anyone know if these associations are stored in the system registry and if so, where? That would enable me to make any desired changes myself. I used the Installation program provided to install AHK and that is usually the way that info is stored in the registry.

I'd like to have the ability to manage these verbs without using Windows Explorer because as it stands, it means that AHK is somehow dependent on Windows Explorer. It's a very small complaint. But if you don't have access to Windows Explorer, you would then have problems trying to make full use of AHK.

It just feels wrong somehow, to have to lug around Windows Explorer in case I ever want to use a different program to Edit, Compile or Run an AHK script. In a way, it would mean that AHK and WEXP were somehow married together and I just don't like that idea.
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 666
Location: MN, USA

PostPosted: Fri Nov 23, 2007 3:13 pm    Post subject: Reply with quote

The 3 verbs are located under HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell
_________________
http://autohotkey.net/~jaco0646/
Back to top
View user's profile Send private message Visit poster's website
JDN



Joined: 24 Mar 2004
Posts: 135

PostPosted: Fri Nov 23, 2007 3:59 pm    Post subject: Reply with quote

Thanks very kindly for such a quick reply, Jaco0646. I appreciate it very much.

It will be interesting to see what happens if I bypass the install program and just unzip the distribution file and see if AHK sets those keys if I run it without having gone through the install.

Thanks again.


P.S. For anyone else interested in this, on my machine, I used Windows Explorer to change the editor used from NotePad to NoteTab (a great freeware editor). I thought it would be best to show the complete Registry values here for completeness' sake.

So, on my machine, the registry now contains the following values:

\AutoHotkeyScript\Shell\Compile\Command\
"C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "%l"

\AutoHotkeyScript\Shell\Edit\Command\
"C:\Program Files\NoteTab Light\Note1.exe" %1

\AutoHotkeyScript\Shell\Open\Command\
"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%1" %*

To shed some further light on this, it appears that these three Registry variables are set when you run the Install program. But if you do not run the Install program and just run AHK after unzipping the ZIP file, these three Registry variables will not be changed unless or until you run
Windows Explorer, and select Folder Options and File Types and manually set the Open, Compile and Edit verbs.

I don't know how suggestions for changes to the documentation are handled on this site. But on the Download page of the AHK site, it says: "It is not necessary to uninstall your old version first. If you prefer not to run the installer, download this zip file instead"

I'm not sure if it is anywhere said that if this is the first time you will use AHK, and you don't run the installer, those three verbs will not be set in the Registry unless you set them manually using Windows Explorer. This could lead to problems.

Perhaps it should say something about this. If a new user does not run the installer, I would guess they could have problems if they try to run the Edit command. They could also have problems if they click on a script file in an attempt to execute it.
Back to top
View user's profile Send private message
SharpOrangeGrapes



Joined: 27 Dec 2007
Posts: 5

PostPosted: Fri Dec 28, 2007 12:57 pm    Post subject: Reply with quote

jaco0646 wrote:
The 3 verbs are located under HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell


Thanks both of you! Exactly what I was looking for.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group