Valley Posted June 24, 2008 Share Posted June 24, 2008 Hey I've just recently started learning AutoIt, I've had a look through the forums/google and couldn't find anything on this; so I was wondering if it possible to EndFunc half way through code on a command. e.g. HotKeySet("{F9}", "Cheese stop") Func Cheese() Sleep(1000) Send("a") Sleep(1000) Send("a") Sleep(1000) Send("a") Sleep(1000) Send("a") EndFunc Is there anyway to assign F9 to cancel running through the 'Cheese' function at any location throughout the code? Any help appreciated! Link to comment Share on other sites More sharing options...
BrettF Posted June 24, 2008 Share Posted June 24, 2008 You did not need to create a new topic. There is an edit button for when firefox stuffs up. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Valley Posted June 24, 2008 Author Share Posted June 24, 2008 True, but I didn't realise it made 2 posts until I had finished this one properly. + there's no delete button (I can find) Link to comment Share on other sites More sharing options...
Linux Posted June 24, 2008 Share Posted June 24, 2008 Global Run = true HotKeySet("{F9}", "Cheese stop") HotKeySet("{F8}", "stop") Func Cheese() Sleep(1000) If not $run then $run = $true return endif Send("a") Sleep(1000) If not $run then $run = $true return endif Send("a") Sleep(1000) If not $run then $run = $true return endif Send("a") Sleep(1000) If not $run then $run = $true return endif Send("a") EndFunc Func Stop() $run = false end func There may be other ways, this is only one. You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!" Link to comment Share on other sites More sharing options...
goldenix Posted June 24, 2008 Share Posted June 24, 2008 as he said: RETURN forces your prog to jump out of the function.HotKeySet("{F9}", "_Cheese") HotKeySet("{F8}", "_stop") Global $Exitfunc = False Func _Cheese() For $a = 1 to 10 Send('a') Sleep(1000) ; just put this line anywhere in the Code & if you hit F8 & when program reaches this point, it will exit the function If $Exitfunc = True then Return Next EndFunc Func _Stop() $Exitfunc = True EndFunc ; Infinite loop to keep program running While 1 Sleep(100) WEnd My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now