microbious Posted May 30, 2009 Posted May 30, 2009 I am trying to make an autoinstalled for Divx6 (recreate actually). So after i told script to press Enter when Window name is active the very same window name is whats coming next. This gives me a problem with WinWait command because its the same window but it has different options. Window info tool also tracks Class: but i dont know how to use that class and if its any good to replace Winwait with something else. Next page of the installer is asking me if i want to upgrade or install old version. This page contains TEXT radio buttons and back next cancel buttons so i wonder if i could tell autoit to make sure that text in this window "example text" exists and then do the action such as Send ("{keywhatever}") At this point i am stuck. Anyway autoit could search the window for text content and if found proceed to next ElseIf another command ? Thank you all for future response.
Exit Posted May 30, 2009 Posted May 30, 2009 Did you read the meaning of the second parameter of winwait? It is to match a text in the window. App: Au3toCmd UDF: _SingleScript()
herewasplato Posted May 30, 2009 Posted May 30, 2009 Use the tab named "Visible" within the AutoIt Window Info to get the text for your script.WinWait("Window name", "text from first window")Set options...Send or ControlSend or ControlClick on "Next" buttonWinWait("Window name", "text from second window")Set options... Send or ControlSend or ControlClick on "Next" button [size="1"][font="Arial"].[u].[/u][/font][/size]
microbious Posted May 30, 2009 Author Posted May 30, 2009 (edited) Did you read the meaning of the second parameter of winwait? It is to match a text in the window.Oh crap Thanks man i got it now.Hey how avout checking the ID's of any kind ?And i forgot how to jump over lines like CMD used to as GOTO command GOTO line numberThanks again for quick reply u guys ROCK Edited May 30, 2009 by lessstoopid
Exit Posted May 30, 2009 Posted May 30, 2009 Oh crap Thanks man i got it now.Hey how avout checking the ID's of any kind ?And i forgot how to jump over lines like CMD used to as GOTO command GOTO line numberThanks again for quick reply u guys ROCKFortunately there is no GOTO in AU3. Leave the spagetti code to other languages. App: Au3toCmd UDF: _SingleScript()
microbious Posted May 30, 2009 Author Posted May 30, 2009 LOL Still must be away to jump to code line somehow right ? I mean why number them if not for that ?
AdmiralAlkex Posted May 30, 2009 Posted May 30, 2009 LOLStill must be away to jump to code line somehow right ?I mean why number them if not for that ?There is no goto, you have to do it with functions, loops, or If...Then. Whatever fits the situation.The numbers is just something your texteditor shows. Compiled scripts doesn't even have any sense of "lines" (if you ever compiled a bad script you would see it error out at line "-1"). .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
microbious Posted May 30, 2009 Author Posted May 30, 2009 Understand 100% I am having problems with IF then elseif where i need to jump out from and skip few lines. So there is no way to go to line numbers other then making up if's and functions ? Thanks
AdmiralAlkex Posted May 30, 2009 Posted May 30, 2009 (edited) Understand 100% I am having problems with IF then elseif where i need to jump out from and skip few lines. So there is no way to go to line numbers other then making up if's and functions ? ThanksDidn't you read my previous post? There is no GOTO and/or "line numbers". Now stop asking about it and use your imagination to solve it otherwise. How hard can it be to use a IF-statement? Local $X = 1 If $X = 2 Then ConsoleWrite(2 & @CRLF) ElseIf $X = 1 Then ConsoleWrite(1 & @CRLF) EndIf If that doesn't explain it, then please post a reproducer so we can see what problem you have and then maybe someone can help you. And for the future please create your threads with titles that actually has something to do with the subject. Edited May 30, 2009 by AdmiralAlkex .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
microbious Posted May 31, 2009 Author Posted May 31, 2009 (edited) I did reed your post and i do use IF already. #Region;Update finder $updatecheck = WinWaitActive ("","A newer version of DivX is available from DivX.com") If $updatecheck = 1 Then MsgBox (0,"","Update requested by setup" & @CRLF & "Proceeding to next step", "2") Send ("{DOWN}") Send ("{ENTER}") ElseIf $updatecheck = 0 Then MsgBox (0, "", "No update window." & @CRLF & "Proceeding to next step", "2") Send("{ESCAPE}") Send("{Y}") exit EndIf exit #EndRegion;Update found/notfound exit The rest doest matter. What matters is that if winwaitactive confirms that text is there then i want it to go to another part of the script, not just next line what ever it is in this example. I understand that at this point IF this is there then statement (what is statement anyway). Can a statement be something that will tell script to (don't yell at me please i am very sensitive) somewhere in the code other then what ever comes next ? Thanks again. Oh yeah, Use of IF's elseif's in help file examples show use of only one statement (statement or command ? Anyway) so i am not even sure that after "Then" The send commands will be executed at all . Edited May 31, 2009 by lessstoopid
Moderators SmOke_N Posted May 31, 2009 Moderators Posted May 31, 2009 I did reed your post and i do use IF already. #Region;Update finder $updatecheck = WinWaitActive ("","A newer version of DivX is available from DivX.com") If $updatecheck = 1 Then MsgBox (0,"","Update requested by setup" & @CRLF & "Proceeding to next step", "2") Send ("{DOWN}") Send ("{ENTER}") ElseIf $updatecheck = 0 Then MsgBox (0, "", "No update window." & @CRLF & "Proceeding to next step", "2") EndIf #EndRegion;Update found/notfound The rest doest matter. What matters is that if winwaitactive confirms that text is there then i want it to go to another part of the script, not just next line what ever it is in this example. I understand that at this point IF this is there then statement (what is statement anyway). Can a statement be something that will tell script to (don't yell at me please i am very sensitive) somewhere in the code other then what ever comes next ? Thanks again. Oh yeah, Use of IF's elseif's in help file examples show use of only one statement (statement or command ? Anyway) so i am not even sure that after "Then" The send commands will be executed at all .1. Your condition statement doesn't make sense. You tell the program to wait indefinitely until a window with x-text appears, but then you check conditions after that ? 2. I'm kind of baffled that you've been given the answer already, yet you persist to continue on wanting something you're just not going to get the way you want it (say that 10 times fast!! lol). Bottom line, if you want to jump to another part of the script, then put that part into a function. #Region;Update finder Global $i_new_version_win = WinWaitActive ("","A newer version of DivX is available from DivX.com", 10); Time out for 10 seconds to make it realistic If $i_new_version_win Then _GoTo(0); Pretend it's a different line Else _GoTo(1) EndIf #EndRegion;Update found/notfound Func _GoTo($i_num) Switch $i_num Case 0 ; Do something for zero as if it were the line you were jumping to MsgBox (0,"","Update requested by setup" & @CRLF & "Proceeding to next step", 2); 4th param isn't a string btw Send ("{DOWN}{ENTER}") Case 1 ; Do something for 1 as if it were the line you were jumping to MsgBox (0, "", "No update window." & @CRLF & "Proceeding to next step", 2) Case Else; add more or don't EndSwitch ; Return something even if you want to EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
microbious Posted May 31, 2009 Author Posted May 31, 2009 (edited) Ok function make sense with given example Thanks. And no, i tell the script to check if X-text is there then execute 1 command. otherwise execute another command.. Trying to make Divx 6 auto installer with commands like Send ("{KEYS}") Problem is that when network is online, installer will ask user if he wants to download update or not. If network offline, it will not ask for anything. This makes diference in installation progress so different Send ("{KEYS}") had to be used according to the result that comes out from "If" used in the example. I noticed you used "Global" I dont know how to use that yet, hopefully removing it will not effect the script badly. Ill try your example thanks. Edited May 31, 2009 by lessstoopid
microbious Posted June 1, 2009 Author Posted June 1, 2009 Just ran into another problem. Here is a full code that i have. I ran into a problem where if Google is not promoted to install (it wont if u did say NO first time and now reinstalling it again) then it gets stuck at Newsletter detection part. I had an update detect part but i removed it so it went to selecting components part expandcollapse popup#Region;Check filename If FileExists ("DivXInstaller.exe") Then Else MsgBox (0, "File check", "DivXInstaller.exe does not exit :(" & @CRLF & "Setup will now exit") Exit EndIf #EndRegion;End filecheck #Region;Start installation Run ("DivXInstaller.exe") WinWaitActive ("Language selection","Select your language preference") Send ("{ENTER}") #EndRegion;Language sellected #Region;Installer window agreement WinWaitActive ("DivX for Windows Setup", "Welcome to the DivX for Windows installer") Send ("{ENTER}");next Send ("{TAB}");switch to accept check box Send ("{SPACE}");check box Send ("{ENTER}");next #EndRegion;Agreed #Region;Update finder ;If WinWaitActive ("DivX for Windows Setup", "A newer version of DivX") Then ; MsgBox (0, "", "") ; Send ("{DOWN}") ; Send ("{ENTER}") ;Else ; MsgBox (0, "", "") ;EndIf #EndRegion;Update found/notfound #Region;Select installed components WinWaitActive ("DivX for Windows Setup", "Choose which features") Send ("{DOWN}") Send ("{DOWN}") Send ("{DOWN}") Send ("{DOWN}");All the way down to the bottom Send ("{SPACE}");uncheck Divx Web player Send ("{UP}") Send ("{UP}");up Send ("{SPACE}");uncheck Divx Player Send ("{UP}");up Send ("{SPACE}");uncheck converter Send ("{UP}");up Send ("{SPACE}");uncheck All codec related Send ("{RIGHT}");expand submenu Send ("{DOWN}");down Send ("{SPACE}");check codec Send ("{DOWN}");down Send ("{SPACE}");check MPEG playback Send ("{DOWN}");down Send ("{SPACE}");check xv12 pass Send ("{DOWN}");down Send ("{SPACE}");check Media playback Send ("{ENTER}");Enter to go next step Send ("{ENTER}");Use default destination #EndRegion;Components selected and installation started #Region;Google detector $google = WinWaitActive ("DivX for Windows Setup", "Google") If $google = 1 Then Send ("{TAB}") Send ("{SPACE}") Send ("{ENTER}") ElseIf $google = 0 Then MsgBox (0, "", "passed") EndIf #EndRegion;Google skiped #Region;Newsletter $Newsletter = WinWaitActive ("DivX for Windows Setup", "DivX newsletter") If $Newsletter = 1 Then Send ("{ESCAPE}");close installer before it pops up web page Send ("{Y}");yes to close ElseIf $Newsletter = 0 Then MsgBox (0, "", "Error. Will now exit the installer", 2) Exit EndIf #EndRegion;Newsletter end Exit Any ideas what i do wrong ? It makes perfect sense to me and looks like it has to work but it doesnt Thanks
microbious Posted June 2, 2009 Author Posted June 2, 2009 OH lol i needed to use WinActive instead of WinWaitActive.
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