0
votes

I need to make my Autohotkey scripts run at startup, so I think the best way is to save the file .exe in the startup folder, but the .exe file is saved automatically in the same folder of the source, so save the source in the startup folder could be a solution too, but it also opens the source at startup.

Now I'm using the syntax highlight plugin for autohotkey in SublimeText3, but I don't know if there are some way to save the .exe file to a different folder than the one where the source (I'm a noob in informatic).

I'd tried using SetWorkingDir in the Autohotkey script and costumizing the AutoHotkey.sublime-build file using working_dir, but I don't know how they work, so I didn't achieve the goal.

I need a way to edit .ahk with Sublimetext3, keeping my scripts in "documents" and, when I build, save the exe in another folder.

2
Don't understand what your editor has to do with your need.Thierry Dalon

2 Answers

1
votes

If you're just looking to have your AHK files load when you start up Windows, then the Startup folder is indeed the right location. An elegant solution would be to call the other scripts from this main script.

Since the default AutoHotkey.ahk script is contained in your Documents folder, you can include or run various other AHK scripts, depending on whether you want them to run under one AutoHotkey instance, as one per script, or some combination of the two.

Documentation on Include is fairly solid. The example from the linked page:

#Include C:\My Documents\Scripts\Utility Subroutines.ahk
#Include %A_ScriptDir%  ; Changes the working directory for subsequent #Includes and FileInstalls.
#Include C:\My Scripts  ; Same as above but for an explicitly named directory.

Similarly, you can Run like below:

Run, C:\My Documents\Scripts\Utility Subroutines.ahk
0
votes

I am not sure I understood well your question. (Maybe you could make it clearer) To run an .ahk at startup you can save it in your startup folder and you need simply to associate .ahk with the AutoHotkey.exe. (Always open with AutoHotkey.exe). You don't have to have the 2 files in the same location. You could also add a shortcut to your .ahk file to your startup folder. If you have many scripts copy each shortcuts to the startup folder.