RoSh Posted June 10, 2007 Share Posted June 10, 2007 Hi guys:Im totally new to programming at all, but I sure got the idea. So it would be very nice if s.o. could help me with the following:I want the script to wait until a specific window appears (Window Info);CODE>>>> Window <<<<Title: Please Register!Class: RBWindowPosition: 313, 307Size: 398, 128Style: 0x94C00000ExStyle: 0x00000101>>>> Control <<<<Class: ButtonInstance: 1ID: Text: OKPosition: 478, 397Size: 69, 23ControlClick Coords: 50, 14Style: 0x50000001ExStyle: 0x00000000>>>> Mouse <<<<Position: 528, 411Cursor ID: 0Color: 0xC7D5E7>>>> StatusBar <<<<>>>> Visible Text <<<<OK>>>> Hidden Text <<<<As soon as this window appears the OK button should be pressed (no delay necessary), either thru Mouse or Enter button.After OK is pressed the window will disappear but pop up again within a few secs till 2 mins.I've already skim read thru the help and forums but haven't yet found what I wanted.If you were so kind as to write this specific script I'd be very pleased.Thank you very muchRoSh Link to comment Share on other sites More sharing options...
RoSh Posted June 10, 2007 Author Share Posted June 10, 2007 is anything wrong with my description orhave I not found the right posts? thanks RoSh Link to comment Share on other sites More sharing options...
poisonkiller Posted June 10, 2007 Share Posted June 10, 2007 (edited) Try this: While 1 WinWait("Please Register!") If WinExists("Please Register!") Then WinActivate("Please Register!") Send("{ENTER}") EndIf WEnd Edited June 10, 2007 by poisonkiller Link to comment Share on other sites More sharing options...
RoSh Posted June 10, 2007 Author Share Posted June 10, 2007 Try this: While 1 WinWait("Please Register!") If WinExists("Please Register!") Then WinActivate("Please Register!") Send("{ENTER}") WEndthank you very much Ill try this. One question: will the script stay active and repeat automatically? RoSh Link to comment Share on other sites More sharing options...
RoSh Posted June 10, 2007 Author Share Posted June 10, 2007 Try this: While 1 WinWait("Please Register!") If WinExists("Please Register!") Then WinActivate("Please Register!") Send("{ENTER}") WEndsorry when I try to run this it says: Line 7 (File "C:\........\OK Script 1.au3): WEnd Error: "Wend statement with no matching "While" statement. Link to comment Share on other sites More sharing options...
herewasplato Posted June 10, 2007 Share Posted June 10, 2007 (edited) ...Error: "Wend statement with no matching "While" statement.Which is a secret code phrase meaning - missing EndIf:While 1 WinWait("Please Register!") If WinExists("Please Register!") Then WinActivate("Please Register!") Send("{ENTER}") EndIf WEnd Edited June 10, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
RoSh Posted June 10, 2007 Author Share Posted June 10, 2007 with CODEWinWait("Please Register!") If WinExists("Please Register!") Then WinActivate("Please Register!") Send("{ENTER}") repeat EndIf it gives me the error: Line 5 (File "c:\.....-.-) repeat ^ ERROR Error: Error parsing function call. ? Link to comment Share on other sites More sharing options...
poisonkiller Posted June 10, 2007 Share Posted June 10, 2007 (edited) Oh, sry, I had a mistake in my script. It's fixed now. And yes, this script will repeat automatically, look at While...WEnd in AutoIt v3 help file. EDIT: There is no "repeat" function, that's why your script gives you an error. While...WEnd takes care of repeating your code. Edited June 10, 2007 by poisonkiller Link to comment Share on other sites More sharing options...
herewasplato Posted June 10, 2007 Share Posted June 10, 2007 (edited) Who said to use "repeat"? Another way to code it would be:While 1 WinWait("Please Register!") WinActivate("Please Register!") WinWaitActive("Please Register!") Send("{ENTER}") WEnd Edited June 10, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
RoSh Posted June 10, 2007 Author Share Posted June 10, 2007 withCODEWinWait("Please Register!")If WinExists("Please Register!") ThenWinActivate("Please Register!")Send("{ENTER}")repeatEndIfit gives me the error:Line 5 (File "c:\.....-.-)repeat^ ERRORError: Error parsing function call.?Ok this was just what I tried meanwhileIT WORKS!thank you so very much herewasplato!!I think I'll keep using this scripts, they seem to be very useful for anything and Im interested in such fiddly stuff.Have a nice eveningRoSh Link to comment Share on other sites More sharing options...
herewasplato Posted June 10, 2007 Share Posted June 10, 2007 Take note of the WinWaitActive that I edited into my last code post... [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
RoSh Posted June 10, 2007 Author Share Posted June 10, 2007 Take note of the WinWaitActive that I edited into my last code post...ok if I understand that right the script will wait until the window is really active right?It works without but thanks anyway.And if the window that was active before shall be displayed afterwards?CODEWhile 1 WinWait("Please Register!") If WinExists("Please Register!") Then WinActivate("Please Register!") Send("{ENTER}") and Send("{Alt+Tab}") ;<-----this is my first idea. How is it right? EndIfWEndHow would this really work?Thanks Link to comment Share on other sites More sharing options...
Mast3rpyr0 Posted June 10, 2007 Share Posted June 10, 2007 ok if I understand that right the script will wait until the window is really active right?It works without but thanks anyway.And if the window that was active before shall be displayed afterwards?CODEWhile 1 WinWait("Please Register!") If WinExists("Please Register!") Then WinActivate("Please Register!") Send("{ENTER}") and Send("{Alt+Tab}") ;<-----this is my first idea. How is it right? EndIfWEndHow would this really work?ThanksIfSend("{ENTER}") andSend("{Alt+Tab}") ;<-----this is my first idea. How is it right?is supposed to be like 1 line you need to put a _ after and soSend("{ENTER}") and_Send("{Alt+Tab}") ;<-----this is my first idea. How is it right? My UDF's : _INetUpdateCheck() My Programs : GameLauncher vAlpha, InfoCrypt, WindowDesigner, ScreenCap, DailyRemindersPick3GeneratorBackupUtility! Other : Bored? Click Here! Link to comment Share on other sites More sharing options...
herewasplato Posted June 10, 2007 Share Posted June 10, 2007 (edited) ok if I understand that right the script will wait until the window is really active right?...Well, it is not a question of it being "really active" it is a question of timing. The first code posted (once fixed) takes about 500 ms to execute before it gets to the send line of code. The second method that I posted takes 750 ms before that send happens. Both will work until you start attempting to speed up the code by using an Opt/WinWaitDelay line. In other words, the window needs to be ready to accept the ENTER that you send to it. WinWaitActive helps with that. In your first post, you said that you wanted it to be a fast script. By default, it will be relatively slow unless you use the Opt line....And if the window that was active before shall be displayed afterwards?...The "z order" of the windows is not changed. In your first post, you said that pressing ENTER would make the window of interest disappear. Once it has disappeared, then the window that was active before the pop up should be active after the pop up goes away.Send("{ENTER}") andSend("{Alt+Tab}") ;<-----this is my first idea. How is it right?"and" is in not valid syntax herethe alt tab is not needed Edited June 10, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
RoSh Posted June 10, 2007 Author Share Posted June 10, 2007 Well, it is not a question of it being "really active" it is a question of timing. The first code posted (once fixed) takes about 500 ms to execute before it gets to the send line of code. The second method that I posted takes 750 ms before that send happens. Both will work until you start attempting to speed up the code by using an Opt/WinWaitDelay line. In other words, the window needs to be ready to accept the ENTER that you send to it. WinWaitActive helps with that. In your first post, you said that you wanted it to be a fast script. By default, it will be relatively slow unless you use the Opt line.The "z order" of the windows is not changed. In your first post, you said that pressing ENTER would make the window of interest disappear. Once it has disappeared, then the window that was active before the pop up should be active after the pop up goes away.Send("{ENTER}") andSend("{Alt+Tab}") ;<-----this is my first idea. How is it right?"and" is in not valid syntax herethe alt tab is not neededOk thanksThat was what I said indeed, but when the Window appears, the program it comes from also maximizes and will stay there. This is why I want the script to "Alt+Tab".Thanks again and in advance!RoSh Link to comment Share on other sites More sharing options...
herewasplato Posted June 10, 2007 Share Posted June 10, 2007 (edited) There are several ways to send alt-tab, but the syntax for the action that you want is Send("!{TAB}") Edited June 10, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
RoSh Posted June 10, 2007 Author Share Posted June 10, 2007 There are several ways to send alt-tab, but the syntax for the action that you want is Send("!{TAB}")thanks! Have a nice evening RoSh 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