Jump to content

Issues running script with sw_hide or sw_minimise


Recommended Posts

HI all

I've just picked up AutoIT in the last couple of weeks as it was recommended to me by someone to overcome a deployment of a troublesome piece of software.   I've already tried using switches for the source exe file and extracted the msi which cannot be triggered on it's own.  Response files don't work either.

The end goal is to push this out using SCCM (current branch).

I started using the basic send commands (below) which work a treat but I need to make this silent for the end users ideally.   

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=OmniVista_installer.Exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Run(@ScriptDir & '\OmniVista8770Client3.2.exe', "", @SW_MINIMIZE)
;AutoItSetOption('MouseCoordMode', 0)

WinWait('OmniVista 8770 Client 3.2 - InstallShield Wizard', "Select the language for the installation")
WinActivate('OmniVista 8770 Client 3.2 - InstallShield Wizard')
Send('{TAB}{SPACE}')
Winwait('OmniVista 8770 Client 3.2 - 3.2.08.09', 'WARNING: This program is protected by copyright law and international treaties.')
Winactivate('OmniVista 8770 Client 3.2 - 3.2.08.09')
Send("!{n}")
Sleep(300)
Send("!{a}")
Send("!{n}")
Sleep(300)
Send("!{c}")
Sleep(500)
Send("!{f}")
$text = 'C:\Program Files (x86)\Client8770 3.2\'
ClipPut($text)
Send('^v')
Sleep(800)
Send('{TAB}{SPACE}')
Sleep(300)
Send("!{n}")
Sleep(300)
Send("!{i}")
WinWait('OmniVista 8770 Client 3.2 - 3.2.08.09', 'The InstallShield Wizard has successfully installed OmniVista 8770 Client 3.2')
Winactivate('OmniVista 8770 Client 3.2 - 3.2.08.09')
Send("!{f}")

I have researched and rewritten the script to replace the send commands with ControlSend and tried using WinwaitActives and have the following;

The issue I have is that if I try and run this with @sw_hide , it doesn't run at all.   The same behavior happens when I'm also trying to run this as a required deployment in sccm but if I push it out using an 'Available' deployment, it pops up and starts working (although it means the GUI can be interrupted).

#RequireAdmin
AutoItSetOption ("TrayIconDebug", 1)
$ProcessID = Run(@ScriptDir & '\OmniVista8770Client3.2.exe', "", @SW_HIDE)
Opt('WinTitleMatchMode', 2)
;nGetTitle = WinGetTitle('OmniVista 8770 Client 3.2 - InstallShield Wizard') ; this title also may need some tweaking
$WinGetTitle = WinGetTitle("[ACTIVE]")
WinWaitActive($winGetTitle)
ControlSend('OmniVista 8770 Client 3.2 - InstallShield Wizard', "Select the language for the installation", '', "!{o}", 0)
Client 3.2 - InstallShield Wizard', "Select the language for the installation", '', "!{o}", 0)
sleep(100)
Opt('WinTitleMatchMode', 1)
sleep(100)
WinWaitActive($winGetTitle)

Controlsend('OmniVista 8770 Client 3.2 - 3.2.08.09', 'WARNING: This program is protected by copyright law and international treaties.', '', "!{n}", '')
WinWaitActive($winGetTitle)

ControlSend('OmniVista 8770 Client 3.2 - 3.2.08.09', 'Please read the following license agreement carefully.', '', "!{a} !(n)", '')
WinWaitActive($winGetTitle)
Controlsend('OmniVista 8770 Client 3.2 - 3.2.08.09', 'Click Next to install to this folder', '', "!{c}",'')
;ControlSend('OmniVista 8770 Client 3.2 - 3.2.08.09', 'Change Current Destination Folder', '', "!{f}",'')
$newpath = 'C:\Program Files (x86)\Client8770 3.2\'
ClipPut($newpath)
ControlSend('OmniVista 8770 Client 3.2 - 3.2.08.09', 'Change Current Destination Folder', '', "^v", '')
ControlSend('OmniVista 8770 Client 3.2 - 3.2.08.09', 'Change Current Destination Folder', '', "{TAB}",'')
ControlSend('OmniVista 8770 Client 3.2 - 3.2.08.09', 'Change Current Destination Folder', '', "{SPACE}", '')

