Jump to content

Multipurpose Program runner


storme
 Share

Recommended Posts

Gday All

I've seen many installer AutoIT scripts, some just for a single program, some massive all singing all dancing programs that are set up to install heaps of programs. Depending on the age of the scripts the programs they load maybe current or woefully out of date.

What Im hoping to get hammered out here is a skeleton that can be used to set up all the details need for just one program per script (e.g. Spybot) to do the following functions.

- Download Download the installer from wherever it lives on the net

- Install - Install the program, set any parameters needed, handle any prompts

- Update Update program (e.g. Spybot data File, Ccleaner program file)

- Run Run the program, the way you want it run handling any prompts

- Uninstall Remove the program (completely) when its not required any more.

This removes the need to remember all the command line switches for all the different programs as the runners use a standard set.

Also each runner will save its status in an INI file that can be read by other programs to check on the programs (e.g. Spybot) status.

How I decided to do it is out lined in the 2 scripts below.

{program}_Runner.au3

Includes Runner_Common.au3 for all common functions.

This is where you add the customisations needed to download/install/run/uninstall the particular program.

For a basic program that has a silent installer and no buttons to be clicked for any function, all that will be required is setting a few variables.

Runner_Common.au3

Holds all the common functions for the custom program runner (e.g. Spybot_Runner.au3)

- Declares all common variables used by the scripts

o Advantage: Unused or nonsense actions can be ignored. I.e. If a program cant be updated you dont need to

set the update variables in the custom script.

o Default values can be set and applied to all programs.

- Any commonly useful functions can be added here so they are available to all custom scripts.

o e.g. Autologon, Autorun, writelog, etc etc etc

- Scans the command line and runs functions based on standard switches

Actions :

/GUI - Bring up script GUI

(Click a button to do most of the actions below)

/Download - Download install file

/Install - Install the program

/Update - Update the program

/Run - Run the program

/Uninstall - Uninstall the program

/Cleanup - Delete downloaded and temporary files

/Remove - Delete this script

Modifiers :

/Silent - Perform action without human intervention

/NoRestart - Don't restart computer even if needed

/Restart Force computer restart after action

/Force - Force action (e.g. Install when already installed))

Any other command switches will be accumulated and passed on to the program that is run.

This can also be used to add your own modifiers (e.g. myprog /run /test) without changing Runner_Common.au3

The scripts arent complete but I keep thinking up new facilities to add to them and rewriting the scripts to accept the new code. Then spending hours working out why what used to work isnt anymore and which of my changes has broken it (again). :-(

So its time I got it out into the open and got some of your ideas and feedback on what my little install script has morphed into. If you have a better idea for any part of the script let me know. Most of the code is untested. As I said its been growing from the original design so may have picked up some bugs along the way. If you find any problems please let me know.

Thanks in advance

John Morrison

runner_V0.1.zip

Edited by storme
Link to comment
Share on other sites

:D

36 downloads and no comments.

Surely someone has a comment or an improovement I can make?

Well seeing as I've produced a perfect bit of code :D (as if) I'll start code up other marvels of modern code. :o

John Morrison

Link to comment
Share on other sites

thank

If you use it let me know if you have any troubles. As I siad in the intro it's "grown" over time and I haven't stopped to do any extensive testing yet.

Also if you have anything you think might be good to add let me know.

Hope everyone is haveing a great weekend

John Morrison

Link to comment
Share on other sites

  • 2 weeks later...

If you use it let me know if you have any troubles. As I siad in the intro it's "grown" over time and I haven't stopped to do any extensive testing yet.

Also if you have anything you think might be good to add let me know.

Hope everyone is haveing a great weekend

John Morrison

Found your script looking specifically for something to automate Spybot S&D scans. (Malware Bytes would also be useful) but (admittedly after just a few minutes) am unable to get it to run. Great concept (generic program runner doing download/install/update...) but can generate an app-specific script so quickly that figuring yours out is difficult to justify. If you can provide dummy-level instructions on the Spybot runner, maybe that would help us better understand your script, set off some light bulbs. I suspect more response/requests/activity would happen from there.

Link to comment
Share on other sites

Found your script looking specifically for something to automate Spybot S&D scans. (Malware Bytes would also be useful) but (admittedly after just a few minutes) am unable to get it to run.

It should run as it is ^_^ without modification.

I'll do some testing and see what the problem is. Sorry!

Great concept (generic program runner doing download/install/update...) but can generate an app-specific script so quickly that figuring yours out is difficult to justify.

The main trust of the script is something that is autonomous as it can be so you can give the script to "anyone" and all the have to do is use standard switches to "download/install/run" the program and when it's not needed "uninstall" the program. The script can even clean up and selfdestruct when no longer needed.

Oh and if you want to implement it there is even a script update function.

If you can provide dummy-level instructions on the Spybot runner, maybe that would help us better understand your script, set off some light bulbs. I suspect more response/requests/activity would happen from there.

Hmm good point.

It's all so clear to me but I've been working on it for some time.

The documentation is sparse as I wanted to know if anyone was interested in it before I made up a lot docs that no one would ever read. ;)

