haridsv Posted August 8, 2007 Share Posted August 8, 2007 I apologize if I am making some silly mistake here, but I already spent a lot of time trying various alternatives and searching through forum but can't figure out why it is not working. I haven't touched autoit3 in a very long time and lost whatever touch I had.I am trying to create a script that has a very simple task. I am decrypting some DVDs using DVDDecrypter in batch mode using command line options, but for some DVDs, the program gives out a prompt that says something like "Possible RCE Protection Found!" and the default option is usually good enough so I have to sit there and keep keep clicking the OK button about 8 times or over a few minutes. Now all that I want the script to do is wait in a loop for the dialog box and click OK for me (like the "yes" command). I used the spy and it shows something like this:expandcollapse popupPress CTRL-ALT-F to pause the display. >>>>>>>>>>>> Window Title <<<<<<<<<<<<< DVD Decrypter ( classname=TfrmSelectDiscRegionalCode ) >>>>>>>>>>> Window Dimensions <<<<<<<<<<< left: 675 top: 617 width: 367 height: 290 >>>>>>>>>>> Mouse Position <<<<<<<<<<< On Desktop: x: 984 y: 883 In Window: x: 309 y: 266 >>>>>>>>>>> Pixel Color Under Mouse (RGB) <<<<<<<<<<< Hex: 0xF5F5F1 Dec: 16119281 (Obselete BGR Mode - Hex: 0xF1F5F5 Dec: 15857141) >>>>>>>>>>> Last Control Under Mouse <<<<<<<<<<< Class: TButton1 Text: OK >>>>>>>>>>> Status Bar Text <<<<<<<<<<< >>>>>>>>>>> Visible Window Text <<<<<<<<<<< Examples OK Region 8. Special International Venues 7. Reserved 6. China 5. Russia, East Europe, Africa 4. Australia, Spanish America 3. South East Asia 2. West Europe, Japan, South Africa 1. USA, Canada >>>>>>>>>>> Hidden Window Text <<<<<<<<<<<Now, I have tried WinWaitActive with several combinations of simple title string and with Advanced Window Descriptions (as per the link http://www.autoitscript.com/autoit3/docs/i...wsadvanced.htm) but none of them worked (the window is there even before the script is run but it remains paused for ever). Here are some that I tried:WinWaitActive("[CLASS:TfrmSelectDiscRegionalCode]") WinWaitActive("[CLASS:TfrmSelectDiscRegionalCode; INSTANCE:2]") WinWaitActive("DVD Decrypter", "") WinWaitActive("DVD Decrypter", "USA, Canada") WinWaitActive("[TITLE:DVD Decrypter]", "") WinWaitActive("[TITLE:DVD Decrypter]", "USA, Canada") WinWaitActive("[TITLE:DVD Decrypter; INSTANCE:2]", "USA, Canada")there are other combinations that I tried too. Though the below seems to workWinActivate("DVD Decrypter", "USA, Canada")the same arguments don't work for WinWaitActive(). Since the main window and dialog have the same title, I am trying the INSTANCE property with no help. Please help. Link to comment Share on other sites More sharing options...
enaiman Posted August 8, 2007 Share Posted August 8, 2007 (edited) Try: Opt("WinTitleMatchMode", 1);on top of your script WinWaitActive("Decrypter", "USA") sometime shortening the title/text to essentials makes it work. Edited August 8, 2007 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
haridsv Posted August 8, 2007 Author Share Posted August 8, 2007 Try: Opt("WinTitleMatchMode", 1);on top of your script WinWaitActive("Decrypter", "USA") sometime shortening the title/text to essentials makes it work.Just tried the above exactly(with nothing else in the script), didn't work. The script is just sitting there. I thought the classname should identify the window with no confusions, I am using wrong text as CLASS property? Link to comment Share on other sites More sharing options...
enaiman Posted August 8, 2007 Share Posted August 8, 2007 (edited) To see where your script is hanging add the following line at the begining of your script: Opt("TrayIconDebug", 1) this way you will be able to see what line of the script is executing just placing your mouse cursor over the tray icon. It may be a good idea to post your code here also. Yes - the class name identifies the windoe but unfortunately I can't help too much on this. However if you have a title identified for that window it should be enough. Edited August 8, 2007 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
ssubirias3 Posted August 8, 2007 Share Posted August 8, 2007 Opt("WinTitleMatchMode", 1);on top of your script WinWaitActive("Decrypter", "USA")oÝ÷ Ú«¨µéÚ If it doesn't work then tell us what did or didnt happen and if NOTHING happened, read the console for errors. Good luck and enjoy! Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 8, 2007 Share Posted August 8, 2007 If it doesn't work then tell us what did or didnt happen and if NOTHING happened, read the console for errors. Good luck and enjoy! Also, the previous code with the CLASS should have worked, but requires WinTitleMatchMode 4: Opt("WinTitleMatchMode", 4) If WinWait("[CLASS:TfrmSelectDiscRegionalCode]") Then ConsoleWrite("Debug: Found Window class TfrmSelectDiscRegionalCode" & @LF) WinActivate("[CLASS:TfrmSelectDiscRegionalCode]") WinWaitActive("[CLASS:TfrmSelectDiscRegionalCode]") ConsoleWrite("Debug: Window is now active." & @LF) EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
haridsv Posted August 8, 2007 Author Share Posted August 8, 2007 Also, the previous code with the CLASS should have worked, but requires WinTitleMatchMode 4: Opt("WinTitleMatchMode", 4) If WinWait("[CLASS:TfrmSelectDiscRegionalCode]") Then ConsoleWrite("Debug: Found Window class TfrmSelectDiscRegionalCode" & @LF) WinActivate("[CLASS:TfrmSelectDiscRegionalCode]") WinWaitActive("[CLASS:TfrmSelectDiscRegionalCode]") ConsoleWrite("Debug: Window is now active." & @LF) EndIf This didn't at first work, and I did try setting the same Opt() to the same value, as I found it while searching for dvddecrypter in the forum and saw a script posted by someone to automate some ripping process (but that script has the property name as "classname" and a different format too something like "classname=TfrmSelectDiscRegionalCode" without brackets). However, it just struck me that the version I have is a little outdated and might have some bugs so I downloaded the latest version and it worked right out. Now, all that I need to do is to add the click and put a loop around. Thanks a lot. Link to comment Share on other sites More sharing options...
ssubirias3 Posted August 8, 2007 Share Posted August 8, 2007 ... struck me that the version I have is a little outdated and might have some bugs so I downloaded the latest version and it worked right out. Now, all that I need to do is to add the click and put a loop around. Thanks a lot.Downloaded the latest version of what; AutoIt or dvddecrypter? No response necessary, glad you got it working!To add a loop and click to the script. The logic, not code, would be something like:if error window title exists then set erro to 1error = 1send click or command to buttonerror <> 1quit loopnext I think you'll be able to use the help file and search on some of those ideas and put together your loop. Oh, you wanted us to do this for you? But I thought you wanted to learn this stuff?? Now I'm really confused. Put together some code and if it doesn't work tell us why you think it doesn't work. Link to comment Share on other sites More sharing options...
haridsv Posted August 8, 2007 Author Share Posted August 8, 2007 Downloaded the latest version of what; AutoIt or dvddecrypter? No response necessary, glad you got it working! To add a loop and click to the script. The logic, not code, would be something like: if error window title exists then set erro to 1 error = 1 send click or command to button error <> 1 quit loop next I think you'll be able to use the help file and search on some of those ideas and put together your loop. Oh, you wanted us to do this for you? But I thought you wanted to learn this stuff?? Now I'm really confused. Put together some code and if it doesn't work tell us why you think it doesn't work. I was talking about a newer version of autoit3 and no I was not asking for help on creating the loop. I got the following already working perfectly fine for my needs: While 1 . . ControlClick("[CLASS:TfrmSelectDiscRegionalCode]", "", "TButton1") WEnd Of course, a simple Send("{Enter}") also works. 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