Natig Posted March 9, 2010 Posted March 9, 2010 Hi All, I'm using AutoIt script in order to press O.K on windows popup every 10-60 minutes, before pressing the O.K button the script runs a batch file that perform several tasks... The problem is that after about 3 hours the script stops pressing on the O.K button. If i'm closing the script and restart it, it works O.K for another 2-3 hours... I tried adding "watch-dog" to the script that restart the script every 30 minutes, in order to avoid this "freeze", but it doesn't work. I'll appriciate all the help i can get, Thanks in advance, Nati.
Tvern Posted March 9, 2010 Posted March 9, 2010 I think you need to supply more information. At least a code example.
water Posted March 9, 2010 Posted March 9, 2010 (edited) You can use the AutoIt3Wrapper directive #AutoIt3Wrapper_Run_Debug_Mode=Y so your script writes every executed statement to the console. Or you could use AutoItSetOption ( "TrayIconDebug" , 1 ) So the tray icon always shows the currently executed script line. But as stated before: Source code would help most. Edited March 9, 2010 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
Natig Posted March 9, 2010 Author Posted March 9, 2010 Sure... Here is the problematic code - While (True) ;wating for the window WinWait($String_For_Popup_Title) ; Setting Focus on the window if Not WinActive($String_For_Popup_Title) Then _ WinActivate($String_For_Popup_Title) WinWaitActive($String_For_Popup_Title) ;getting the window handle $CurrentWindowHandle = WinGetHandle($String_For_Popup_Title,"") ;reading data from window in order to choose the proper board settings $CurrentWindowData = ControlGetText($CurrentWindowHandle,"",$Static_Text_ControlID) ;parsing the data ; 5MHz or 10 MHz $Use5MHZ = False ;Default value if (StringInStr($CurrentWindowData,$String_For_5MHZ)>0) Then $Use5MHZ = True EndIf ; Mimo or No Mimo $UseMimo = False ;Default value ;if (StringInStr($CurrentWindowData,$String_For_MIMO) >0) Then ; $UseMimo = True ;EndIf ; Frequency $UseFreq = $FreqDefaultValue ; Default value If ($Use5MHZ) Then If (StringInStr($CurrentWindowData,$String_For_F8_Freq_5MHZ)>0) Then $UseFreq = $F8_5MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F7_Freq_5MHZ)>0) Then $UseFreq = $F7_5MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F6_Freq_5MHZ)>0) Then $UseFreq = $F6_5MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F5_Freq_5MHZ)>0) Then $UseFreq = $F5_5MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F4_Freq_5MHZ)>0) Then $UseFreq = $F4_5MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F3_Freq_5MHZ)>0) Then $UseFreq = $F3_5MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F2_Freq_5MHZ)>0) Then $UseFreq = $F2_5MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F1_Freq_5MHZ)>0) Then $UseFreq = $F1_5MHz_Enum Else If (StringInStr($CurrentWindowData,$String_For_F10_Freq_10MHZ)>0) Then $UseFreq = $F10_10MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F9_Freq_10MHZ)>0) Then $UseFreq = $F9_10MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F8_Freq_10MHZ)>0) Then $UseFreq = $F8_10MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F7_Freq_10MHZ)>0) Then $UseFreq = $F7_10MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F6_Freq_10MHZ)>0) Then $UseFreq = $F6_10MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F5_Freq_10MHZ)>0) Then $UseFreq = $F5_10MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F4_Freq_10MHZ)>0) Then $UseFreq = $F4_10MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F3_Freq_10MHZ)>0) Then $UseFreq = $F3_10MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F2_Freq_10MHz)>0) Then $UseFreq = $F2_10MHz_Enum If (StringInStr($CurrentWindowData,$String_For_F1_Freq_10MHZ)>0) Then $UseFreq = $F1_10MHz_Enum EndIf ;Releasing the Popup Window ControlClick($CurrentWindowHandle,"",$OK_Button_String) ;reseting the board and sending CLI commands ; Nati - There is no MIMO in the RRT If ($Use5MHZ) Then Switch($UseFreq) Case $F1_5MHz_Enum RunWait($Batch_5MHZ_F1) Case $F2_5MHz_Enum RunWait($Batch_5MHZ_F2) Case $F3_5MHz_Enum RunWait($Batch_5MHZ_F3) Case $F4_5MHz_Enum RunWait($Batch_5MHZ_F4) Case $F5_5MHz_Enum RunWait($Batch_5MHZ_F5) Case $F6_5MHz_Enum RunWait($Batch_5MHZ_F6) Case $F7_5MHz_Enum RunWait($Batch_5MHZ_F7) Case $F8_5MHz_Enum RunWait($Batch_5MHZ_F8) EndSwitch Else Switch($UseFreq) Case $F1_10MHz_Enum RunWait($Batch_10MHZ_F1) Case $F2_10MHz_Enum RunWait($Batch_10MHZ_F2) Case $F3_10MHz_Enum RunWait($Batch_10MHZ_F3) Case $F4_10MHz_Enum RunWait($Batch_10MHZ_F4) Case $F5_10MHz_Enum RunWait($Batch_10MHZ_F5) Case $F6_10MHz_Enum RunWait($Batch_10MHZ_F6) Case $F7_10MHz_Enum RunWait($Batch_10MHZ_F7) Case $F8_10MHz_Enum RunWait($Batch_10MHZ_F8) Case $F9_10MHz_Enum RunWait($Batch_10MHZ_F9) Case $F10_10MHz_Enum RunWait($Batch_10MHZ_F10) EndSwitch EndIfWEndMarked in red is the problematic sections,Do you think the problem is because i'm using WinWaitActive ?How can i improve this code?The ControlClick section should work on a locked workstation as well (using the popup title)?Thanks!!!!
MHz Posted March 9, 2010 Posted March 9, 2010 Do you think the problem is because i'm using WinWaitActive ? How can i improve this code? The ControlClick section should work on a locked workstation as well (using the popup title)? If you wish the script to function on a locked workstation then active window functions may fail as they cannot activate above the locked screen. Try removing the block of code below ; Setting Focus on the window If Not WinActive($String_For_Popup_Title) Then _ WinActivate($String_For_Popup_Title) WinWaitActive($String_For_Popup_Title) Control* functions should still operate OK on non active windows.
BrettF Posted March 9, 2010 Posted March 9, 2010 Please read the FAQ regarding running code on a locked workstation and the problems you may encounter. There is a sticky in this forum. 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!
Natig Posted March 9, 2010 Author Posted March 9, 2010 Please read the FAQ regarding running code on a locked workstation and the problems you may encounter.There is a sticky in this forum.Thanks!
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