Sign in to follow this  
Followers 0
lokalhero

Problems With Controlclick/Send

12 posts in this topic

Hey all. First post etc. but I trawled the forums yesterday for a fix, couldn't find anything to help, so here I am. >_<

I'm trying to create a small script to automate the installation of various software that we put on our new rigs. Stuff typically like Adobe Reader and Open Office etc.

Problem is, I'm getting stuck at the first hurdle. For some reason, no matter which command I use, when the security warning pops up, I cannot get the script to reliably click the "Run" button. I've had it work only twice out of about 50 times, regardless of whether or not I change the code!

The syntax looks correct to me, so I can only be overlooking something.

<code>

; Install Adobe Reader 9

ShellExecute ("ar9.exe", "", "apps", "open")

WinWaitActive("Open File - Security Warning")

send ("!r")

;Controlclick ("Open File - Security Warning", "&Run", "[CLASS:Button; INSTANCE:1]")

</code>

As you can see, I'm trying it with the send alt-r command, which still doesn't work.

Can anyone help?

Cheers in advance!

Share this post


Link to post
Share on other sites



Could it be you need to pause a little before Clicking or Sending "!r" ?

Try inserting a sleep(500) to see if that helps any.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Yeah, tried all that already. Makes no difference. >_

Share this post


Link to post
Share on other sites

Any other ideas? >_

Share this post


Link to post
Share on other sites

Running this on XP.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Running this on XP.

[s]WinWait("Open File - Security Warning")
WinActivate("Open File - Security Warning")
WinWaitActive("Open File - Security Warning")
;~ Sleep(1000)
ControlSend ("Open File - Security Warning", "", "" , "!r")[/s]

if it dont work try sleep some time before ControlSend as Jos sugested, basicly this with no sleep is working for me

Edited:

ShellExecute

Remarks

After running the requested program the script continues.

so script is paused and cant send anything until program is running

try Run ( "name.exe" , @ScriptDir ) instead ShellExecute in this case

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Is there a hotkey you could use instead? Like enter or ctrl + r?


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

Thanks for the input. One more question...

I'm gonna try the Run command now, but obviously I want to point it to the "apps" folder within the script folder, what's the path syntax I should use?

I know @scriptdir would point to the script folder, but how would I get it to look within the apps folder?

cheers again :D

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Thanks for that. Still doesn't run the "ar9.exe" file within the "apps" folder though, even with the extra line of code.

And no, I ain't Scottish, although my stepdad is from Glasgow and my GF is from Fife. :D

I still have issues with the script. Here's how it looks now...

$AppsFolder = @ScriptDir & "\apps\"

$answer = MsgBox(4, "Timmy's Build Software Script", "This script will install the usual PZC software for new builds." & @CRLF & "Press Yes to continue, otherwise press No to quit.")

If $answer = 7 Then

MsgBox(0, "Timmy's Build Software Script", "Installation Cancelled.")

Exit

EndIf

; Install Adobe Reader 9

run ("ar9.exe", $AppsFolder)

WinWaitActive("Open File - Security Warning")

send ("!r")

sleep (20000)

;Winwait ("Adobe Reader 9 - Setup", "Destination Folder")

;Winactivate ("Adobe Reader 9 - Setup", "Destination Folder")

WinWaitActive ("Adobe Reader 9 - Setup", "Change &Destination Folder..." & "&Next >" & "Destination Folder")

sleep (3000)

send ("!n")

The first part of the script now works perfectly if the "ar9.exe" file is located in the script folder still, but not if it's in the "apps" folder. Also, the trouble is now, when it gets to the next main installation screen, It pauses again, just like before. Should I be adding a WinWaitClose command or something?

As you can see, I'm experimenting with the various commands to get it to proceed, but again, nothing seems to work!!!

I know I'm coming across noobish, but even though I have a little experience with AutoIT, for some reason I just can't figure this out.

Edited by lokalhero

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Sry for late post, you can try it like this

Example :

run ("apps\klmcodec500.exe")

With run on .exe on XP i dont get any ("Open File - Security Warning") windows, that only happend to me with Shell* commands. so you probably have to delite some of this lines

WinWaitActive("Open File - Security Warning")

send ("!r")

sleep (20000)

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

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  
Followers 0