lokalhero Posted August 27, 2009 Share Posted August 27, 2009 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! Link to comment Share on other sites More sharing options...
Developers Jos Posted August 27, 2009 Developers Share Posted August 27, 2009 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. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
lokalhero Posted August 27, 2009 Author Share Posted August 27, 2009 Yeah, tried all that already. Makes no difference. >_ Link to comment Share on other sites More sharing options...
lokalhero Posted August 27, 2009 Author Share Posted August 27, 2009 Any other ideas? >_ Link to comment Share on other sites More sharing options...
WolfWorld Posted August 27, 2009 Share Posted August 27, 2009 If it's not UAC then it will work. IF < it is UAC it will never work! Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
lokalhero Posted August 27, 2009 Author Share Posted August 27, 2009 Running this on XP. Link to comment Share on other sites More sharing options...
bogQ Posted August 27, 2009 Share Posted August 27, 2009 (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 August 27, 2009 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
corgano Posted August 27, 2009 Share Posted August 27, 2009 Is there a hotkey you could use instead? Like enter or ctrl + r? 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
lokalhero Posted August 28, 2009 Author Share Posted August 28, 2009 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 Link to comment Share on other sites More sharing options...
jvanegmond Posted August 28, 2009 Share Posted August 28, 2009 Use: $AppsFolder = @ScriptDir & "\apps\" Are you Scottish? github.com/jvanegmond Link to comment Share on other sites More sharing options...
lokalhero Posted August 28, 2009 Author Share Posted August 28, 2009 (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. 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.") ExitEndIf; Install Adobe Reader 9run ("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 August 28, 2009 by lokalhero Link to comment Share on other sites More sharing options...
bogQ Posted August 28, 2009 Share Posted August 28, 2009 (edited) Sry for late post, you can try it like thisExample :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 linesWinWaitActive("Open File - Security Warning")send ("!r")sleep (20000) Edited August 28, 2009 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. 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