TehWhale Posted September 1, 2008 Share Posted September 1, 2008 I made this tiny function just to simply compile an Au3 script. I was going to use Binary to include the files, but it was 65k characters long. So, well, here ya go! Func _CompileAu3Script($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 Link to comment Share on other sites More sharing options...
Andreik Posted September 1, 2008 Share Posted September 1, 2008 (edited) But if I have installed AutoIt in other folder? Read path from registry. HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt Edited September 1, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Developers Jos Posted September 1, 2008 Developers Share Posted September 1, 2008 Doesn't this already exist ? Jos SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
TehWhale Posted September 1, 2008 Author Share Posted September 1, 2008 I didn't think it did. I guess it does. Link to comment Share on other sites More sharing options...
dansxmods Posted October 13, 2008 Share Posted October 13, 2008 But if I have installed AutoIt in other folder? Read path from registry. HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoItFileInstall can't use a variable as the source file path. Daniel Link to comment Share on other sites More sharing options...
TehWhale Posted October 13, 2008 Author Share Posted October 13, 2008 FileInstall can't use a variable as the source file path.DanielThat is true, never thought of that Link to comment Share on other sites More sharing options...
Jussip Posted November 8, 2008 Share Posted November 8, 2008 any examples? Link to comment Share on other sites More sharing options...
TehWhale Posted November 8, 2008 Author Share Posted November 8, 2008 Make a AutoIt script and then call this: #Include "Compile.au3" _CompileAu3Script(@ScriptDir&"\New AutoIt v3 Script.au3") MsgBox(0, "Compiling", "Done...") 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