Jump to content

Script Fails when EXE, runs as au3


Go to solution Solved by Danp2,

Recommended Posts

This is strange. I wrote this function:
 

Func _AU3_RunScript($scriptstring)

    Local $ReturnValue = 0

    Local $ScriptFile = _WinAPI_GetTempFileName(@TempDir, "~")
    FileWrite($ScriptFile, $scriptstring)
    Local $ScriptRunning = RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & $ScriptFile & '"', @TempDir, @SW_HIDE)
    If $ScriptRunning = 0 Then
        FileDelete($ScriptFile)
        $ReturnValue = 1
    Else
        ConsoleWrite("ScriptRunning:" & $ScriptRunning)
    EndIf
    
    Return $ReturnValue
    
EndFunc

And to test it:

_AU3_RunScript('MsgBox(0, "this", "message")')

 

When I run it from SCITE it runs just fine. No errors, shows the message box.

When I compile it into an exe (using SCITE) and run the EXE file, I get an an error at `If $ScriptRunning = 0 Then` - - I'm getting $ScriptRunning = -1

What am I missing?

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

×
×
  • Create New...