sathish Posted December 20, 2011 Share Posted December 20, 2011 (edited) Hello Guys I am new to autoit I need a help, my problem is mentioned below While 1 If WinActive("MathType Warning") Then ControlClick("MathType Warning", "OK", "[iD:2]") EndIf WEnd The code is pasted above Description: The window named MathType Warning will occur unknown number of times while opening a another window, so that i need to send {ENTER} unknown number of times, so how can i do it, the thing is when that window is not there, i have to close the loop and proceed further, simply to say (until MathType Warning disappears) Edited December 20, 2011 by sathish Link to comment Share on other sites More sharing options...
sathish Posted December 20, 2011 Author Share Posted December 20, 2011 Any body, please help in solving this Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 20, 2011 Moderators Share Posted December 20, 2011 sathish,Welcome to the AutoIt forum. Please do not bump your own posts within 24 hours. Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually - like this. As you have no idea how many times this window will appear, take a look at Adlib in the Help file. It allows you to call a function at regular intervals - you could check every few seconds whether your warning dialog was present and clear it if found. Once you are sure that there will be no more, you can cancel the Adlib function. See what you can come up with - you know where we are if you run into difficulties. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
sathish Posted December 20, 2011 Author Share Posted December 20, 2011 Thanks for your kind reply Melba Sorry I am new to this forum The thing is i want to know about GOTO loop in autoit, basically i am from perl Below is my perl code, But the thing is i want it in Autoit while(1) { my $windows = FindWindowLike(undef, "MathType Warning"); if($windows == 1) { print F3 "$img: Font Missing in MathType, please checkn"; PushButton("OK"); $windows++; } else { goto MAIN; } } MAIN: I think the ExitLoop will work in autoit, but i cant able to understand the concept of Exitloop Please help Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 20, 2011 Moderators Share Posted December 20, 2011 sathish, The thing is i want to know about GOTO loop in autoitThere is no GOTO instruction on AutoIt - it has been declared a "BAD THING" by the Devs. I do not use perl, but if I understand the logic flow correctly, something like this should work for you: $iDelay = 25 ; Number of seconds to wait before continuing $iBegin = TimerInit() ; We now enter this loop for $iDelay seconds While TimerDiff($iBegin) < $iDelay * 1000 ; Check for an error window If WinExists("MathType Warning") Then ; Click it ControlClick("MathType Warning", "", "[TEXT:OK]" EndIf Sleep(10) ; Idle the CPU to stop it overloading WEnd ; After $iDelay seconds you end up here If there is a maximum number of times the dialog can appear, you could add count and use ExitLoop when you have reached that value. You might want to check the dialog with the Window Info tool to confirm the ID parameters I used - you will find it at "C:\Program Files\AutoIt3\Au3Info.exe" if you did a standard install. Try to develop that and see how you get on. You know where we are if you run into difficulties. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
sathish Posted December 20, 2011 Author Share Posted December 20, 2011 (edited) Thanks for your reply Melbayour Codewhile---{ ; Check for an error window If WinExists("MathType Warning") Then ; Click it ControlClick("MathType Warning", "", "[TEXT:OK]" EndIf ; till this everything is ok, here i want to exit the while loop, thats what i am asking for ; (Else exitloop), when window not available like this i need Sleep(10) ; Idle the CPU to stop it overloading WEndIf you see my perl code, you can undertstandThe script you have given me is working perfectly, but the script should close until all window (MathType Warning) and when the next window (MathType Text) appears Edited December 20, 2011 by sathish Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 20, 2011 Moderators Share Posted December 20, 2011 sathish, If you see my perl code, you can undertstandNo I cannot - I told you I do not use perl. But now you have explained further I think this should work: ; Enter an infinite loop While 1 ; Check for an error window If WinExists("MathType Warning") Then ; Click it ControlClick("MathType Warning", "", "[TEXT:OK]" EndIf ; Check if the required window appears If WinExists("MathType Text") Then ; And exit the loop if it does ExitLoop EndIf Sleep(10) ; Idle the CPU to stop it overloading WEnd ; You end up here when the "MathType Text" window appears I hope it works for you. Top Tip: Give as much information as you can at the beginning - then we can give you what you want. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
sathish Posted December 21, 2011 Author Share Posted December 21, 2011 Thanks Melba Still have some problems I will explain my perl code line by line, then you can understand my problem while(1); This you know, { my $windows = FindWindowLike(undef, "MathType Warning");; Here Winexists is applied if($windows == 1); If winExists { PushButton("OK");;;Send ("OK") $windows++;; Here the window value is incremented } else; { goto MAIN;;; Exiting the while loop, when Window does not exist } } MAIN: Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 21, 2011 Share Posted December 21, 2011 I think the ExitLoop will work in autoit, but i cant able to understand the concept of Exitloop It exits the loop. There isn't more to understand. See helpfile for details. Or you could just loop as long as WinExist() is true. While WinExist() ControlSend() Wend .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface 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