Jump to content

stopping script


Recommended Posts

hi ...

i'm executing script from another with

ShellExecute ("AutoIt3.exe","test2.au3")

that's work fine, but in same case it take mach time, so i want to stop the execution of the lunched script (test2) after a predefined timeout.

and killing the Autoit process will end my principal script, and i dont want that happen ...

can anyone give me some ideas please..

tester under construction ... please wait…

Link to comment
Share on other sites

oh it seams that i found a solution

in test2 i should make a thing like this

HotKeySet("{ESC}", "Terminate")

Func Terminate()
    Exit 0
EndFunc

and when i want to stop my script i samply use the hotkey

ShellExecute ("AutoIt3.exe","test2.au3")
Sleep(5000)
Send("{ESC}")
; the rest of script

there's other option ??

tester under construction ... please wait…

Link to comment
Share on other sites

oh it seams that i found a solution

in test2 i should make a thing like this

HotKeySet("{ESC}", "Terminate")

Func Terminate()
    Exit 0
EndFunc

and when i want to stop my script i samply use the hotkey

ShellExecute ("AutoIt3.exe","test2.au3")
Sleep(5000)
Send("{ESC}")
; the rest of script

there's other option ??

WinClose() probably

or

WinKill()

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

hi ...

i'm executing script from another with

ShellExecute ("AutoIt3.exe","test2.au3")

that's work fine, but in same case it take mach time, so i want to stop the execution of the lunched script (test2) after a predefined timeout.

and killing the Autoit process will end my principal script, and i dont want that happen ...

can anyone give me some ideas please..

Run it with Run() instead of ShellExecute() so you get the PID back. If required, you can ProcessClose() it.

If the script has a GUI that will recognize $GUI_EVENT_CLOSE and close itself, then you could just WinClose() it.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Run it with Run() instead of ShellExecute() so you get the PID back. If required, you can ProcessClose() it.

If the script has a GUI that will recognize $GUI_EVENT_CLOSE and close itself, then you could just WinClose() it.

;)

tks, i traied it and that work well, but i'm confused i traied to work with Run command before but it doesent working, but now that seams good :D

tester under construction ... please wait…

Link to comment
Share on other sites

I know that you have it working like you want - but to document a few other options in this thread for when others find it in a forum search:

Each autoit script has a hidden window and you can use AutoItWinSetTitle to change the title of that window then WinClose to end the second script.

AutoItWinSetTitle("This is test2.au3")
from the help file:

Remarks

The AutoIt window is usually hidden. The purpose of changing the title is to allow other programs (or other AutoIt scripts) to interact with AutoIt.

Also, /AutoIt3ExecuteScript can be used to start another script from a main script. See this thread for examples of how to do it if the main script is an au3 file. http://www.autoitscript.com/forum/index.php?showtopic=22531

So many options :-)

[size="1"][font="Arial"].[u].[/u][/font][/size]

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