I'll generate a "clean" script and add it to the example when I have some time to spare. I have 8 broken computers to get working by Monday....sigh

For a basic program all you have to do is to edit the variables in the main script and ignore the rest of the script.

;---------- START --- Program specific code ----------
$ProgramName = 'Spybot - Search & Destroy'

;Tell the script where to download the main program from
$DownloadActive = True ; Is this section available for this program?
$DownloadDomain = "http://www.spybotupdates.com" ; include HTTP://
$DownloadRemotePath = "/files"
$DownloadFileName = "spybotsd162.exe"
$DownloadPath = "downloads" ; Relative to script
$DownloadCommand = "" ; Extra command (eg unzip, etc)

;Details about how to install the program
$InstallActive = True ; Is this section available for this program?
$InstallCommand = $DownloadFileName
$InstallCommandLine = '/sp /components="main,SDWinSec,SDShredder" /tasks="launchsdhelper" /silent'
$InstallCommandLineSilent = '/sp /norestart /components="main,SDWinSec,SDShredder" /tasks="launchsdhelper" /verysilent'

;How to upgrade the program
$UpgradeActive = True ; Is this section available for this program?
$UpgradeDomain = "" ; include HTTP:
$UpgradeRemotePath = ""
$UpgradePath = @ProgramFilesDir & '\' & $ProgramName
$UpgradeCommand = "SDUpdate.exe"
$UpgradeCommandLine = "/autoupdate /autoclose"
$UpgradeCommandLineSilent = "/autoupdate /autoclose /taskbarhide"

$RunActive = True ; Is this section available for this program?
$RunPath = @ProgramFilesDir & '\' & $ProgramName
$RunCommand = 'SpybotSD.exe'
$RunCommandLine = '/autocheck /autofix /autoclose /allhives /onlyspyware'
$RunCommandLineSilent = '/autocheck /autofix /autoclose /allhives /onlyspyware /taskbarhide'
If Not FileExists("") Then
    ;/autoimmunise - Can only be used if trend not installed
EndIf

$UninstallActive = True ; Is this section available for this program?
$UninstallPath = @ProgramFilesDir & '\' & $ProgramName
$UninstallCommand = 'unins000.exe'
$UninstallCommandLine = ''
$UninstallCommandLineSilent = '/silent'

;Details for script update routine
$ScriptDownloadActive = False ; Is this section available for this program?
$ScriptDownloadDomain = "" ; include HTTP://
$ScriptDownloadRemotePath = ""
;---------- END   --- Program specific code ----------oÝ÷ Ù8^®éߺw-ÜjYl¶ªºQºsë¢
Ú*&êºm«ljeÊ»§²Ø^¦º ­©ÚÞ¶êç±h­*rnb¶ËZ®Û0ØZ²Z²­ç§¶­ç²Ê^r&¥©Ý)à²7ö÷u׶¡×zZ0jëh×6;---------- START --- Program specific code ----------
;Wait for scan to start
While Not WinExists("[TITLE:Check in progress...; CLASS:TformProgress]", "")
    Sleep(10000)
    If WinExists("Legal stuff") Then
        WinActivate("Legal stuff")
        ControlCommand("Legal stuff", "", "[CLASS:TCheckBox; INSTANCE:1]", "Check")
        ControlClick("Legal stuff", "", "[CLASS:TBitBtn; INSTANCE:1]")
        ;ConsoleWrite("Legal stuff Window found")
    EndIf
    ;Adaware also loaded on computer
    If WinExists("[TITLE:Confirm; CLASS:TMessageForm]", "") Then
        WinActivate("[TITLE:Confirm; CLASS:TMessageForm]")
        ControlClick("[TITLE:Confirm; CLASS:TMessageForm]", "", "[CLASS:TButton; INSTANCE:2]")
        ;ConsoleWrite("Adaware Window found")
    EndIf
WEnd
;---------- END   --- Program specific code ----------oÝ÷ Ù8^¬µªí¢{azf¢Z(¦«¨µhbãë¡Ç¬°Lb²Û4ߤn*&©Ýªê-«y*rnb±Ú"azÇíë¬z¶¢»l¶¬q©íét©Éº-Â)Ý£
h¦Ë©!Ú'ßÛpj{m«l !yÉÛ!ºØ­v'N«yªÞi÷°¢Ø^¯§v,¶­"ÈhºWç$~Ú³¥»­"¯mi×^^'­z§i¹^¶ÞÞ¦º ­©¬q©è·¬µªíjëh×6;---------- START --- Program specific code ----------

;Close Spybot window - if scan is cancelled
If WinExists("[TITLE:Spybot - Search & Destroy; CLASS:TformMain]", "") Then
    WinKill("[TITLE:Spybot - Search & Destroy; CLASS:TformMain]", "")
EndIf

;---------- END   --- Program specific code ----------

The other sections are handled the same.

Anyway Hope that helps a little. PM me if you need anymore help. I'd also like to know details of the problems you're having getting the script running.

Good Luck!

John Morrison

Edited by storme
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...