Menu

ServantSalamander

Juan Jose Pablos

Last modified 5 years ago Last modified on 03/01/10 03:08:36

Unattended install of Servant Salamander 2.0

​Servant Salamander 2.x is a file manager for MS Windows which is - thanks to its generous educational licensing policy - used widely at our University. However, the software uses its own installer that does not permit unattended installation. Although the installer may change in the future releases, the only chance at the present moment is to use AutoIt?.

Below you will find an AutoIt? 3 script (sorry, no AutoIt? 2) and a batch script that should install the package.

AutoIt? 3 script

The script expects two files to exist - %Z%\packages\salamand\salamand.exe, which is the installer itself, and %Z%\packages\salamand\keys.zip, which contains the licensing keys for the program.

;

; AutoIt Version: 3.0

; Language:       English

; Platform:       Win9x/NT

; Author:         Jan Prikryl

;

; Script Function:

;   Installs Servant Salamander <http://www.altap.cz/>.

;

; Run the calculator

Run("%Z%\packages\salamand\salamand.exe")

; Wait for the calulator become active - it is titled "Setup - Servant Salamander"

; on all systems

WinWaitActive("Setup - Servant Salamander")

; Now that the window is active type ENTER to skip the introductory screen

Send("{ENTER}")

Sleep(2000)

; Send ALT+Y to accept the license agreement

Send("{ALTDOWN}Y{ALTUP}")

Sleep(2000)

; Get input box text to see where the Servant Salamander has been installed

; You may leave this out if you want to, it's not really needed for this

; script - but you may use it to inject global user preferences and settings

; later on.

$text = WinGetText ("")

$mark1 = "&Destination Directory"

$mark2 = "B&rowse"

$len1  = StringLen ($mark1)

$location1 = StringInStr( $text, $mark1 ) + $len1 + 1 ; Account for \n

$location2 = StringInStr( $text, $mark2 ) - 1         ; Account for \n

$instDir   = StringMid( $text, $location1, $location2-$location1 )

; Accept the default directory and continue to the next screen

Send("{ALTDOWN}N{ALTUP}")

Sleep(2000)

; If the directory did not exist, setup will ask us to confirm the

; directory creation. Wait for the confirmation box to appear and

; ignore it if it does not show up.

AutoItSetOption( "WinTitleMatchMode", 3)    ; 1=start, 2=subStr, 3=exact, 4=...

$ret = WinWaitActive("Setup", "", 10)

if $ret = 1 then

  Send("{ENTER}")

  Sleep(2000)

endif

; Use "Common" rather than "Personal" folders for shortcuts

Send("{ALTDOWN}C{ALTUP}")

Sleep(2000)

; Accept the settings and continue

Send("{ALTDOWN}N{ALTUP}")

Sleep(2000)

; Install. Wait for the next screen which has the same window title but contains

; also text string "finished".

Send("{ALTDOWN}I{ALTUP}")

WinWaitActive("Setup - Servant Salamander", "finished")

; Do not view the Readme file

Send("{ALTDOWN}V{ALTUP}")

Sleep(2000)

; Launch Servant Salamander to install the keys

Send("{ALTDOWN}F{ALTUP}")

; Wait for the "Servant Salamander" window to appear

; This is the standard case when installing the application from scratch

; Unregistered version will display a welcome message and after some time

; it activates the "OK" button. But if reinstalling (upgrade from 2.5 b5 to

; 2.5 b6 for example), the "Welcome" window appears instead, offering the

; user to import different older registration keys and settings.

AutoItSetOption( "WinTitleMatchMode", 1)    ; 1=start, 2=subStr, 3=exact, 4=...

$ret = WinWaitActive("Servant Salamander", 20)

if $ret = 1 then

  ; New installlation. Sleep a bit to let Salamander activate "OK" ....

  Sleep(10000)

  ; Continue to start the application

  Send("{ALTDOWN}O{ALTUP}")

else

  ; Probably upgrade. The "Welcome" window shall appear. If it does not, ignore.

  $ret = WinWaitActive("Welcome", 20)

  if $ret = 1 then

    ; We will just skip over the welcome window and continue to start the

    ; Servant Salamander

    Send("{ALTDOWN}S{ALTUP}")

    Sleep(2000)

  endif

endif

; Beta 6 issues an FTP client warning after the start.

; Skip it (just pres ENTER)

$ret = WinWaitActive("FTP", "", 10)

if $ret = 1 then

  Send("{ENTER}")

  Sleep(2000)

endif

; The main Servant Salamander window starts with the current

; drive (e.g. "C:\ - Servant Salamander - ...") so we need to

; change window title matching mode

AutoItSetOption( "WinTitleMatchMode", 2)    ; 1=start, 2=subStr, 3=exact, 4=...

WinWaitActive( "- Servant Salamander -" )

; Go to the Help->Import registration keys

Send("{ALTDOWN}H{ALTUP}")

Sleep(2000)

Send("R")

Sleep(2000)

; Wait for the file selection box to appear

AutoItSetOption( "WinTitleMatchMode", 1)    ; 1=start, 2=subStr, 3=exact, 4=...

WinWaitActive("Import Registration Keys")

; Type in the location of the key file

Send("%Z%\packages\salamand\keys.zip", 1)

Sleep(2000)

Send("{ENTER}")

; The confirmation windows has the same name but it will contain

; string "Import button"

WinWaitActive("Import Registration Keys", "Import button")

; Default choice is "Import" which is exactly what we want.

; Confirm the dialog

Sleep(2000)

Send("{ENTER}")

; In some cases older installation will conflict with the current keys

; for Servant Salamander and PictView

$ret = WinWaitActive("Confirm File Overwrite", "", 10)

if $ret = 1 then

  Sleep(2000)

  Send("{ENTER}")

  ; PictView keys overwrite may appear ...

  $ret = WinWaitActive("Confirm File Overwrite", "", 10)

  if $ret = 1 then

    Sleep(2000)

    Send("{ENTER}")

  endif

endif

; Next dialog will have again the same title "Import Registration Keys",

; but this time it will contain string "succesfully imported".

WinWaitActive("Import Registration Keys", "successfully imported")

; There is only "OK" in this case. Confirm the dialog.

Sleep(2000)

Send("{ENTER}")

; And thas is all.

; Now quit by sending a "close" request to the application

Sleep(10000)

AutoItSetOption( "WinTitleMatchMode", 2)    ; 1=start, 2=subStr, 3=exact, 4=...

WinClose( "- Servant Salamander -" )

; And wait for the main window to disappear to before continuing

WinWaitClose( "- Servant Salamander -" )

; Finished!

Script file

This script has not been thorougly tested yet, your mileage may vary.

:: OPTIONAL: Install Servant Salamander 2.x <http://www.altap.cz/>

@Echo off

:: Runs an AutoIt 3 script.

:: Expects %Z%\packages\salamand\salamand.exe and %Z%\packages\salamand\keys.zip to exist.

todo.pl "AutoIt3.exe %Z%\scripts\salamand.au3"

Related

Wiki: Scripts