mrtgtr Posted November 2, 2018 Posted November 2, 2018 I want to do something , after wait 2 min and again do same thing But I do do not want with sleep, it must be timer How I do this ?
Nine Posted November 2, 2018 Posted November 2, 2018 (edited) $ctl = _Timer_SetTimer($handle,2*60*1000,"DoItBabe") Edited November 2, 2018 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
mrtgtr Posted November 2, 2018 Author Posted November 2, 2018 1 hour ago, Nine said: $ctl = _Timer_SetTimer($handle,2*60*1000,"DoItBabe") how I use it in script send("{9 down}") sleep(1500) send("{9 up}")
Nine Posted November 2, 2018 Posted November 2, 2018 $handle = a window you own, could be your autoit script "DoitBabe" is a func you will create that do what you want after 2 min. Search for that UDF it is on autoit help file Make a script of your own, if it is not working post it and ill help “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
mrtgtr Posted November 2, 2018 Author Posted November 2, 2018 Func Wm() $ctl=_Timer_SetTimer($hGUI,2*2500,'Wm") error: syntax error (illegal character) error: _Timer_SetTimer() : undefined function. PixelSearch(590 , 742 , 1020 , 742, 0xAA3322) If @error Then Send("{9 down}") Sleep(1700) Send("{9 up}") EndIf EndFunc
mrtgtr Posted November 2, 2018 Author Posted November 2, 2018 1 hour ago, Nine said: $handle = a window you own, could be your autoit script "DoitBabe" is a func you will create that do what you want after 2 min. Search for that UDF it is on autoit help file Make a script of your own, if it is not working post it and ill help Func Wm() $ctl=_Timer_SetTimer($hGUI,2*2500,'Wm") error: syntax error (illegal character) error: _Timer_SetTimer() : undefined function. PixelSearch(590 , 742 , 1020 , 742, 0xAA3322) If @error Then Send("{9 down}") Sleep(1700) Send("{9 up}") EndIf EndFunc
Nine Posted November 2, 2018 Posted November 2, 2018 (edited) where is $hgui and you cannot call wm within wm. it must be outside wm and always have opt ("MustDeclareVars",1) at the beginning of your script, it will greatly help you debug Edited November 2, 2018 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
water Posted November 2, 2018 Posted November 2, 2018 (edited) Can you please give us some more detailed information about the program you try to automate? PixelSearch and Send depend on screen size and resolution, window position and might interfere with user actions. Most of the time there are more reliable ways to do what you want to do. Edited November 2, 2018 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
mrtgtr Posted November 2, 2018 Author Posted November 2, 2018 1 hour ago, water said: Can you please give us some more detailed information about the program you try to automate? PixelSearch and Send depend on screen size and resolution, window position and might interfere with user actions. Most of the time there are more reliable ways to do what you want to do. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=firefox.ico #AutoIt3Wrapper_Outfile=firefox.Exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <Misc.au3> Opt("TrayIconHide", 1) ; Create a GUI with various controls. $hGUI = GUICreate("Google - Mozilla Firefox", 500, 500) $Start = GUICtrlCreateButton("BAŞLA", 215, 420, 75, 50) GUICtrlCreateLabel("Durdurmak için + ya bas", 165, 30) $WMBOX = GUICtrlCreateCheckbox("WM", 75, 50, 100, 60) GUICtrlSetFont(-1, 16, 800, 0, "Comic Sans MS") $ZBOX = GUICtrlCreateCheckbox("Z", 75, 100, 100, 60) GUICtrlSetFont(-1, 16, 800, 0, "Comic Sans MS") GUICtrlSetTip(-1, "50") GUISetState(@SW_SHOW) Local $hDLL = DllOpen("user32.dll") Global $Timer1 = TimerInit() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Start runner() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func Runner() While 1 If _IsPressed("6B", $hDLL) Then Exit EndIf If GUICtrlRead($wmbox) = 1 Then WM() EndIf If GUICtrlRead($ZBOX) = 1 Then Z() EndIf WEnd EndFunc Func kapat() Exit EndFunc Func WM();when start, this is do it and do every 2 min (loop) PixelSearch(590 , 742 , 1020 , 742, 0xAA3322) If @error Then Send("{9 down}") Sleep(1700) Send("{9 up}") EndIf EndFunc Func Z() ;when start, this is do it and do every 1 min (loop) Send("{z down}") Sleep(100) Send("{z up}") EndFunc
water Posted November 2, 2018 Posted November 2, 2018 Thanks for the code. But it doesn't explain what you want to achieve with function WM. Example: You want to wait until a button gets active and then click on this button. Can you please elaborate? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Nine Posted November 2, 2018 Posted November 2, 2018 (edited) First insert at the begining of your script : Opt ("MustDeclareVars",1)Btw, 2* 2500 is not 2 minutes.... And Wm must have the following arguments : Func Wm ($hWnd, $iMsg, $iIDTimer, $iTime) Instead of Global $Timer1 = TimerInit () replace by : Local $ctl=_Timer_SetTimer($hGUI,2*2500,'Wm") if not $ctl then MsgBox (0,"test","timer error") Exit endif Edited November 2, 2018 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Danp2 Posted November 3, 2018 Posted November 3, 2018 This looks very suspicious. Why would you be creating an executable named Firefox.exe and the title of "Google - Mozilla Firefox"? user4157124 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
Nine Posted November 3, 2018 Posted November 3, 2018 4 minutes ago, Danp2 said: This looks very suspicious. Why would you be creating an executable named Firefox.exe and the title of "Google - Mozilla Firefox"? rofl “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
mrtgtr Posted November 3, 2018 Author Posted November 3, 2018 error: syntax error (illegal character) error: _Timer_SetTimer(): undefined function.
Nine Posted November 3, 2018 Posted November 3, 2018 40 minutes ago, mrtgtr said: error: syntax error (illegal character) error: _Timer_SetTimer(): undefined function. you must have at the beginning of the script : #include <Timers.au3> Please look in index of autoit help for _Timer_SetTimer, all the information is in there “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
mrtgtr Posted November 3, 2018 Author Posted November 3, 2018 1 hour ago, Nine said: you must have at the beginning of the script : #include <Timers.au3> Please look in index of autoit help for _Timer_SetTimer, all the information is in there I did #include <Timers.au3> now Local $ctl=_Timer_SetTimer($hGUI,2*2500,'Wm") error: syntax error (illegal character)
BrewManNH Posted November 3, 2018 Posted November 3, 2018 2 minutes ago, mrtgtr said: Local $ctl=_Timer_SetTimer($hGUI,2*2500,'Wm") You have a double quote at one end of the Wm, and a single at the other. Danp2 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
mrtgtr Posted November 3, 2018 Author Posted November 3, 2018 1 hour ago, BrewManNH said: You have a double quote at one end of the Wm, and a single at the other. thanx but now, need to hit 9 but do not do anything after 5 sec autoit gui is crashing
Nine Posted November 3, 2018 Posted November 3, 2018 Have you put the parameters to Func Wm ($hWnd, $iMsg, $iIDTimer, $iTime) If so, bring all your code in so we can see what's going on “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
mrtgtr Posted November 3, 2018 Author Posted November 3, 2018 2 hours ago, Nine said: Have you put the parameters to Func Wm ($hWnd, $iMsg, $iIDTimer, $iTime) If so, bring all your code in so we can see what's going on While I am searching timers I found this $Timer = TimerInit() Func SomeFunction $Delay = TimerDiff($Timer) $DelayTime = (120000) If $Delay > $DelayTime Then <your code goes here> $Timer = TimerInit() EndIf EndFunc this is good but it is waiting 2 min and doing it I want to do it and wait 2 min and again do it,( again, again, again, loop) but it is not be sleep it must be timer
Recommended Posts