способ открыть у AHK первый файл в папке - PullRequest
0 голосов
/ 01 декабря 2018

Если я хочу открыть первый рис (в алфавитном порядке) папки из всех .jpg, она не работает

Run ...\*.jpg

1 Ответ

0 голосов
/ 01 декабря 2018
; First of all make sure that such a file exists in the folder specified
If FileExist("D:\MyFolder\*.jpg")
{
    ; loop through those files  
    Loop, Files, D:\MyFolder\*.jpg
    {
        If (A_Index = 1) ; as soon as the first file (in alphanumeric order) is retrievend
            Run %A_LoopFileFullPath% ; run this file
                break ; and terminate the loop
    }
}
else
    MsgBox, "D:\MyFolder" doesn't contain any jpg-files

https://autohotkey.com/docs/commands/LoopFile.htm

https://autohotkey.com/docs/commands/FileExist.htm

...