Jump to content

AutoIt3ExecuteScript


Recommended Posts

I have a function func to run the command line in the .txt file, when I run it on file .au3 it done, but when I compile it into an .exe file, it does not work func.

Compiled script (play.exe)

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

While 1
    _Play("play.txt")
    Exit
WEnd

Called script (play.txt)

run("Notepad.exe")
Sleep(1000)
ControlSend("Untitled - Notepad","","[CLASS:Edit; INSTANCE:1]","hello 1" & @CR)
Sleep(1000)
ControlSend("Untitled - Notepad","","[CLASS:Edit; INSTANCE:1]","hello 2" & @CR)
Sleep(1000)
ControlSend("Untitled - Notepad","","[CLASS:Edit; INSTANCE:1]","hello 3" & @CR)
Edited by ntprohd
Link to comment
Share on other sites

  • Developers

Add this line at the top of your script:

#pragma compile(AutoItExecuteAllowed, true)

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

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...