Run file

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Johell
Posts: 12
Joined: 17 Apr 2021, 05:39

Run file

21 Apr 2021, 09:36

Hi,
Is it possible to open a file not knowing the exact name, but knowing a part of the name?
gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: Run file

21 Apr 2021, 10:26

Loop, Files allows to use basic matchpatterns (* and ?).
If you find something, you will have to decide if you want to use the first match, or determine a best match (on some criteria you have in mind).

A "fuzzy search" would be more complicated I guess.
Johell
Posts: 12
Joined: 17 Apr 2021, 05:39

Re: Run file

21 Apr 2021, 10:43

I've read the guide but can't figure out how to achieve my goal, I'm new to AHK.
Could you give me a code example that launches the first file it finds that contains the string "capital2" in the name?
User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: Run file

21 Apr 2021, 15:17

Code: Select all

loop, Files, C:\Temp\*capital2* ; put the actual path to your folder
{
	Run, % A_LoopFileFullPath
	break ; stops after first one
}
Johell
Posts: 12
Joined: 17 Apr 2021, 05:39

Re: Run file

23 Apr 2021, 11:35

Thanks :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Google [Bot], jameswrightesq and 289 guests