Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build AHK scripts automatically on startup?

Tags:

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.

How can my AHK Scripts automatically build on startup?


What I've tried so far:
  • 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.

like image 515
Travis Heeter Avatar asked Jan 18 '17 15:01

Travis Heeter


People also ask

How do I run ahk script on startup?

To do this, find the AutoHotKey script you want to add to the startup, select it, hold the Alt key, and drag it to the same folder. Step 2: The above action will instantly create a shortcut to the script.

Does AutoHotkey start automatically?

Whenever you start your system and log in, the AutoHotkey script will be automatically launched. Note: if you want the AutoHotkey script to launch regardless of which user is logged in, then create the shortcut in the below folder. It is the Startup folder for all the users on your system.

How do I trigger an AutoHotkey script?

Run a ScriptDouble-click a script file (or shortcut to a script file) in Explorer. Call AutoHotkey.exe on the command line and pass the script's filename as a command-line parameter. After creating the default script, launch AutoHotkey via the shortcut in the Start menu to run it.


1 Answers

Simply add a shortcut (don't need to be the actual file) 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

or

2- Start > Programs > Startup

or

3- Open Windows' Run application (Windows + r) write shell:startup in the edit field and click on the 'ok' button.

ps: Win10 blocks scripts in startup with AHK running as admin... read the comments of this post for extra info.

like image 196
Le____ Avatar answered Sep 19 '22 11:09

Le____