Skip to content

Instantly share code, notes, and snippets.

@estasney
Created April 20, 2021 15:03
Show Gist options
  • Save estasney/3fdd0bc92c2ca4e27e04e49422d9260a to your computer and use it in GitHub Desktop.
Save estasney/3fdd0bc92c2ca4e27e04e49422d9260a to your computer and use it in GitHub Desktop.
AutoHotKey Script Runner
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance Force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
# Change to folder with .bat scripts
SetWorkingDir C:\path\to\folder
#
FileListMsg :=""
FileNameReadable :=""
Readable2File := {}
ReadableFile(x) {
temp := StrReplace(x, ".bat", "")
temp := StrReplace(temp, "_", " ")
StringUpper, temp, temp, T
return temp
}
Loop Files, *.bat, F
{
FileNameReadable := ReadableFile(A_LoopFileName)
FileListMsg .= FileNameReadable "|"
Readable2File[FileNameReadable] := A_LoopFileName
}
Gui, +AlwaysOnTop -SysMenu ;
Gui, FileGui: Font, s18 cRed norm, Lucida Console ;
Gui, FileGui:Add, DropDownList, vFileSelect w450 Sort, %FileListMsg%
Gui, FileGui:Add, Button, x+150 w150 gAccepted, OK
Gui, FileGui:Show
Return ; wait for user
GuiEscape:
GuiClose:
Accepted:
Gui, FileGui:Submit
ScriptName := Readable2File[FileSelect]
Run, "%ScriptName%", .
ExitApp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment