waylandprod Posted June 25, 2013 Share Posted June 25, 2013 (edited) *First Post! AAAND I accidentally hit enter when entering the title... one sec adding content... ----------------------- This script runs the program and automates an activation under our account. There isn't any way to automate this otherwise. The If-Then portion of my script isn't working: (The Reset activation option) expandcollapse popup#region ---Au3Recorder generated code Start (v3.3.7.0) --- #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc #endregion --- Internal functions Au3Recorder End --- Run('"C:\Program Files (x86)\Movie Magic\MM Scheduling\MM Scheduling.exe"') _WinWaitActivate(" Select an option below","") Send("{ALTDOWN}{F4}{ALTUP}") _WinWaitActivate("Activation Wizard","") Send("{TAB}{SPACE}") _WinWaitActivate("License Activation Wizard - Step 1","") Send("OMMITTED SERIAL NUMBER{TAB}{TAB}{SPACE}") If _WinWaitActivate("Reset Activation Options","") then Send("{SHIFTDOWN}{TAB}{TAB}{SHIFTUP}{SPACE}") Endif _WinWaitActivate("License Activation Wizard - Step 2","", 60) Send("{TAB}{TAB}{TAB}ftvsupport{SHIFTDOWN}2{SHIFTUP}chapman.edu{TAB}{TAB}{TAB}{TAB}{SPACE}") Sleep(600) Send("{TAB}{TAB}{SPACE}") Sleep(600) _WinWaitActivate("License Activation Wizard - Step 3","") Send("{SPACE}") _WinWaitActivate("License Details","") Send("{TAB}{TAB}{TAB}{SPACE}") _WinWaitActivate("Movie Magic Scheduling 5","") Send("{ALTDOWN}{F4}{ALTUP}") WinClose("Movie Magic Scheduling 5","") #endregion --- Au3Recorder generated code End --- When running the script, if the ("Reset Activation Options","") window isn't there (which sometimes it just doesn't come up with the account information), the script just stops at that portion and doesn't go any further. I'm still new to Autoit, but I think that string should be ok. This program is notoriously hard to automate since they didn't code shortcut keys into anything and I have to use the tabs to get what I want working. You can tell I used Auto-It for a majority of this. I'm still learning how these functions work and have read many threads and just haven't found the right answer. Hopefully it's not something super simple and someone flags me for not finding the right answer... Edited June 25, 2013 by waylandprod Link to comment Share on other sites More sharing options...
abberration Posted June 25, 2013 Share Posted June 25, 2013 (edited) Welcome to the AutoIt Forums! I think the function you are using is actually _WinWaitActive (not Activate). Anyways, I think for your If-Then statement, you should use something like: Sleep (2000) ; wait 2 seconds before looking for the window If WinExists Then blah blah blah EndIf Edited June 25, 2013 by abberration Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
waylandprod Posted June 26, 2013 Author Share Posted June 26, 2013 The _WinWaitActive just gives me an error if I swap it out. I tried: Sleep (60000) If WinExists("Reset Activation Options","") Then Send("{SHIFTDOWN}{TAB}{TAB}{SHIFTUP}{SPACE}") EndIf BUT, it just tries to user the Send functions on the next window that comes up... ("License Activation Wizard - Step 2","", 60) Link to comment Share on other sites More sharing options...
waylandprod Posted June 26, 2013 Author Share Posted June 26, 2013 So I restarted and tried again with: Run('"C:\Program Files (x86)\Movie Magic\MM Scheduling\MM Scheduling.exe"') _WinWaitActivate(" Select an option below","") Send("{ALTDOWN}{F4}{ALTUP}") _WinWaitActivate("Activation Wizard","") Send("{TAB}{SPACE}") _WinWaitActivate("License Activation Wizard - Step 1","") Send("SERIAL NUMBER{TAB}{TAB}{SPACE}") Sleep (55000) If WinExists("Reset Activation Options","") Then Send("{SHIFTDOWN}{TAB}{TAB}{SHIFTUP}{SPACE}") EndIf _WinWaitActivate("License Activation Wizard - Step 2","") Send("{TAB}{TAB}{TAB}ftvsupport{SHIFTDOWN}2{SHIFTUP}chapman.edu{TAB}{TAB}{TAB}{TAB}{SPACE}") Sleep(600) Send("{TAB}{TAB}{SPACE}") Sleep(600) _WinWaitActivate("License Activation Wizard - Step 3","") Send("{SPACE}") _WinWaitActivate("License Details","") Send("{TAB}{TAB}{TAB}{SPACE}") _WinWaitActivate("Movie Magic Scheduling 5","") Send("{ALTDOWN}{F4}{ALTUP}") WinClose("Movie Magic Scheduling 5","") And this seems to have worked now... Thanks for your help! Link to comment Share on other sites More sharing options...
waylandprod Posted June 26, 2013 Author Share Posted June 26, 2013 Well, a few more deployments of the package and it didn't work... If that window pops up, it doesn't know what to do now... Link to comment Share on other sites More sharing options...
jdelaney Posted June 26, 2013 Share Posted June 26, 2013 (edited) Look into controlclick, controlsettext...much more reliable then sends, which can be picked up by other windows/sent too fast for the application to get all the text...that's probably your issue. Also, if you run this while logged out, a window will never be active (not sure if this is your case, but still good to know): http://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F Edited June 26, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. 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