Jump to content

Automate RationalPlan Viewer install


Recommended Posts

Hi all

I have no experience in scripting at all, but I saw on a blog that AutoIT was very good for automating tasks such as installing programs, and was also very easy to grasp. I decided to try my hand at writing a script to automate the install of a program called RationalPlan Viewer, which allows users to view Microsoft Project files. The .exe is stored on a network share, and only an Administrator can install things onto a machine, so I have it pointed at the share, and it is set to run as the Administrator. This bit works fine, it goes to the share, and runs the .exe no problem, however I cannot get it to click the buttons to automate the install. I am unsure what I am missing since, as I said before, I have no prior experience in this type of thing. 

My script is as follows:

AutoItSetOption("MouseCoordMode", 0)
RunAs("Administrator", "Domain", "Password", 0, "\\ADVFP\IT\~ Common Install\Project Viewer\RationalPlanV-4.13.0.exe")
; Click "Next" button
WinWait("RationalPlan Viewer 4.13.0 Setup", "&Next >")
WinActivate("RationalPlan Viewer 4.13.0 Setup", "&Next >")
MouseClick("primary", 365, 364, 1, 0)
; Click "I Agree" button
WinWait("RationalPlan Viewer 4.13.0 Setup", "I &Agree")
WinActivate("RationalPlan Viewer 4.13.0 Setup", "I &Agree")
MouseClick("primary", 365, 364, 1, 0)
; Click "Next" button
WinWait("RationalPlan Viewer 4.13.0 Setup", "&Next >")
WinActivate("RationalPlan Viewer 4.13.0 Setup", "&Next >")
MouseClick("primary", 365, 364, 1, 0)
; Click "MS Project .xml flies" radio button
WinWait("RationalPlan Viewer 4.13.0 Setup", "MS Project .xml files")
WinActivate("RationalPlan Viewer 4.13.0 Setup", "MS Project .xml files")
MouseClick("primary", 49, 262, 1, 0)
; Click "MS Project .mpx files" radio button
WinWait("RationalPlan Viewer 4.13.0 Setup", "MS Project .mpx files")
WinActivate("RationalPlan Viewer 4.13.0 Setup", "MS Project .mpx files")
MouseClick("primary", 46, 286, 1, 0)
; Click "Install" button
WinWait("RationalPlan Viewer 4.13.0 Setup", "&Install")
WinActivate("RationalPlan Viewer 4.13.0 Setup", "&Install")
MouseClick("primary", 365, 364, 1, 0)
; Click "Run RationalPlan Viewer 4.13.0" radio button
WinWait("RationalPlan Viewer 4.13.0 Setup", "&Run RationalPlan Viewer 4.13.0")
WinActivate("RationalPlan Viewer 4.13.0 Setup", "&Run RationalPlan Viewer 4.13.0")
MouseClick("primary", 191, 179, 1, 0)
; Click "Create Quicklaunch Shortcut" radio button
WinWait("RationalPlan Viewer 4.13.0 Setup", "&Create Quicklaunch Shortcut")
WinActivate("RationalPlan Viewer 4.13.0 Setup", "&Create Quicklaunch Shortcut")
MouseClick("primary", 191, 245, 1, 0)
; Click "Finish" button
WinWait("RationalPlan Viewer 4.13.0 Setup", "&Finish")
WinActivate("RationalPlan Viewer 4.13.0 Setup", "&Finish")
MouseClick("primary", 365, 364, 1, 0)

If any help could be offered it would be greatly appreciated. 

Thanks

Connor

Link to comment
Share on other sites

JustSomeBrit,

welcome to AutoIt and to the forum!

although we can easily guide you through the process of automating an installation with AutoIt, you should first find out if your installer has a silent installation option. have a look here:

http://www.rationalplan.com/project-management-faq.php#silent_install

 

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

Orbs

Thank you for the response. I was not aware that RationalPlan allowed for a silent install, so thank you for pointing that out to me. 

I was more using RationalPlan as a test for automated installs using AutoIT as it is a really straightforward install to start out with. I guess I could have been clearer, I was wondering if someone could help me realise why my script wasn't causing AutoIT to click the buttons I had specified, as I could then use that knowledge to automate other installs and not just RationalPlan. 

Would you be able to help me see why my script isn't clicking the buttons so that I can get a better understanding of scripting in general?

Thanks again

Link to comment
Share on other sites

More than likely your script can't interact with the program because the program is being run under admin credentials and the script under user credentials. Run them both as admin and it will probably work.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

@JustSomeBrit, for any install that does not allow silent switches (rare these days), I would suggest looking at the Control functions in the help file (ControlClick, etc.). Unfortunately Mouseclick is inherently unreliable, so it will be very difficult for us to say definitively why it is not clicking where you would like it. If, for some reason, you cannot get Control functions to work I would suggest avoiding the MouseMove/Mouseclick scenario altogether and going with Send/ControlSend to send Alt+N for Next, Alt+I for Install, etc.

Edit: Hit post too soon. For any application that just will not support silent installation, I would suggest taking a look at the Wix Toolset. It is an open source and easy to grasp toolset for creating your own silent installs.

Edited by JLogan3o13

"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!

Link to comment
Share on other sites

@BrewManNH That was exactly it! When I compiled the script and ran it as admin, everything worked fine! Thanks for the help. I had seen a blog post which had said that by adding in the script to run as admin, then the user could just run the compiled .exe and everything would be fine. But I can work with simply running the .exe as admin on a users machine and putting in the credentials, as the program will then install automatically, cutting out a lot of the time we spend having to sit there and manually go through an install for people.

@JLogan3o13 Thank for the advice, I gave ControlClick a go, and it worked fine for everything except the radio buttons that needed to be clicked. For those I just used MouseClick as I had originally. I will look at using the Send functions for my next install script and see how it goes. Thanks again for the tip.

 

Sorry to the both of you for an extremely delayed response. Your replies have helped me a lot and I'm grateful for the assistance.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...