whisper-ahk/Compile Transcriber to EXE.ahk
2024-01-14 21:39:35 -05:00

98 lines
2.3 KiB
AutoHotkey

;---ENVIRONMENT---------------------------------------------------------------------
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;#Warn ; Enable warnings to assist with detecting common errors.
;DetectHiddenWindows, On
#SingleInstance, Force
DetectHiddenWindows, ON
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;SetKeyDelay, 500
CoordMode, ToolTip, Screen
CoordMode, Mouse, Screen
; #NoTrayIcon
; Menu, Tray, Icon, RMScriptManager.ico
;---Notes/Extra Info/#Includes------------------------------------------------------
; msgbox
;---VARIABLES-----------------------------------------------------------------------
/*ScriptToCompile = %1%
CompileType = %2% ; Testing OR Production
if(CompileType = "")
CompileType = Testing
; Msgbox % "CompileType: " CompileType
if(ScriptToCompile = "")
ExitApp
*/
; Msgbox % "ScriptToCompile: " ScriptToCompile
ScriptToCompile = SocialMediaPoster
; ScriptToCompile = ScriptUpdater
;---MAIN SCRIPT---------------------------------------------------------------------
AHKFilepath = %A_ScriptDir%\Whisper-AHK.ahk
Exefilepath = %A_ScriptDir%\Whisper-AHK.exe
icopath = %A_ScriptDir%\Assets\Elegantthemes-Beautiful-Flat-Speaker.ico
; Kill any active intances of the uploaders so the .exe file can be overwriten by the compilation
process, close, Whisper-AHK.exe
sleep, 1000
; Delete the .exe file so it can be repalced
if(FileExist(Exefilepath)){
FileDelete, %Exefilepath%
if(ErrorLevel){
msgbox, failed to delete Exe file. Please delete manually and re-run the compiler.
ExitApp
}
}
if(!FileExist(AHKFilepath)){
msgbox, %AHKFilepath% does not exist`nExiting
ExitApp
}
if(!FileExist(icopath)){
msgbox, %icopath% does not exist`nExiting
ExitApp
}
; create multiple exes for running multiple instances
loop, 5 {
SplitPath, Exefilepath, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
LoopExeFilepath = %OutDir%/%OutNameNoExt%-%A_index%.exe
run, %comspec% /c ""C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "%AHKFilepath%" /out "%LoopExeFilepath%" /icon "%icopath%""
}
; OldNotify(ScriptToCompile,"Compiled Successfully",5)
; sleep, 5000
ExitApp
;---FUNCTIONS-----------------------------------------------------------------------