AHK Startup Under Windows 10

Get help with using AutoHotkey and its commands and hotkeys
09KR0058
Posts: 19
Joined: 11 Apr 2016, 18:08

AHK Startup Under Windows 10

11 Apr 2016, 19:05

Recently upgraded from Windows 7 Ultimate to Windows 10 Pro and AHK is not automatically starting at bootup like it did under Win 7. Its in the Startup folder and that shortcut is set to run as administrator.

What am I missing?

Thanks
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
GitHub: qwerty12

Re: AHK Startup Under Windows 10

11 Apr 2016, 19:22

It's because the shortcut is set to run as Administrator. I guess MS decided to skip running of shortcuts in the Startup folder with the admin compatibility option ticked because seeing a UAC prompt at startup doesn't make for good user experience. I don't know if there's a workaround to re-enable running these sort of shortcuts, but here's what I do instead:

You can use the Task Scheduler to start AutoHotkey. The Task Scheduler will start AHK with full UAC elevation without prompting you for confirmation. Here's two guides for doing this: here and here. Just a word of note: the Task Scheduler will start AutoHotkey with low priority. You can use Process, Priority in your script to readjust the priority back to Normal, or you can export the task, edit the priority in the XML and reimport it.
09KR0058
Posts: 19
Joined: 11 Apr 2016, 18:08

Re: AHK Startup Under Windows 10

13 Apr 2016, 09:25

Ok, thanks. What a PITA! Seems like there should be a way to tell Windows that you completely trust certain applications.
09KR0058
Posts: 19
Joined: 11 Apr 2016, 18:08

Re: AHK Startup Under Windows 10

15 Apr 2016, 14:14

After spending WAY too much time on this, I found a better way. Just add the following registry key. (This is Windows 10 Professional 64-bit)

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run
New -> String Value
Name = AutoHotkey
Value = "C:\Program Files\AutoHotkey\AutoHotkey.exe"

All of the following locations did not work, but the one above did.
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
C:\Users\(username)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

Hopefully this post will save some people all the grief I've been through trying to find a simple way to get AHK to run at startup.
Oldskool

Re: AHK Startup Under Windows 10

15 Apr 2016, 15:53

Weird. Mine runs at startup without any hassle.
Never had any issues with it even after moving to W10 x64.
09KR0058
Posts: 19
Joined: 11 Apr 2016, 18:08

Re: AHK Startup Under Windows 10

15 Apr 2016, 18:50

Oldskool wrote:Weird. Mine runs at startup without any hassle.
Never had any issues with it even after moving to W10 x64.
Just curious, do you have AHK in one of the two startup folders?
User avatar
kczx3
Posts: 1011
Joined: 06 Oct 2015, 21:39

Re: AHK Startup Under Windows 10

15 Apr 2016, 19:26

Oldskool wrote:Weird. Mine runs at startup without any hassle.
Never had any issues with it even after moving to W10 x64.
Same here. All of my scripts just worked when I upgraded from Win7 -> 8 -> 10.
09KR0058
Posts: 19
Joined: 11 Apr 2016, 18:08

Re: AHK Startup Under Windows 10

15 Apr 2016, 19:28

kczx3 wrote:
Oldskool wrote:Weird. Mine runs at startup without any hassle.
Never had any issues with it even after moving to W10 x64.
Same here. All of my scripts just worked when I upgraded from Win7 -> 8 -> 10.
The scripts have always worked fine. The problem was getting AutoHotkey to start automatically when Windows is booted up.
Oldskool

Re: AHK Startup Under Windows 10

15 Apr 2016, 19:39

Over here AHK starts up because I have .ahk scripts that are running on boot.
So no need to add it to startup folders for me, just the scripts will do.
User avatar
kczx3
Posts: 1011
Joined: 06 Oct 2015, 21:39

Re: AHK Startup Under Windows 10

15 Apr 2016, 19:56

09KR0058 wrote:
kczx3 wrote:
Oldskool wrote:Weird. Mine runs at startup without any hassle.
Never had any issues with it even after moving to W10 x64.
Same here. All of my scripts just worked when I upgraded from Win7 -> 8 -> 10.
The scripts have always worked fine. The problem was getting AutoHotkey to start automatically when Windows is booted up.
You're not making sense. AHK doesn't just run. It has to have a script to execute. you put shortcuts to compiled AHK apps or to .ahk files.
09KR0058
Posts: 19
Joined: 11 Apr 2016, 18:08

Re: AHK Startup Under Windows 10

15 Apr 2016, 22:47

Oldskool wrote:Over here AHK starts up because I have .ahk scripts that are running on boot.
So no need to add it to startup folders for me, just the scripts will do.
Are you saying that you just put a .AHK file in your startup folder and that script runs at boot up? Does that then load AutoHotkey so that it is active in the system tray?
09KR0058
Posts: 19
Joined: 11 Apr 2016, 18:08

Re: AHK Startup Under Windows 10

15 Apr 2016, 22:57

kczx3 wrote:
09KR0058 wrote:
kczx3 wrote:
Oldskool wrote:Weird. Mine runs at startup without any hassle.
Never had any issues with it even after moving to W10 x64.
Same here. All of my scripts just worked when I upgraded from Win7 -> 8 -> 10.
The scripts have always worked fine. The problem was getting AutoHotkey to start automatically when Windows is booted up.
You're not making sense. AHK doesn't just run. It has to have a script to execute. you put shortcuts to compiled AHK apps or to .ahk files.
Sorry if I'm not making any sense to you. I've been using AutoHotkey for almost 10 years and I've always had the executable in my startup folder so it would load when I boot the machine. So yes, it does "just run". At startup, the executable loads with its icon showing in the system tray so it is then active for all the hotkeys I use on a daily basis. I have a fairly significant autoexecute script at the beginning of my AutoHotkey.ahk file that runs when the exe loads. Even if I wasn't doing anything with the autoexecute section of the AHK file, it would still "just run" and be active in the system tray.
Oldskool

Re: AHK Startup Under Windows 10

15 Apr 2016, 23:24

You can make a script add itself to the start folder like this : (simplified version)

Code: Select all

FileCreateShortcut, %A_ScriptFullPath%, %A_Startup%\My AHK Script.lnk, %A_ScriptDir%
It's then no longer needed to run AHK as it will be launched ;)

I can understand the confusion about this since when you install AHK and run it, it does launch a sample script in the systray lol
Maybe they should change that to something more useful. (can't be less useful really or you'd have to show nothing 8-) )
09KR0058
Posts: 19
Joined: 11 Apr 2016, 18:08

Re: AHK Startup Under Windows 10

15 Apr 2016, 23:30

Oldskool wrote:You can make a script add itself to the start folder like this : (simplified version)

Code: Select all

FileCreateShortcut, %A_ScriptFullPath%, %A_Startup%\My AHK Script.lnk, %A_ScriptDir%
It's then no longer needed to run AHK as it will be launched ;)

I can understand the confusion about this since when you install AHK and run it, it does launch a sample script in the systray lol
Maybe they should change that to something more useful. (can't be less useful really or you'd have to show nothing 8-) )
Ah, Ok, now I understand. After all these years, I'm still learning AHK! I just didn't think there was a way to get that AHK icon in the system tray without starting the EXE at startup.

Thanks for the help!!!!
Oldskool

Re: AHK Startup Under Windows 10

15 Apr 2016, 23:33

09KR0058 wrote:Are you saying that you just put a .AHK file in your startup folder and that script runs at boot up? Does that then load AutoHotkey so that it is active in the system tray?
You're very welcome.

I got a little carried away and forgot to reply to your question clearly btw:
Every script has a systemtray icon of it's own if it's not manually disabled by #NoTrayIcon.
AHK itself doesn't have one as it just runs in the background.

On a sidenote:
I have so many tray icons that I used to compile my scripts and add an icon in the compiler or set a tray icon for the ahk scripts.
Now it's just too much hassle to either make an icon or scan windows dlls for icons so i have many [H] :lolno:
(now if only AHK could multithread out of the box then I could maybe put all my apps into one easily) :headwall:

8-)
09KR0058
Posts: 19
Joined: 11 Apr 2016, 18:08

Re: AHK Startup Under Windows 10

17 Apr 2016, 18:37

Oldskool wrote: Every script has a systemtray icon of it's own if it's not manually disabled by #NoTrayIcon.
AHK itself doesn't have one as it just runs in the background.
Don't mean to beat a dead horse here, but when I start the AutoHotkey executable at boot time, it does place an icon in the system tray. This got me wondering if that's only because when it starts, its loading the default script at C:\Users\(user name)\Documents\AutoHotkey.ahk.

