Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to "Edit this Script" in any editor other than


  • Please log in to reply
20 replies to this topic
bits
  • Members
  • 10 posts
  • Last active: Dec 08 2010 01:13 AM
  • Joined: 17 Nov 2006
Whenever I right click on Autohotkey TRAY icon and click on "edit this script"; I always get the AHk script in notepad.
How do I change these default settings to open the script in Textpad ??

Stefaan
  • Guests
  • Last active:
  • Joined: --
You can change this in your registry.

1. Open the registry editor: Click on run in your start menu and enter regedit and press enter
2. Scroll to the folder HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command
3. Double click on (Default) in the right pane
4. Change c:\windows\system32\notepad.exe to your preferred editor. I'm using PsPad: "c:\Program Files\PSPad editor\PSPad.exe" "%1" (All quotes included). The "%1%" is important, because windows replaced it by the file name you want to edit.

bits
  • Members
  • 10 posts
  • Last active: Dec 08 2010 01:13 AM
  • Joined: 17 Nov 2006

You can change this in your registry.

1. Open the registry editor: Click on run in your start menu and enter regedit and press enter
2. Scroll to the folder HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command
3. Double click on (Default) in the right pane
4. Change c:\windows\system32\notepad.exe to your preferred editor. I'm using PsPad: "c:\Program Files\PSPad editor\PSPad.exe" "%1" (All quotes included). The "%1%" is important, because windows replaced it by the file name you want to edit.



Thanks a Lot !

Lompsy
  • Guests
  • Last active:
  • Joined: --
copy paste into a regfile

I like notepad++ as the best ahk editor since it understands its language (plugin)

REGEDIT4

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command]
@="C:\\Program Files\\Notepad++\\notepad++.exe %1"



RiseUp
  • Members
  • 38 posts
  • Last active: Jan 04 2016 01:42 PM
  • Joined: 06 Dec 2007
I use notepad++, too. Thanks for this tip!

pajenn
  • Members
  • 391 posts
  • Last active: Feb 06 2015 07:57 AM
  • Joined: 07 Feb 2009
[warning: old thread!]

Is there a version of this tweak for Notepad2?

I have it located at C:\Program Files\Notepad2.exe, so I changed Lompsy's file to:
REGEDIT4

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command]
@="C:\\Program Files\\Notepad2.exe %1"
(I had no previous default value)

it didn't work, not even after a reboot. I then added the extra quotes per bits suggestion to make the registry value "C:\Program Files\Notepad2.exe" "%1", but again no luck... though I haven't rebooted yet in case that's required.

[Edit2]

Hardware: fast laptop with SSD
Software: Win 7 Home Premium 64-bit, android for phone and tablet


Morpheus
  • Members
  • 475 posts
  • Last active: Oct 21 2014 11:08 AM
  • Joined: 31 Jul 2008
This post left intentionally blank.

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
pajenn, sounds like the Open verb doesn't exist in the AutoHotkeyScript key. What Morpheus suggested will probably put it back, otherwise you could copy the "Shell\Open" (or similar) key from ahk_auto_file to AutoHotkeyScript.

I've found Types to be handy, especially in Windows Vista and 7, which don't allow that level of control through the standard UI.

Source: Types
“Types” is a free and lightweight configuration utility for Windows that allows you to edit program associations, icons, context menus and other properties of various file types displayed in the Explorer.



pajenn
  • Members
  • 391 posts
  • Last active: Feb 06 2015 07:57 AM
  • Joined: 07 Feb 2009
UPDATE: Solved. Thanks for the suggestions.

The registry entry at HKEY_CLASSES_ROOT\.ahk seems to control the default action for .ahk files. i.e. runs them. Changing its value from ahk_auto_file to AutoHotkeyScript caused my .ahk files to open in Notepad2 instead of running when I double-clicked them.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.ahk]
@="ahk_auto_file"

The HKEY_CLASSES_ROOT\AutoHotkeyScript probably fixed or added the "Edit" option into the Explorer's right-click context menu for .ahk files, but not for "Edit This Script" in the in system tray menu.

The trick was to add the Shell\Edit\Command @="C:\Program Files\Notepad2.exe %1" into HKEY_CLASSES_ROOT\ahk_auto_file. Previously it only had an "Open" entry pointing to AutoHotkey.exe, but no "Edit" entry. Here's the .reg file for it:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\ahk_auto_file]
@=""

[HKEY_CLASSES_ROOT\ahk_auto_file\shell]

[HKEY_CLASSES_ROOT\ahk_auto_file\shell\Edit]

[HKEY_CLASSES_ROOT\ahk_auto_file\shell\Edit\Command]
@="\"C:\\Program Files\\Notepad2.exe\" \"%1\""

[HKEY_CLASSES_ROOT\ahk_auto_file\shell\open]

