Jump to content
Sign in to follow this  
shaunexe

Assistance with ControlClick script

Recommended Posts

shaunexe

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

Share this post


Link to post
Share on other sites
GajjarTejas

Script is paused due to WinwaitActive just check title it may be wrong or else.

Share this post


Link to post
Share on other sites
shaunexe

Title came from using Au3Info. I have removed the WinWaitActive but now only launches the package.

Share this post


Link to post
Share on other sites
Scriptonize

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 by Scriptonize

If you learn from It, it's not a mistake

Share this post


Link to post
Share on other sites
shaunexe

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.

Share this post


Link to post
Share on other sites
JLogan3o13

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')

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Scriptonize

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 by Scriptonize

If you learn from It, it's not a mistake

Share this post


Link to post
Share on other sites
Scriptonize

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

Share this post


Link to post
Share on other sites
shaunexe

Apologies, no idea what I had done first time but it is working now thanks. Thanks for the help guys.

Share this post


Link to post
Share on other sites
Scriptonize

You are welcome. ;-)


If you learn from It, it's not a mistake

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×