BTW, never got to a point myself where I was compiling scripts. As much as I use AHK on a daily basis, on every machine I touch, I never really saw the need.

Thanks again for all the info.
USAFA76

Re: AHK Startup Under Windows 10

23 Apr 2017, 11:23

For me, AHK working on startup depended on the version of Win10. I have two Machines, both upgraded from Win7; one is Win10 Professional and the other Win10 home. Both machines automatically started AHK on startup as expected under Win7. However, upon installing the free upgrade to Win10, only the Home version continued to start AHK on startup. The Professional version did not. For my pro machine, I am going to try the registry solution provided by 09KR0058...
UNKNOWN

Re: AHK Startup Under Windows 10

26 Apr 2017, 12:15

For what it is worth and being late to the ball game, I corrected the issue on my end by creating a shortcut to AutohotKey.ahk located in my documents directory, where in windows 7 on startup was launched automatically. Please note this shortcut can be whatever you want.

Please do the following.
Hold down the Windows key, and type R.
Type: shell:startup
Click OK.
move the shortcut to the Startup folder that has now opened up.

now on login the *.ahk file will open and the icon will be found once again in the system tray and autohotkey will work just like it once did.

another way would be by system task.

Cheers.
mvhrzg

Re: AHK Startup Under Windows 10

23 Jun 2017, 10:15

I tried both tutorials on this page on how to create a task to run on startup, also tried placing AutoHotKey.exe and my .ahk file in my startup folder. Nothing worked.

I know I'm pretty late to the game, but I just wanted to share what worked for me in case anyone is having the same issues.
I am running Windows 10 Professional 64bit.

1. navigate to "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoHotkey"
2. double click 'Convert .ahk to .exe'
3. under 'Source', select the .ahk script that you want to run on startup
4. leave 'Destination' blank
5. if you want to, select a custom icon and a base .bin file (p.s.: I left these at their default values. I also left the 'Use MPRESS (...)' box checked)
6. click >Convert<
7. when the 'Conversion complete' popup shows up, there will be a .exe file with the same name as the .ahk file you selected in the same directory as your .ahk file
8. navigate to your startup folder ("C:\Users\<yourUserName>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup")
9. place your .exe file here
10. repeat steps for each .ahk file you want to run on startup
JohnDB
Posts: 1
Joined: 27 Sep 2019, 15:47

Re: AHK Startup Under Windows 10

27 Sep 2019, 16:15

mvhrzg wrote:
23 Jun 2017, 10:15
I tried both tutorials on this page on how to create a task to run on startup, also tried placing AutoHotKey.exe and my .ahk file in my startup folder. Nothing worked.

I know I'm pretty late to the game, but I just wanted to share what worked for me in case anyone is having the same issues.
I am running Windows 10 Professional 64bit.

1. navigate to "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\AutoHotkey"
2. double click 'Convert .ahk to .exe'
3. under 'Source', select the .ahk script that you want to run on startup
4. leave 'Destination' blank
5. if you want to, select a custom icon and a base .bin file (p.s.: I left these at their default values. I also left the 'Use MPRESS (...)' box checked)
6. click >Convert<
7. when the 'Conversion complete' popup shows up, there will be a .exe file with the same name as the .ahk file you selected in the same directory as your .ahk file
8. navigate to your startup folder ("C:\Users\<yourUserName>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup")
9. place your .exe file here
10. repeat steps for each .ahk file you want to run on startup
Hi mvhrzg,

Some days ago I've upgraded my Windows 7 Professional installation on my PC to Windows 10 Professional and also had the problem that my AutoHotkey script wasn't activated automatically on Windows startups although my .ahk file was in the folder C:\Users\MyUsername\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup. After some Internet searches I tried to set up the program C:\Program Files\AutoHotkey\AutoHotkeyU64.exe to start with administrator rights but that didn't solve the problem. Further Internet searches also led to this thread. To my pleasure I haven't tried any other approach before I found your post. Then I tried your approach and to my pleasure it worked immediately. After this I tried to deactivate the administrator rights for AutoHotkeyU64.exe again and my script was still activated automatically on Windows startup. So thanks to you my problem is solved now. Thank you very much. I am using AutoHotkey version 1.1.30.03 on Windows 10 Professional 64 bit version 1803.

Kind regards,
John

Return to “Ask For Help”

Who is online

Users browsing this forum: Albireo, Google [Bot], zergamat and 258 guests