Jump to content

Running the Compiler


Recommended Posts

It won't let me copy it so I have to type it:

C:\Program Files\AutoIt3\Aut2Exe\Aut2exe.exe /In C:\Docume~1\Jar\Locals~1\Temp\Script.au3 /Out C:\Documents and settings\Jar\Desktop\AutoIt Script Editor\Beep.exe /Icon Icon.ico /Comp 4

Edited by JustinReno
Link to comment
Share on other sites

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

And Icon.ico is in the currently running scriptdir right? not the scriptdir of the script to be created right?

Also look at this and let me know the results:

If Not FileExists( "C:\Script.au3" ) Then FileWrite( "C:\Script.au3", 'MsgBox(0,"Test","It Worked")')
FileCopy( @ProgramFilesDir&"\AutoIt3\Icons\filetype3.ico", @ScriptDir&"\testico.ico" )
Run(@ProgramFilesDir&"\AutoIt3\Aut2Exe\Aut2exe.exe /In C:\Script.au3 /Out C:\saveme.exe /icon testico.ico")

It should create script.au3 on C:\ and convert to saveme.exe also on C:\

Link to comment
Share on other sites

Ok, I'm completely sorry, I had to go and eat dinner.

Anyways, here is my code that doesn't work... :)

I tried to follow your structure of that script...

FileCopy( @ProgramFilesDir&"\AutoIt3\Icons\filetype3.ico", @ScriptDir&"\testico.ico" )
            Run(@ProgramFilesDir&"\AutoIt3\Aut2Exe\Aut2exe.exe /In C:\Script.au3 /Out C:\saveme.exe /icon testico.ico")
            $Path = FileSelectFolder("AutoIt Script Editor - Select Save Directory", @HomePath)
            $FileName = InputBox("AutoIt Script Editor - Type File Name", "Please type in your wanted file name:")
            $Icon = FileOpenDialog("AutoIt Script Editor - Choose Icon", @HomeDrive, "Icons(*.ico)")
            $EXEPath = $Path & "\" & $FileName
            FileWrite($Path, GUICtrlRead($Edit))
            FileCopy($Icon, @ScriptDir&"\Icon.ico")
            Run(@ProgramFilesDir&"\AutoIt3\Aut2Exe\Aut2exe.exe /In "&$Path&$FileName&" /Out "&$EXEPath&" /Icon "&$Icon&"")
Link to comment
Share on other sites

Okay, I took another look at this and came up with a function I think can work for you.

#region Test Code
$return = Aut2ExeThisFile('MsgBox(0,"test","It Worked")')
If Not @error Then
    MsgBox(0, "Success", $return)
Else
    If @error = 1 Then
        MsgBox(0, "Error", "The Cancel button was pushed.")
    ElseIf @error = 2 Then
        MsgBox(0, "Error", "The Timeout time was reached.")
    ElseIf @error = 3 Then
        MsgBox(0, "Error", "The InputBox failed to open. This is usually caused by bad arguments.")
    ElseIf @error = 4 Then
        MsgBox(0, "Error", "User canceled or closed Folder Selection window.")
    EndIf
EndIf
#endregion

;~ Aut2ExeThisFile(GUICtrlRead($Edit)) ; For You To Use

Func Aut2ExeThisFile($AutoitCode)
    $Path = FileSelectFolder("AutoIt Script Editor - Select Save Directory", @HomePath)
    If @error Or $Path = "" Then
        SetError(4)
        Return @error
    EndIf
    $FileName = InputBox("AutoIt Script Editor - Type File Name", "Please type in your wanted file name:")
    $FileName = StringReplace($FileName, " ", "_")                  ;  no spaces allowed  -  MAY NEED TO ADD OTHER ILLEGAL CHARACTER CHECKS HERE !!!!!
    If @error Then
        If @error = 1 Then
            SetError(1)
            Return @error
        EndIf
        If @error = 2 Then
            SetError(2)
            Return @error
        EndIf
        If @error = 3 Then
            SetError(3)
            Return @error
        EndIf
    EndIf
    $EXEPath = $Path & $FileName
    FileWrite($Path & $FileName & ".au3", $AutoitCode)
    $icon = FileOpenDialog("AutoIt Script Editor - Compile Icon", "C:\Program Files\AutoIt3\Icons", "Icons(*.ico)", 1)
    $splitpath = StringSplit($icon, "\")
    If Not FileExists(@ScriptDir & "\" & $splitpath[UBound($splitpath) - 1]) Then
        FileCopy($icon, @ScriptDir & "\" & $splitpath[UBound($splitpath) - 1])
    EndIf
    Run(@ProgramFilesDir & "\AutoIt3\Aut2Exe\Aut2exe.exe /In " & $Path & $FileName & ".au3" & " /Out " & $EXEPath & ".exe" & " /Icon " & $splitpath[UBound($splitpath) - 1])
    Return $FileName & ".au3 was compiled to:" & @CRLF & $EXEPath & ".exe" & @CRLF & "Icon Used: " & $splitpath[UBound($splitpath) - 1]
EndFunc   ;==>Aut2ExeThisFile
Edited by danwilli
Link to comment
Share on other sites

Ok, well I fixed the path problem:

$EXEPath = $Path & $FileName

To this:

$EXEPath = $Path & "\" & $FileName

But, after I reran it, it still gave me a msgbox telling me the command line usage of Aut2exe.exe, even though the script said it was a success. :P

This isn't a big priority for me right now, but you can still work on it if you like.

Just ask me if you want the full source to this small (98 line) editor. :)

Link to comment
Share on other sites

Honestly, if you don't know the basics of paths (particularly those with spaces), give up now and go to work on something a little more basic. That goes for both of you, people with 1500+ and 800+ posts have been on the forum long enough by now to spot simple errors like not quoting paths.

Link to comment
Share on other sites

Honestly, if you don't know the basics of paths (particularly those with spaces), give up now and go to work on something a little more basic. That goes for both of you, people with 1500+ and 800+ posts have been on the forum long enough by now to spot simple errors like not quoting paths.

I think... in an asshole way... Valik is trying to say, quotes paths that have spaces in them.

I'm glad I come here everyday to try and help, just for this.

Fuck that!

Link to comment
Share on other sites

If you call scripts that don't accept icons with spaces in the name/path as "working" and don't understand why that works until somebody points it out to you, then I guess you did post "working" scripts.

Link to comment
Share on other sites

I used the workaround of replacing spaces with "_" underscores.

I didn't think of the quotes, for whatever reason. Bonehead move on my part.

I still don't understand why you have to come in and post like an asshole. I appreciated the knowledge you had to share, and I thank you for it. Why did you have to be a fucking dick about it though?

Made you feel good?

Fuck you dick!

Link to comment
Share on other sites

I still don't understand why you have to come in and post like an asshole.

Because I am an asshole.

Why did you have to be a fucking dick about it though?

Because I am a dick.

Fuck you dick!

And that'll be a 24-hour ban. Just because somebody is a dick to you doesn't mean you get to curse them like a 12-year old.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...