ntprohd

AutoIt3ExecuteScript

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Add this line at the top of your script:

#pragma compile(AutoItExecuteAllowed, true)

Jos

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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