BerniBuys Posted February 3, 2016 Share Posted February 3, 2016 Good Day Firstly I am a beginner and I have gone through the FAQ and searched the web for a answer and I cannot find one. I am trying to automate installations for some of the programs I usually install often and here are some issues I have. I am having an issue where AutoIT just does not want to do what I want it and doesn't send the commands like it is suppose to. The following issue I have is firstly the run function Run("C:\Apps\program.exe") When I try run it just does nothing, I bypassed the issue using this ShellExecute("C:\Apps\program.exe") Now I am stuck because it is not sending the keystroke as it should like Send("!y") to continue in the setup. Here is an example of the code I tried to use to install a simple program I tried to install. $result = FileExists("C:\Apps\spsetup129.exe") If $result Then Msgbox(0,"","File exists, Click OK to install") ShellExecute("C:\Apps\spsetup129.exe") Sleep(5000) WinWaitActive("Speccy v1.29 Setup") WinActivate("Speccy v1.29 Setup") Sleep(2000) Send("!n") Sleep(1000) Send("!i") Sleep(15000) Send("!f") Else MsgBox(0,"","File doesn't exist") EndIf Please any help would be appreciated. Link to comment Share on other sites More sharing options...
orbs Posted February 3, 2016 Share Posted February 3, 2016 @BerniBuys, welcome to AutoIt and to the forum. here's what you missed: 1) this specific program, a well as many others, have either portable version or silent installation methods. use them! if you are "installing" many such programs, visit this site for their portable versions or alternatives. but if you insist on doing things the hard way, then let's proceed: 2) the installer requires elevation, which you cannot circumvent by sending Alt+y. you have to include the line #RequireAdmin at the top of your script, so your installation script is elevated before you launch any administrative task. and when you do, low and behold: Run() works as expected, as well as the other send() instructions! amazing! 3) or at least the first Alt+n works, for the first "Next" button. i have no idea what your Alt+i is supposed to do. the installer does not have any such options. 4) when you post code to the forum, use the code tags - the <> icon at the toolbar. like this: #RequireAdmin $result = FileExists("spsetup129.exe") If $result Then MsgBox(0, "", "File exists, Click OK to install") Run("spsetup129.exe") Sleep(5000) WinWaitActive("Speccy v1.29 Setup") WinActivate("Speccy v1.29 Setup") Sleep(2000) Send("!n") Sleep(1000) Send("!i") Sleep(15000) Send("!f") Else MsgBox(0, "", "File doesn't exist") EndIf BerniBuys 1 Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
BerniBuys Posted February 3, 2016 Author Share Posted February 3, 2016 Thx a million orbs. Lol sorry for the noobishness 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