Each time I restart my computer, I have to rebuild all my AHK Scripts so the keyboard shortcuts will work.
For instance, I have a script that assigns Ctrl+j to set up an instance of the MEAN stack and open my web site. After restarting my computer, pressing ^j
does nothing until I go into Sublime and ^b
(Build). I could build from AHK, but I do a lot of work in Sublime, so it's easier to build there.
Looking to build a post startup, startup script: This Is concerned with using an AHK script to start many programs on starup. I use Windows' Task Manager > Startup to do this, thus has nothing to do with making. I want to not have to rebuild all my scripts after every restart.
Windows 10 - run script on windows startup problem: This assumes the start script is already written and implemented. However, it doesn't appear to give the script.
AutoHotKey FAQ: I eventually found a solution here, but it took a long time to dig through the questions so I figured I'd post a question anyway to help others who run into this.
Simply add a shortcut of your script in the Windows 'Startup' folder.
Three ways to get there:
1- In Windows Explorer, go to %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup
(for current user startup list) or %ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Startup
(for every user startup list)
or
2- Open Windows' Run application (Windows + r) write shell:startup
(current user) or shell:common startup
(every user) in the edit field and click on the 'ok' button.
or
3- Start > Programs > Startup (old Windows versions)
In AutoHotKey you can access this folder with the Built-in Variables %A_Startup%
(current user) or %A_StartupCommon%
(every user)
To create the [current user] shortcut automatically from your script, use the following line:
FileCreateShortcut, %A_ScriptFullPath%, %A_Startup%\shortcutname.lnk
To do the same for all users, use this line instead:
FileCreateShortcut, %A_ScriptFullPath%, %A_StartupCommon%\shortcutname.lnk
(in the case of having a file with the same name in the folder, the file would be overwritten)
ps: Win10 blocks scripts in startup with AHK running as admin... read the comments of this post for extra info.