Save your time and open files randomly with AHK


Usage scenario: there are too many hard disk resources to waste time looking for. Use software to open files randomly
I will put the complete code and exe file at the end of the text, which can be downloaded and used directly

1. Create a new AHK script file and add the following code to make the script run as fast as possible

SetBatchLines, -1

2. Draw GUI interface

GUI, add, button, W125, H40, video
GUI, add, button, W125, H40, picture
Gui, -MaximizeBox -MinimizeBox ; Remove title block minimize and maximize controls
GUI, show, w150, H100, random open

3. Create a function to let you select the folder path, scan the files with matching format, and run the first line of filelist string with loop function (I just want to parse the string in this way for the time being)

Function(x) {
    Fileselectfolder, which folder,: {20d04fe0-3aea-1069-a2d8-08002b30309d}, select the path; My computer
    if ErrorLevel {
       ; When deselecting, send return to jump out of function to prevent continuing
    Loop Files, %WhichFolder%\*.% x%, R  ; Recursive subfolder matching format
         FileList .= A_LoopFilePath "`n"

    Sort, FileList, Random  ; Upset
    Sort, FileList, Random  ; Disrupt again

    Loop, Parse, FileList, `n
        Msgbox 4, open file?,% A_ LoopField% 
        IfMsgBox Yes
            Run %A_LoopField%

4. Go back to the bottom of GUI code, add response to Gui button, use function and pass parameters

Button Video:

Button picture:

5. Finally, make exit events for ESC and close of GUI interface


6. Complete code:
Password: b1az