Jump to content
Sign in to follow this  
shaunexe

Assistance with ControlClick script

Recommended Posts

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

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

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

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!

Share this post


Link to post
Share on other sites

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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...