[Solved] Is it Possible to Set the "Image Name" of a Script? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Buddha Nature
Posts: 34
Joined: 13 Feb 2022, 06:42

[Solved] Is it Possible to Set the "Image Name" of a Script?

Post by Buddha Nature » 30 Apr 2022, 09:14

I have a couple of scripts that I run on my system all the time. If I look in Windows Task Manager each script instance is shown as having the "Image Name", "AutoHotkey.exe". Is there a command/directive that one can include in a script to specify the Image Name of the script that will show in Windows Task Manager when the script is being run?
Last edited by Buddha Nature on 30 Apr 2022, 10:33, edited 1 time in total.

User avatar
Spawnova
Posts: 557
Joined: 08 Jul 2015, 00:12
Contact:

Re: Is it Possible to Set the "Image Name" of a Script?

Post by Spawnova » 30 Apr 2022, 09:29

I'm not sure about that, perhaps someone else will know...

However, compiling your script will allow you to set a custom icon and it will show the executable name in task explorer as well instead of autohotkey.exe.

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Is it Possible to Set the "Image Name" of a Script?

Post by mikeyww » 30 Apr 2022, 09:46

You can also show the command line, which includes the path to the script.

User avatar
Buddha Nature
Posts: 34
Joined: 13 Feb 2022, 06:42

Re: Is it Possible to Set the "Image Name" of a Script?

Post by Buddha Nature » 30 Apr 2022, 09:50

Thank you Spawnova. Yes, I discovered the compile a script option which might be fine for most scripts.

However, one of the scripts I am using permanently is the excellent and truly useful AutoCorrect script and to get all its functionality — adding new autocorrect hotstrings and having the script auto-reload itself — it really is necessary to run it as a script and not as a compiled exe file.

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Is it Possible to Set the "Image Name" of a Script?  Topic is solved

Post by mikeyww » 30 Apr 2022, 09:52

You can run a script that way by making a copy of AutoHotkey.exe. Rename the copy so that the file name matches the script's name; keep the .exe extension. Put both files into the same directory. You can then run the new copy of AutoHotkey that you have renamed.

Explained: Script filename
Script Filename: This can be omitted if there are no Script Parameters. If omitted (such as if you run AutoHotkey directly from the Start menu), the program looks for a script file called AutoHotkey.ahk in the following locations, in this order: the directory which contains the AutoHotkey executable; the current user's Documents folder. The filename AutoHotkey.ahk depends on the name of the executable used to run the script. For example, if you rename AutoHotkey.exe to MyScript.exe, it will attempt to find MyScript.ahk. If you run AutoHotkeyU32.exe without parameters, it will look for AutoHotkeyU32.ahk.

User avatar
Buddha Nature
Posts: 34
Joined: 13 Feb 2022, 06:42

Re: Is it Possible to Set the "Image Name" of a Script?

Post by Buddha Nature » 30 Apr 2022, 09:56

mikeyww wrote:
30 Apr 2022, 09:46
You can also show the command line, which includes the path to the script.
Sorry mike, I'm a fairly naïve user of AutoHotkey so I don't understand what you are trying to say.

User avatar
Buddha Nature
Posts: 34
Joined: 13 Feb 2022, 06:42

Re: Is it Possible to Set the "Image Name" of a Script?

Post by Buddha Nature » 30 Apr 2022, 10:03

mikeyww wrote:
30 Apr 2022, 09:52
You can run a script that way by making a copy of AutoHotkey.exe...
Ah, yes! Got it now, works a treat. Thank you, Mike!

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: [Solved] Is it Possible to Set the "Image Name" of a Script?

Post by mikeyww » 30 Apr 2022, 10:41

Good to hear. Regarding Task Manager, you can right-click Name -> Select columns -> Command line. That will show the path to the process (program), as well as the path to the script file.

Post Reply

Return to “Ask for Help (v1)”