Jump to content

using sleep between functions


Go to solution Solved by jdelaney,

Recommended Posts

_RunAU3("skalistir.au3")
Sleep(10000)
_RunAU3("spastrakuc.au3")
_RunAU3("spastrabuy.au3")
_RunAU3("spastraele.au3")

 Func _RunAU3($sFilePath, $sWorkingDir = "", $iShowFlag = @SW_SHOW, $iOptFlag = 0)
    Return Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $sFilePath & '"', $sWorkingDir, $iShowFlag, $iOptFlag)
 EndFunc

Here is my code and I tried to use sleep between each _RunAU3 line but causes error openning file. And also tried with:

_RunAU3("skalistir.au3")
_RunAU3("spastrakuc.au3")
_RunAU3("spastrabuy.au3")
_RunAU3("spastraele.au3")

 Func _RunAU3($sFilePath, $sWorkingDir = "", $iShowFlag = @SW_SHOW, $iOptFlag = 0)
    Return Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $sFilePath & '"', $sWorkingDir, $iShowFlag, $iOptFlag)
    Sleep(10000)
 EndFunc

But cannot make it work :)

Link to comment
Share on other sites

Are the scripts in the same dir as you current @scriptDir?

What's the failure.

I'd suggest adding a ConsoleWrite of your run command, prior to execution...that way, you can grab the command, and execute it in a CMD prompt, to see the exact failure reason.

Also, because your Return dirctly following the Run, the Sleep will never occur...have the run() return to a variable, and return that variable after the sleep.

$iReturn = Run(...)
Sleep(1000)
Return $iReturn
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

  • Solution

Run this, and provide the output...also, do you know about runwait()?  That waits for your script to complete.

ConsoleWrite(@ScriptDir & @CRLF)
_RunAU3("skalistir.au3")
_RunAU3("spastrakuc.au3")
_RunAU3("spastrabuy.au3")
_RunAU3("spastraele.au3")

Func _RunAU3($sFilePath, $sWorkingDir = "", $iShowFlag = @SW_SHOW, $iOptFlag = 0)
    ConsoleWrite(FileExists($sFilePath) & @TAB & '"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $sFilePath & '"' & @CRLF)
    $iReturn = Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $sFilePath & '"', $sWorkingDir, $iShowFlag, $iOptFlag)
    Sleep(10000)
    Return $iReturn
EndFunc
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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...