egymma Posted June 18, 2007 Share Posted June 18, 2007 for an example expandcollapse popupGlobal $Paused HotKeySet("{F7}", "TogglePause") HotKeySet("{F8}", "Terminate") #include <GuiConstants.au3> Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_CLOSE, 'CLOSEButton') ############################################################################################### while 1 ## one() ## two() ## WEnd ## Func one() ## Sleep(30000) I want this to stop only function one while func two still running ## Send("{F1}") ## Sleep(200) ## Send("x") ## EndFunc ## ## Func two() ## MouseClick(XXXX)<--- example ## Sleep(10000) ## MouseClick(XXXX)<--- example ## EndFunc ## ############################################################################################### Func CLOSEButton() ProcessClose("reform.exe") exit EndFunc Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',405,697) WEnd ToolTip("") EndFunc Func Terminate() ProcessClose("reform.exe") Exit 0 EndFunc if it made right ,, function two will loop 3 times before function one to work then sleep again for 30 sec while function two running i hope its clear ty in advance [center][/center]My Projects:-[list][*]Window Ender[*]Encryptor-Decryptor[/list] Link to comment Share on other sites More sharing options...
poisonkiller Posted June 18, 2007 Share Posted June 18, 2007 (edited) Can't you just do it like this? expandcollapse popupGlobal $Paused HotKeySet("{F7}", "TogglePause") HotKeySet("{F8}", "Terminate") #include <GuiConstants.au3> Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_CLOSE, 'CLOSEButton') while 1 two() one() WEnd Func one() Send("{F1}") Sleep(200) Send("x") EndFunc Func two() For $i = 1 to 3 MouseClick(XXXX)<--- example Sleep(10000) MouseClick(XXXX)<--- example Next EndFunc Func CLOSEButton() ProcessClose("reform.exe") exit EndFunc Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',405,697) WEnd ToolTip("") EndFunc Func Terminate() ProcessClose("reform.exe") Exit 0 EndFunc Edited June 18, 2007 by poisonkiller Link to comment Share on other sites More sharing options...
egymma Posted June 18, 2007 Author Share Posted June 18, 2007 thank you for your reply i think that makes func two run 3 times befor func 1 but those numbers was for example and i'll make that time comes from GUICtrlCreateInput like this GuiCreate("Auto Party Script", 190,275) GUISetOnEvent($GUI_EVENT_CLOSE, 'CLOSEButton') $mma1=GUICtrlCreateInput($time1,3, 200, 185, 20,$ES_CENTER) $mma2=GUICtrlCreateInput($time2,3, 250, 185, 20,$ES_CENTER) GUICtrlSetOnEvent($Start, "StartButton") Func StartButton() $time1 = GUICtrlRead($mma1) $time2 = GUICtrlRead($mma2) GUICtrlSetData($Start,"Stop") GUICtrlSetData($Start,"Start") EndFunc ############################################################################################### while 1 ## one() ## two() ## WEnd ## Func one() ## Sleep($time1) I want this to stop only function one while func two still running ## Send("{F1}") ## Sleep(200) ## Send("x") ## EndFunc ## ## Func two() ## MouseClick(XXXX)<--- example ## Sleep($time2) ## MouseClick(XXXX)<--- example ## EndFunc ## ############################################################################################### how it is gonna be ?? [center][/center]My Projects:-[list][*]Window Ender[*]Encryptor-Decryptor[/list] Link to comment Share on other sites More sharing options...
egymma Posted June 22, 2007 Author Share Posted June 22, 2007 any ideas ?? [center][/center]My Projects:-[list][*]Window Ender[*]Encryptor-Decryptor[/list] Link to comment Share on other sites More sharing options...
MrCreatoR Posted June 22, 2007 Share Posted June 22, 2007 Hi, You can use AdlibEnable()... GuiCreate("Auto Party Script", 190,275) GUISetOnEvent($GUI_ESÐÓÔÑK ÌÎNÐÓÔÑP]ÛÌÎNÊBÌÍÛ[XLOQÕRPÝÜX]R[] ÌÍÝ[YLÃ2Â#ÂRÂ#Âb33c´U5ô4TåDU"¢b33c¶ÖÖ#ÔuT7G&Ä7&VFTçWBb33c·FÖS"Ì°ÈÔÀ°ÄàÔ°ÈÀ°ÀÌØíM} 9QH¤)U% ÑɱMÑ=¹Ù¹Ð ÀÌØíMÑÉаÅÕ½ÐíMÑÉÑutton") Func StartButton() $time1 = GUICtrlRead($mma1) �ÍÝ[YLHÕRPÝXY ÌÍÛ[XLBÕRPÝÙ]]J ÌÍÔÝ ][ÝÔÝÜ ]÷C²¤uT7G&Å6WDFFb33cµ7F'BÂgV÷Cµ7F'BgV÷C²¤VæDgVæ0 ¤FÆ$Væ&ÆRgVÐíÑݼÅÕ½Ðì°Ô¤()Ý¡¥±Ä(½¹ ¤)]¹(Õ¹½¹ ¤(M±À ÀÌØíime1) Send("{F1}") Sleep(200) Send(" ][ÝÊB[[Â[ÈÛÊ B[ÝÙPÛXÚÊ IËKKH^×ÆP¢6ÆVWb33c·FÖS"¢Ö÷W6T6Æ6²fÇC²ÒÒÒW×ÆP¢¹Õ¹( Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
VorDa Posted June 22, 2007 Share Posted June 22, 2007 Flash reply... You want func1 to run 1 time and func2 to stay in loop??? ; ----------------------------------------------------------------------->See this: Dim sw=1 ; <-THIS IS THE SWICH ... 1=ON; 0=OFF GuiCreate("Auto Party Script", 190,275) GUISetOnEvent($GUI_EVENT_CLOSE, 'CLOSEButton') $mma1=GUICtrlCreateInput($time1,3, 200, 185, 20,$ES_CENTER) $mma2=GUICtrlCreateInput($time2,3, 250, 185, 20,$ES_CENTER) GUICtrlSetOnEvent($Start, "StartButton") Func StartButton() $time1 = GUICtrlRead($mma1) $time2 = GUICtrlRead($mma2) GUICtrlSetData($Start,"Stop") GUICtrlSetData($Start,"Start") EndFunc while 1 one() two() WEnd Func one() IF sw=1 Then ; <- CHECK SWICH ... or IF sw Then ... ********************************** Sleep($time1) I want this to stop only function one while func two still running Send("{F1}") Sleep(200) Send("x") sw=0 ; <- SWISH FUNC OFF! ***************************************************** Endif ; ************************************************************************* EndFunc Func two() MouseClick(XXXX)<--- example Sleep($time2) MouseClick(XXXX)<--- example EndFunc ; ------------------------------------------------------------------------------------------end. Is this you want? There is other ways, but this is yours. Good luck! Link to comment Share on other sites More sharing options...
MisterBates Posted June 22, 2007 Share Posted June 22, 2007 if it made right ,, function two will loop 3 times before function one to work then sleep again for 30 sec while function two runningNot sure I completely understand what you want to do, but using sleep pasues your script (everythng except events). You may want to look at timerinit() and timerdiff() instead, so that your script continues to execute, but you only send keys/mouseclicks every 'x' milliseconds. The following script sends a SPACE key every second, and an F4 key every two seconds (the small sleep at the end is to prevent consuming too many CPU cycles): $iSpaceTimer = TimerInit $iF4Timer = $iSpaceTimer while 1 If TimerDiff($iSpaceTimer) >= 1000 WinActivate("Title of window I want to send keys to") send("{SPACE}") $iSpaceTimer = TimerInit EndIf If TimerDiff($iF4Timer) >= 2000 WinActivate("Title of window I want to send keys to") send("{F4}") $iF4Timer = TimerInit EndIf sleep(100) WEnd Any use? [u]MisterBates[/u]_____________________________________________________Suspend/Resume Windows ScreensaverWatchWindows - Window watcher/loggerUDF: Click systray menu/submenu itemsUDF: Outlook Express Folder/Message handling (+ example code)HowTo: Multiple icons in one compiled script Link to comment Share on other sites More sharing options...
egymma Posted June 23, 2007 Author Share Posted June 23, 2007 thank you guys for reply i really apreciate that all your codes might workbut i found another very easy idea to do what i want to do ,, here is my code to explaneexpandcollapse popupDim $PT GuiCreate("Auto Party Script", 190,275) GUISetOnEvent($GUI_EVENT_CLOSE, 'CLOSEButton') $mma1=GUICtrlCreateInput($time1,3, 200, 185, 20,$ES_CENTER) $mma2=GUICtrlCreateInput($time2,3, 250, 185, 20,$ES_CENTER) GUICtrlSetOnEvent($Start, "StartButton") Func StartButton() $time1 = GUICtrlRead($mma1) $time2 = GUICtrlRead($mma2) GUICtrlSetData($Start,"Stop") GUICtrlSetData($Start,"Start") EndFunc ############################################################################################### while 1 ## $PT= $PT+1 ## ToolTip($PT,865,70) ## one() ## two() ## WEnd ## Func one() ## If $PT >= $time1 Then ## $PT = 0 ## Send("{F1}") ## Sleep(200) ## Send("x") ## EndIf ## EndFunc ## ## Func two() ## MouseClick(XXXX)<--- example ## Sleep($time2) ## MouseClick(XXXX)<--- example ## EndFunc ## ############################################################################################### Func CLOSEButton() ProcessClose("reform.exe") exit EndFunc Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',405,697) WEnd ToolTip("") EndFunc Func Terminate() ProcessClose("reform.exe") Exit 0 EndFuncthank you againBest Regards, [center][/center]My Projects:-[list][*]Window Ender[*]Encryptor-Decryptor[/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