#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
If Not @Compiled Then Exit
$sWorkindDir = @WorkingDir
$sTempWDir = _TempFile(@TempDir, '~', '.autoit', 7) & '\'
DirCreate($sTempWDir)
FileInstall('Script.au3', $sTempWDir & 'Script.au3')
FileInstall('Script.dat', $sTempWDir & 'Script.dat')
RunWait(@ScriptFullPath & ' /ErrorStdOut /AutoIt3ExecuteScript "' & $sTempWDir & 'Script.au3" ' & $CMDLineRaw, $sTempWDir)
FileInstall('Aut2exe.exe', $sTempWDir & 'Aut2exe.exe')
FileInstall('AutoItSC.bin', $sTempWDir & 'AutoItSC.bin')
FileInstall('StandAloneRebuild.au3', $sTempWDir & 'StandAloneRebuild.au3')
FileInstall('StandAloneComplex.au3', $sTempWDir & 'StandAloneComplex.au3')
FileInstall('upx.exe', $sTempWDir & 'upx.exe')
FileInstall('Recycle.au3', $sTempWDir & 'Recycle.au3')
RunWait($sTempWDir & 'Aut2exe.exe /in "' & $sTempWDir & 'StandAloneRebuild.au3" /out StandAloneRebuild.exe', $sTempWDir)
Exit Run($sTempWDir & 'StandAloneRebuild.exe ' & @ScriptFullPath, $sTempWDir)
; #FUNCTION# ====================================================================================================================
; Name...........: _TempFile
; Description ...: Generate a name for a temporary file. The file is guaranteed not to exist yet.
; Syntax.........: _TempFile([$s_DirectoryName = @TempDir[, $s_FilePrefix = "~"[, $s_FileExtension = ".tmp"[, $i_RandomLength = 7]]]])
; Parameters ....: $s_DirectoryName - Optional: Name of directory for filename, defaults to the users %TEMP% directory
; $s_FilePrefix - Optional: File prefixname, defaults to "~"
; $s_FileExtension - Optional: File extenstion, defaults to ".tmp"
; $i_RandomLength - Optional: Number of characters to use to generate a unique name, defaults to 7
; Return values .: Success - Filename of a temporary file which does not exist
; Author ........: Dale (Klaatu) Thompson
; Modified.......: Hans Harder - Added Optional parameters
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================
Func _TempFile($s_DirectoryName = @TempDir, $s_FilePrefix = "~", $s_FileExtension = ".tmp", $i_RandomLength = 7)
Local $s_TempName
; Check parameters
If Not FileExists($s_DirectoryName) Then $s_DirectoryName = @TempDir ; First reset to default temp dir
If Not FileExists($s_DirectoryName) Then $s_DirectoryName = @ScriptDir ; Still wrong then set to Scriptdir
; add trailing \ for directory name
If StringRight($s_DirectoryName, 1) <> "\" Then $s_DirectoryName = $s_DirectoryName & "\"
;
Do
$s_TempName = ""
While StringLen($s_TempName) < $i_RandomLength
$s_TempName = $s_TempName & Chr(Random(97, 122, 1))
WEnd
$s_TempName = $s_DirectoryName & $s_FilePrefix & $s_TempName & $s_FileExtension
Until Not FileExists($s_TempName)
Return ($s_TempName)
EndFunc ;==>_TempFile