-1

How to start AutoHotKey on system boot? I moved my script into "c:\Users\User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.."
but nothing happened.

UPDATE: I added this and everyting works now:

How to add administrator privileges to AutoHotkey script?

Kosarar
  • 151
  • 1
  • 9
  • 1
    See https://autohotkey.com/docs/FAQ.htm#Startup and https://www.maketecheasier.com/schedule-autohotkey-startup-windows/ – user3419297 Dec 30 '18 at 17:16
  • Have you tried compiling your script into an exe? You can do so by right clicking on it and selecting Compile Script. Put this in the folder you mentioned. It works on my machine. – Reasel Dec 30 '19 at 22:02
  • As user3419297 suggested, I added some lines to the beginning of my script. And it worked. But your advice looks promising also. I edited my question to include those lines. – Kosarar Jan 01 '20 at 05:28
  • Windows Task Scheduler, – weiya ou Mar 07 '22 at 13:59

2 Answers2

2

Check the value of Startup in registry:

\\HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders

That's the right place you should put your script in.(And where you can change location of it)

Also if it's ahk file(s) you are putting, you should have already linked ahk files to be opened by AutoHotkey.

Update: run(win + r) or open in explorer address bar shell:startup / shell:common startup is another great way to open the right startup folder :)

Update, for win10: Open Task Manager (ctrl + shift + esc), switch to Startup tab, check the item corresponding to the one you put in the startup folder, if it's Disabled, right click it and Enable it.

Til
  • 5,150
  • 13
  • 26
  • 34
  • I use Windows 10 LTSB. I will check eventvwr at the next boot. I will also continue to experiment with bat and exe files in different locations. – Kosarar Dec 31 '18 at 08:03
  • My AutoHotKey script starts on system boot and works in Chrome. However, it does not in AkelPad 4.8.0 (x86). To make it work there, I need to quit my AutoHotKey script and start it again. The similar situation exists with AutoHotKey partial competitor - Mahou. The creator of Mahou does not know the answer. Maybe someone has guesses? – Kosarar Jan 02 '19 at 10:23
  • Do you run AkelPad with elevated rights? Then try to [run your script as administrator](https://stackoverflow.com/a/43299069/3419297). – user3419297 Jan 02 '19 at 17:52
  • I did not think so - I just launch Total Commander and then my txt-file with my diary. But I added those lines to ahk-file and put it into Startup directory. And it works! Magic. Thank you! – Kosarar Jan 05 '19 at 04:38
1

I found another solution which may seem better that previous.

When I started to use AHK I created all .ahk files in one folder. However, I think, everyone does so. In this case it is very easy to run all these files with bat file. It like like this:

@echo off
cd f:/hotkeys
for /f  %%f in ('dir /b /s .') do start %%f

Create a file with such content and put it in startup directory: Win+R > shell:startup. That's it.

The script was taken from here How to do something to each file in a directory with a batch script.

FreeLightman
  • 2,224
  • 2
  • 27
  • 42