Sign in to follow this  
Followers 0
darkmaster071

Gui terminating executing functions?

5 posts in this topic

I have a script on a OnEvent GUI that automates a website and it has a bunch of ieloadwaits, sleeps, loops.... and i would like to terminate that main function script with a press of a gui button. So im wondering if there is a function that terminates executing of another function no matter if it is currently in sleep, loop... or any other function that halts code. Hope you understand. Help much appreciated. Thanks.

Share this post


Link to post
Share on other sites



I think hotkeyset is what you are looking for. If not, try adlibenable to check to see if a button is pressed while the rest of the script executes.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yeah hotkey does activate the function bound to it even if the rest of the script is in "halt" like sleep, loop.... But i still need a command to stop that main function executing. Ive been trying this, but it does nothing. And AdlibEnable also just calls a function, but every x time...

HotKeySet("{F9}", "terminate")

mainscript....

Func terminate()
    Return 0
    EndFunc
Edited by darkmaster071

Share this post


Link to post
Share on other sites

Bump?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yeah hotkey does activate the function bound to it even if the rest of the script is in "halt" like sleep, loop.... But i still need a command to stop that main function executing. Ive been trying this, but it does nothing. And AdlibEnable also just calls a function, but every x time...

HotKeySet("{F9}", "terminate")

mainscript....

Func terminate()
    Return 0
    EndFunc
There is no method for exiting a function except Return, or reaching the end of the function (exiting the loop). You could have the function periodically check a Global flag variable and Return/ExitLoop when something else changes that.
Global $f_Run = True

HotKeySet("{F9}", "terminate")

_Main()

Func _Main()
    While $f_Run
        Sleep(10)
    WEnd
EndFunc
MsgBox(64, "Done", "Done.")

Func terminate()
    $f_Run = False
EndFunc

:)

Edit: Clarity.

Edited by PsaltyDS

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

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
Sign in to follow this  
Followers 0