TehWhale Posted August 31, 2008 Share Posted August 31, 2008 (edited) I'm creating a _CompileScript function. I went through the helpfile to find how to use the Aut2exe.exe cmdline parameters, but I run it, and Aut2Exe.exe says im wrong. Heres my script: _Compile(@DesktopDir&"\script.au3") Func _Compile($pScript, $Outfile=Default, $pIcon="") If Not FileExists($pScript) Then Return SetError(1, 0, 0) If $Outfile = Default Or $Outfile = "" Or $Outfile = -1 Then $aSplitString = StringSplit($pScript, "\") $Outfile = StringReplace($aSplitString[$aSplitString[0]], ".au3", ".exe") EndIf $bCompiler = @TempDir&"\aut2exe.exe" $bBin = @TempDir&"\autoitsc.bin" $bUpx = @TempDir&"\upx.exe" FileInstall("C:\Program Files\AutoIt3\Aut2Exe\Aut2exe.exe", $bCompiler) FileInstall("C:\Program Files\AutoIt3\Aut2Exe\AutoItSC.bin", $bBin) FileInstall("C:\Program Files\AutoIt3\Aut2Exe\upx.exe", $bUpx) If $pIcon = "" Or $pIcon = -1 Or $pIcon = Default Then ShellExecute($bCompiler, "/in "&$pScript&" "&$Outfile) Else ShellExecute($bCompiler, "/in "&$pScript&" "&$Outfile&" "&$pIcon) EndIf FileDelete($bBin) FileDelete($bCompiler) FileDelete($bUpx) Return 1 EndFunc Any help is appericated! Edited August 31, 2008 by Alienware Link to comment Share on other sites More sharing options...
Tiger Posted August 31, 2008 Share Posted August 31, 2008 (edited) Try this. Compile(@DesktopDir&"\script.au3") Func _Compile($pScript, $Outfile=Default, $pIcon="") If Not FileExists($pScript) Then Return SetError(1, 0, 0) If $Outfile = Default Or $Outfile = "" Or $Outfile = -1 Then $aSplitString = StringSplit($pScript, "\") $Outfile = StringReplace($aSplitString[$aSplitString[0]], ".au3", ".exe") EndIf $bCompiler = @TempDir&"\aut2exe.exe" $bBin = @TempDir&"\autoitsc.bin" $bUpx = @TempDir&"\upx.exe" FileInstall("C:\Program Files\AutoIt3\Aut2Exe\Aut2exe.exe", $bCompiler) FileInstall("C:\Program Files\AutoIt3\Aut2Exe\AutoItSC.bin", $bBin) FileInstall("C:\Program Files\AutoIt3\Aut2Exe\upx.exe", $bUpx) If $pIcon = "" Or $pIcon = -1 Or $pIcon = Default Then ShellExecuteWait($bCompiler, '/in "' & $pScript & '" /out "' & $Outfile & '"') Else ShellExecuteWait($bCompiler, '/in "' & $pScript & '" /out "' & $Outfile & '" /icon "' & $pIcon & '"') EndIf FileDelete($bBin) FileDelete($bCompiler) FileDelete($bUpx) Return 1 EndFunc Edited August 31, 2008 by Tiger My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
TehWhale Posted August 31, 2008 Author Share Posted August 31, 2008 (edited) C:\Users\MOO-COWZZMOO!!!!\Desktop\New AutoIt v3 Script (13).au3(16,82) : ERROR: syntax error ShellExecuteWait($bCompiler, '/in "' & $pScript & " /out "'& $Outfile & ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\MOO-COWZZMOO!!!!\Desktop\New AutoIt v3 Script (13).au3(18,82) : ERROR: syntax error (illegal character) ShellExecuteWait($bCompiler, '/in "' & $pScript & " /out "'& $Outfile & ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\MOO-COWZZMOO!!!!\Desktop\New AutoIt v3 Script (13).au3 - 2 error(s), 0 warning(s) EDIT: I saw your edit. Thanks man! It works now!! Edited August 31, 2008 by Alienware Link to comment Share on other sites More sharing options...
Tiger Posted August 31, 2008 Share Posted August 31, 2008 Try this. Compile(@DesktopDir&"\script.au3") Func _Compile($pScript, $Outfile=Default, $pIcon="") If Not FileExists($pScript) Then Return SetError(1, 0, 0) If $Outfile = Default Or $Outfile = "" Or $Outfile = -1 Then $aSplitString = StringSplit($pScript, "\") $Outfile = StringReplace($aSplitString[$aSplitString[0]], ".au3", ".exe") EndIf $bCompiler = @TempDir&"\aut2exe.exe" $bBin = @TempDir&"\autoitsc.bin" $bUpx = @TempDir&"\upx.exe" FileInstall("C:\Program Files\AutoIt3\Aut2Exe\Aut2exe.exe", $bCompiler) FileInstall("C:\Program Files\AutoIt3\Aut2Exe\AutoItSC.bin", $bBin) FileInstall("C:\Program Files\AutoIt3\Aut2Exe\upx.exe", $bUpx) If $pIcon = "" Or $pIcon = -1 Or $pIcon = Default Then ShellExecuteWait($bCompiler, '/in "' & $pScript & '" /out "' & $Outfile & '"') Else ShellExecuteWait($bCompiler, '/in "' & $pScript & '" /out "' & $Outfile & '" /icon "' & $pIcon & '"') EndIf FileDelete($bBin) FileDelete($bCompiler) FileDelete($bUpx) Return 1 EndFunc More information: AutoIt Helpfile -> AutoIt -> Using AutoIt -> Compiling Scripts My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now