shaunexe Posted July 23, 2012 Posted July 23, 2012 Hi I have created a package that opens a program called Cacheset, clicks a button within the box confirms this then closes the package down. The issue I have is that when I run it once it just opens the main window and the script becomes paused in the task window. If I then run the package again it works fine but again is paused in the task window. RunWait ( "C:\Cacheset.exe" ) WinActive ( "Cacheset - http://www.sysinternals.com" ) ControlClick ( "Cacheset - http://www.sysinternals.com", "", "[ID:5]" ) WinWaitActive ( "Cacheset" ) ControlClick ( "Cacheset", "", 2 ) WinWaitActive ( "Cacheset - http://www.sysinternals.com" ) ControlClick ( "Cacheset - http://www.sysinternals.com", "", 2 ) Thanks
GajjarTejas Posted July 23, 2012 Posted July 23, 2012 Script is paused due to WinwaitActive just check title it may be wrong or else.
shaunexe Posted July 23, 2012 Author Posted July 23, 2012 Title came from using Au3Info. I have removed the WinWaitActive but now only launches the package.
Scriptonize Posted July 23, 2012 Posted July 23, 2012 (edited) Try this: Run("C:\Cacheset.exe") While 1 Sleep(100) If WinExists ( "Cacheset ") Then ConsoleWrite("WinExists returns '1'." & @CR) WinActive ( "Cacheset " ) Beep(1500,5) Sleep(3000) ControlClick ( "Cacheset ", "", "[iD:2]" ) ExitLoop EndIf Wend Edited July 23, 2012 by Scriptonize If you learn from It, it's not a mistake
shaunexe Posted July 23, 2012 Author Posted July 23, 2012 That doesn't even launch the exe but looking through it this would not click the first button. ID 5 is the first button labeled "Clear" and then this launches a secound window for the confirmation ID 2 and then finally the program clicks the cancel button to close the package ID:2.
Moderators JLogan3o13 Posted July 23, 2012 Moderators Posted July 23, 2012 Have you attempted to just run the application using the command-line parameters, instead of launching the GUI? Something like: ShellExecute("cachset.exe", '1024 107344182') "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Scriptonize Posted July 23, 2012 Posted July 23, 2012 (edited) That doesn't even launch the exe but looking through it this would not click the first button. ID 5 is the first button labeled "Clear" and then this launches a secound window for the confirmation ID 2 and then finally the program clicks the cancel button to close the package ID:2.Strange, it runs smoothly on my pc.The reason why I've changed the button ID is because I didn't want to clear my cache, just exit the prog. For demonstrating purposes, it isn't such a big deal I guess. Edited July 23, 2012 by Scriptonize If you learn from It, it's not a mistake
Scriptonize Posted July 24, 2012 Posted July 24, 2012 I'v tested it again, just to be shure and I can only say that that code does work. Did you ever run it and if yes, what error occured?DemoCache.au3 If you learn from It, it's not a mistake
shaunexe Posted July 24, 2012 Author Posted July 24, 2012 Apologies, no idea what I had done first time but it is working now thanks. Thanks for the help guys.
Scriptonize Posted July 24, 2012 Posted July 24, 2012 You are welcome. ;-) If you learn from It, it's not a mistake
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