[HKEY_CLASSES_ROOT\ahk_auto_file\shell\open\command]
@="\"C:\\Program Files\\AutoHotkey\\AutoHotkey.exe\" \"%1\""

I also kept the AutoHotkeyScript additions (shown below), but I'm not sure if it's doing anything since the .ahk key doesn't reference it.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AutoHotkeyScript]

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell]

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit]

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command]
@="\"C:\\Program Files\\Notepad2.exe\" \"%1\""

Hardware: fast laptop with SSD
Software: Win 7 Home Premium 64-bit, android for phone and tablet


ProsperousOne
  • Members
  • 115 posts
  • Last active: Mar 12 2011 09:15 PM
  • Joined: 19 Sep 2005
Tearing my hair out over this one... it works on my other 2 computers (XP) fine, but my new Windows 7 keeps opening my ahk files with notepad to edit, instead of PS Pad...

Here's my Regedit files:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ahk_auto_file]
@=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ahk_auto_file\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ahk_auto_file\shell\Edit]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ahk_auto_file\shell\Edit\Command]
@="\"C:\\Program Files (x86)\\PSPad editor\\PSPad.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ahk_auto_file\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ahk_auto_file\shell\open\command]
@="\"C:\\Program Files (x86)\\AutoHotkey\\AutoHotkey.exe\" \"%1\""

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript]
@="AutoHotkey Script"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\DefaultIcon]
@="C:\\Program Files (x86)\\AutoHotkey\\AutoHotkey.exe,1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell]
@="Open"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Compile]
@="Compile Script"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Compile\Command]
@="\"C:\\Program Files (x86)\\AutoHotkey\\Compiler\\Ahk2Exe.exe\" /in \"%l\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Edit]
@="Edit Script"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Edit\Command]
@="\"C:\\Program Files (x86)\\PSPad editor\\PSPad.exe\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Open]
@="Run Script"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Open\Command]
@="\"C:\\Program Files (x86)\\AutoHotkey\\AutoHotkey.exe\" \"%1\" %*"

Any clue what's wrong?

kdaube
  • Members
  • 81 posts
  • Last active: Nov 02 2015 08:04 AM
  • Joined: 30 Oct 2005
I have the same problem on Win7 x64 as ProsperousOne ahs:
The registriy enties do not have any effect on "Edit this script" - it always opens NotePad with the script.
BTW HKEY_CLASSES_ROOT\.ahk points to AutoHotkeyScript (not to ahk_auto_file).

How to fix this?
Klaus Daube, www.daube.ch

NoobSawce
  • Members
  • 103 posts
  • Last active: Mar 19 2011 05:11 AM
  • Joined: 15 Feb 2011
Is AHK reading these entries? Or is it being launched as a verb through ShellExecute? Either way, if you are running a 32-Bit version of AHK, it wouldn't hurt to try putting duplicated entries under the Wow6432Node sub key as well (i.e. HKEY_CLASSES_ROOT\Software\Wow6432Node\Classes instead of just HKEY_CLASSES_ROOT\Software\Classes).

EDIT: Actually, now that I think about it, it likely doesn't matter how AHK is launching the editor, even if it's through ShellExecute, since it will be the 32-Bit version of Shell32.dll anyway.

kdaube
  • Members
  • 81 posts
  • Last active: Nov 02 2015 08:04 AM
  • Joined: 30 Oct 2005
NoobSawce, yes my AHK version is 32 bit. Is there really a 64 bit version?
I have not found the branch HKEY_CLASSES_ROOT\Software\Wow6432Node\Classes (as You suggest to put copies in).
There is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\ahkfile\shell\Edit\Command which may just be a copy of the HKCLR branch.

Still confused, but on a higher level
Klaus
Klaus Daube, www.daube.ch

NoobSawce
  • Members
  • 103 posts
  • Last active: Mar 19 2011 05:11 AM
  • Joined: 15 Feb 2011
The Wow6432Node is where Windows stores registry information for access from 32-Bit applications (since 32-Bit apps can't read 64-Bit keys), but you will only ever see it on x64 versions of Windows.

Also the second path you provided is just fine, so you can update the data there. It's actually the same location, it just gets merged with other keys and virtualized as HKCR. However, it is still the ultimate place where 32-Bit apps will get their data (read: have to go) to look up file association information, including the 32-Bit version of Shell32.

As far as 64-Bit versions of AHK go, only AHK_L provides 64-Bit versions (as well as Unicode versions). AHK basic only provides a 32-Bit version in ANSI. If your AutoHotkey.exe file version number is 1.0.48.05, then chances are it's the basic version.

Morpheus
  • Members
  • 475 posts
  • Last active: Oct 21 2014 11:08 AM
  • Joined: 31 Jul 2008
I'm using Win 7 Home Premium (64) and this worked for me:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Edit\Command

Value = pspad.exe %1