Please, how can I set the default editor for ahk scripts?
I tried this:
(with restart)
After right click on a running script icon->Edit script - the script is still opened in Notepad.
Btw the example code doesn't work for ahk v2 - different syntax...
https://lexikos.github.io/v2/docs/commands/Edit.htm#ExDefaultEditor
default editor for ahk v2
Re: default editor for ahk v2
I don't know if this should make a difference, but see the difference between yours and mine. Mine has a "Command" folder within the "Edit" folder with the default key's value modified while yours has a key named "Command" in the "Edit" folder for which the value was assigned.
Re: default editor for ahk v2
@boiler
I tried to set it up like you, but it still doesn't make a difference Another thing to consider is that I don't have Autohotkey installed. I use just v2 beta which is located somewhere on my PC (not in Program Files)
I created the structure of AutoHotkeyScript keys in regedit manually. There was nothing before it. (so for example I don't have "Compile", "Compile-Gui" keys in the registry)
I tried to set it up like you, but it still doesn't make a difference Another thing to consider is that I don't have Autohotkey installed. I use just v2 beta which is located somewhere on my PC (not in Program Files)
I created the structure of AutoHotkeyScript keys in regedit manually. There was nothing before it. (so for example I don't have "Compile", "Compile-Gui" keys in the registry)
Re: default editor for ahk v2
That is apparently the key difference. Unless you have a reason not to, after restoring the registry its prior state without your additions, I would install AutoHotkey so all the file associations are put in place. Then just replace the v1 binary files with the v2 binaries.
Re: default editor for ahk v2
@hpta
Also you need .ahk key in registry
Also you need .ahk key in registry
Dump of AutoHotkey registry keys
Please post your script code inside [code] ... [/code] block. Thank you.
Re: default editor for ahk v2
I finally tried to do it by installing v1 to program files, then replacing binaries there with ahk v2 beta files.
This is what I have in the Program Files folder (v2 beta files are highlighted in yellow)
But the "Edit Script" settings simply doesn't work with v2 beta.
If I run a script with AutoHotkey64.exe (i. e. v2 beta executable) and select "Edit Script" in the tray menu then it's opened in Notepad.
However, If I run a simple skript with a AutoHotkeyU64.exe (one of v1 executables) and select "Edit Script: in the tray menu, it is opened in VS Code (!)
It might be that it's not possible to set default editor for ahk V2 yet.
edit: I also tried deleting AutoHotkeyU64.exe and then renaming AutoHotkey64.exe to AutoHotkeyU64.exe. It doesn't work either.
This is what I have in the Program Files folder (v2 beta files are highlighted in yellow)
But the "Edit Script" settings simply doesn't work with v2 beta.
If I run a script with AutoHotkey64.exe (i. e. v2 beta executable) and select "Edit Script" in the tray menu then it's opened in Notepad.
However, If I run a simple skript with a AutoHotkeyU64.exe (one of v1 executables) and select "Edit Script: in the tray menu, it is opened in VS Code (!)
It might be that it's not possible to set default editor for ahk V2 yet.
edit: I also tried deleting AutoHotkeyU64.exe and then renaming AutoHotkey64.exe to AutoHotkeyU64.exe. It doesn't work either.
Re: default editor for ahk v2
It shouldn’t matter if it’s v2 or not. To confirm, you should try to get it totally working for v1 first, then just swap out the executable binary file. The fact that you started without having it installed and edited the registry then tried to install it is probably causing issues. You could probably verify this if you have access to another machine where you install v1 first then do nothing else than to swap the binary file with a v2 version.
Re: default editor for ahk v2
@hpta
As @boiler noted above, launching Edit script command doesn't depend on .exe files in %ProgramFiles%\Autohotkey folder at all.
It depends on the registry key HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command. Its default value should contain path to your VSCode editor, e.g. @="\"C:\\Program Files\\Microsoft VS Code\\VSCode.exe\" \"%1\"".
As @boiler noted above, launching Edit script command doesn't depend on .exe files in %ProgramFiles%\Autohotkey folder at all.
It depends on the registry key HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command. Its default value should contain path to your VSCode editor, e.g. @="\"C:\\Program Files\\Microsoft VS Code\\VSCode.exe\" \"%1\"".
My working (!!!) registry key
Please post your script code inside [code] ... [/code] block. Thank you.
Re: default editor for ahk v2
@boiler, @vmech
Thank you for your patience and help. There had to be something wrong in the registry.... I searched through it, deleted everything constaining "ahk" or "autohotkey" (except for a couple of random cryptic strings probably not related to autohotkey), then installed v1,
edited HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command
... Edit Script was opening the script in VS Code. Yes!
Copied v2 beta AutoHotkey64.exe into AutoHotkey.exe in the Program Files.
... Still opening in VS Code.
So problem solved but I feel like I've spent too much time with issue . I wish a proper official V2 installer already existed...
IMO it's easy to mess things up If you try to run ahk1 and ahk2 on the same PC. And if try to change the "Open with" path for .ahk files.
Thank you for your patience and help. There had to be something wrong in the registry.... I searched through it, deleted everything constaining "ahk" or "autohotkey" (except for a couple of random cryptic strings probably not related to autohotkey), then installed v1,
edited HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command
... Edit Script was opening the script in VS Code. Yes!
Copied v2 beta AutoHotkey64.exe into AutoHotkey.exe in the Program Files.
... Still opening in VS Code.
So problem solved but I feel like I've spent too much time with issue . I wish a proper official V2 installer already existed...
IMO it's easy to mess things up If you try to run ahk1 and ahk2 on the same PC. And if try to change the "Open with" path for .ahk files.
Re: default editor for ahk v2
First, you might have tried removing Autohotkey through Apps and Features
Second, you might have tried to find in registry ghost keys contained 'ahk' and 'autohotkey', and then deleting them
But anyway, all's well that ends well
Please post your script code inside [code] ... [/code] block. Thank you.
Who is online
Users browsing this forum: arout and 77 guests