WinWaitActive($winGetTitle)
Controlsend('OmniVista 8770 Client 3.2 - 3.2.08.09', 'Click Next to install to this folder', '', "!{n}", '')

WinWaitActive($winGetTitle)
Controlsend('OmniVista 8770 Client 3.2 - 3.2.08.09', 'The wizard is ready to begin installation', '', "!{i}", '')

WinWaitActive($winGetTitle)
Controlsend('OmniVista 8770 Client 3.2 - 3.2.08.09', 'The InstallShield Wizard has successfully installed OmniVista 8770 Client 3.2', '', ("!{f}"), '')

 

Both of these run fine when using @sw_show but when I switch to SW_Hide the script stops working....  The thing I don't understand is that despite me changing my key press triggers from Send to ControlSend commands and I'm using winwaitactives so they should work in a hidden state or even minimised.

Can someone please check this out as I'm stuck.   Thanks in advance.

Link to comment
Share on other sites

Am I correct in saying that a hidden window can never be the active one? I think WinWaitActive will pause your script indefinitely. I'll test this in a second

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

Have you tried running the msi with ISSETUPDRIVEN=1 switch?  This usually stops the dependency of setup.exe.  Also I've found with Windows 10 when using the /r option for the exe you also need to use the /f1 switch to point to a writeable folder to save the setup.iss file, in the past it would save it to C:\Windows\setup.iss, but with Windows 10 because it's a system folder it fails.

 

Link to comment
Share on other sites

18 hours ago, Subz said:

Have you tried running the msi with ISSETUPDRIVEN=1 switch?  This usually stops the dependency of setup.exe.  Also I've found with Windows 10 when using the /r option for the exe you also need to use the /f1 switch to point to a writeable folder to save the setup.iss file, in the past it would save it to C:\Windows\setup.iss, but with Windows 10 because it's a system folder it fails.

 

HI Subz

The install file is an InstallShield wrapper around C++ Redistributable 2008... this is checked for during the initial run, then it calls upon an MSI from within which also refers to a MST file... this MSI file contains a JAVA based interface, so lots of subfolders and files.   If I and run the MSIEXEC the file and invoke the the TRANSFORMS command, this doesn't work.   Even if I try and run MSIEXEC to extract the contents and run this independently, still this doesn't install. 

As to tricking out the InstallShield wrapper with a response file... I have been able to create an ISS file but when it comes to piping the F1 variable into the command, it just doesn't work.   Once again, I've tried many different combinations.   After two whole days trying to do this I had to move onto AutoIT.

This literally my last resort because everything else I've tried just doesn't work.... I have also asked external consultants.   The answer has generally been... to paraphrase,  "errgghhh Alcatel software, we've tried, don't bother, just install manually "   This however is my brief.   For the meantime, I've told my Project Manager that this is the closest thing to zero-touch I can get to and that the end-users will have to trigger this from Software Centre themselves and just not touch their PC for a whole minute [LOL] while it runs the autoIT binary !!

Link to comment
Share on other sites

To assist with the "not touch their PC for a whole minute" portion, you could use BlockInput to force them to not touch their PC since you are already using #RequireAdmin

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

On 2/27/2020 at 1:02 PM, seadoggie01 said:

To assist with the "not touch their PC for a whole minute" portion, you could use BlockInput to force them to not touch their PC since you are already using #RequireAdmin

I'm not too fussed because the staff that will be installing the app are technical so should be reading this note published for the SCCM item in software center.   

 

On 2/27/2020 at 1:52 PM, Subz said:

Strange for InstallShield, have you tried using /v or /s, example

#RequireAdmin
Run(@ScriptDir & '\OmniVista8770Client3.2.exe /v"/qn /norestart"', "", @SW_HIDE)

 

I've tried every combination for the switches.  It's just an awful installer.  Alcatel are well known for issues with trying to zero-touch their software.   

What matters more at the moment is if it's even possible to hide this installer from view as my project manager isn't happy about the "don't use your PC" line as a get around.

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...