My script is a GUI for another program, but it needs to assure that the other program is installed, and needs to find the file path.
The program could be installed anywhere - c:\program files\thisapp, c:\program files (x86)\thisapp, c:\thisapp, etc.
However, it always resides in a folder with it's own application name, in my example here, "thisapp".
Sometimes it may also be an environmental variable.
What is the best approach to discovering it's location?
I want to add a sort of wizard that will locate the executable.
So far, all I can think of is to use FileLoop somehow and hope it doesn't take forever, or look in the most likely places and hope it's just there.
Best way to find an executable
Re: Best way to find an executable
Have you tried a search loop through HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall? If the app writes an entry there then it should be easy to find its InstallLocation.
Have a look at https://autohotkey.com/docs/commands/LoopReg.htm#new for more info/examples.
Hope this helps...
Have a look at https://autohotkey.com/docs/commands/LoopReg.htm#new for more info/examples.
Hope this helps...
Re: Best way to find an executable
The program in mind won't have an entry there - it uses an unconventional installer.
My Stuff: mousey; volume; ahkinfo; instantbirder; npp highlighter; Dynamic File Menu; tv - a treeview library;
- Masonjar13
- Posts: 1555
- Joined: 20 Jul 2014, 10:16
- Location: Не Россия
- Contact:
Re: Best way to find an executable
The best efficiency method I can think of is to loop through the folders in the most likely places (start deeper and go up) (with recursion). So, check the folders in, say, program files, then if it's not there, check the next place. If all else fails, then you can do a system-wide search.
Alternatively, if it's already running, you can just grab the path from the processes command line info. Just prompt the user to run it, while constantly checking the processes, wait for it to exist, then grab it and continue.
Alternatively, if it's already running, you can just grab the path from the processes command line info. Just prompt the user to run it, while constantly checking the processes, wait for it to exist, then grab it and continue.
Re: Best way to find an executable
- If it has a Start menu link, try searching in these folders:
A_StartMenu
A_StartMenuCommon
- Some programs store their full paths in the registry:
HKEY_CLASSES_ROOT\Applications
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
Best way to get the path to an executable - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 51#p168051
A_StartMenu
A_StartMenuCommon
- Some programs store their full paths in the registry:
HKEY_CLASSES_ROOT\Applications
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
Best way to get the path to an executable - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 51#p168051
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Who is online
Users browsing this forum: Google [Bot], inseption86, just me, metallizer and 179 guests