suppress dialog box using vbscript
i need to deploy Buffalo application silently across many sites. installation does not have any silent switches and throws confirmation dialog at end of installation, where user has to click on OK.
i am trying to suppress it using below vb script which does not seem to work. if i have message boxes it works. if i comment it it does not work .
objShell.Run """"& sCurrentDirectory &"BIN\binst.exe""", 1, False
'MsgBox "Hi"
If ( objShell.AppActivate ("BUFFALO SecureLockManagerEasy for HD")) = True Then
WScript.Sleep 1000
'MsgBox "Hi"
objShell.SendKeys "{Enter}"
WScript.Sleep 1000
'MsgBox "Hi"
End If
Even Auto IT does not help?
Can anyone help on this?
0 Comments
[ + ] Show comments
Answers (4)
Please log in to answer
Posted by:
EdT
10 years ago
Lots of important information missing:
-How are you deploying this app?
-What target operating system?
-What precise application and version number?
In your code - the msgbox commands create an additional delay until you press the msgbox dialog button to cancel the message. Does the code fail if you press it immediately? If so, you need to add delays in place of the msgbox commands.
If you are deploying with a system account, this cannot handle dialogs as there is no GUI for the system account. For the same reason, AutoIT does not work as it will not "see" any dialogs to respond to.
What installer is your buffalo app using?
Comments:
-
at this moment i am just executing vb script manually with run as admin. eventually it will deployed through Altiris. it is targeted fir win 7 and 8. application is BUFFALO SecureLockManagerEasy 1.2.5.1 - shekara 10 years ago
-
when i have msgbox the code does not fail, but works correctly. but when i take that out and play with wait time, it fails. regarding AutoIT, i was able to make it work on 32 bit machines, but on 64 bit machines it fails. - shekara 10 years ago
-
Could this be due to where the windows focus is defaulting to ? If the vendor installer spawns different windows during the install, the focus will change and your sendkey goes to the wrong window. When you display a message box, the focus switches to the message then returns, presumably, to the process that spawned the message box. This is where I believe your code problem lies. I agree with VBScab that capture may be the simplest solution. I don't think you should use the excuse of service problems to avoid capturing - after all, if Buffalo can do it, then there is really no reason why you can't. Use something like process explorer to record the order in which services are installed and just duplicate that. - EdT 10 years ago
-
installer has just one window which has to be suppressed. If I capture, service will not start and throws error 1920 Privilege issue. I am trying to debug that error. - shekara 10 years ago
Posted by:
anonymous_9363
10 years ago
Either:
a) Contact the vendor and have them produce a properly-deployable installer, or
b) capture the installer and use the resulting MSI.
I know already which will be quicker.
a) Contact the vendor and have them produce a properly-deployable installer, or
b) capture the installer and use the resulting MSI.
I know already which will be quicker.
Comments:
-
hope I had this luxury. cannot capture has it has services which has issues. - shekara 10 years ago
Posted by:
ontari
10 years ago
This might help
'*******************************************************************************************
'Script/Version: Using SendKeys in a Script
'Purpose/Description: The script demo the correct usage of sendkeys
'Script – Using SendKeys in a Script
'Description: This script demos the usage of the SendKeys Method and gives examples of the Key to Code.
'Source Code: Modify the Scripts to fit your needs this is an example script
'*******************************************************************************************
'Section 1 is for packagers to make app specific changes
'*******************************************************************************************
'Section 1
'The packager changes the run line command
'Then the packager records the key strokes to be used and places them with the sendKeys command
' Keyboard Keys SendKeys Code
'Backspace {BACKSPACE} or {BS}
'Break {BREAK}
'Caps Lock {CAPSLOCK}
'Clear {CLEAR}
'Delete or Del {DELETE} or {DEL}
'Down Arrow {DOWN}
'End {END}
'Enter(numeric keypad) {ENTER}
'Enter ~
'Esc {ESCAPE} or {ESC}
'Help {HELP}
'Home {HOME}
'Ins {INSERT}
'Left Arrow {LEFT}
'Num Lock {NUMLOCK}
'Page Down {PGDN}
'Page Up {PGUP}
'Return {RETURN}
'Right Arrow {RIGHT}
'Scroll Lock {SCROLLLOCK}
'Tab {TAB}
'Up Arrow {UP}
'F1 through F15 {F1} through {F15}
'To combine a key with Precede the key code with
'Shift + (plus sign) Example ("+{F10}")
'Ctrl ^ (caret) Example ("^{ESC}")
'Alt % (percent sign) Example (“%{F4}”)
'*******************************************************************************************
'Section 2 Tested Code Library
'Do Not Modify Code Below This Line
'*******************************************************************************************
'set System variables
Dim ws
Set ws = CreateObject("Wscript.Shell")
WScript.Echo (111)
ws.sendkeys ("~")
ws.run "control.exe main.cpl,@0,0" 'launches mouse applet in control panel
wscript.sleep 4000 'Pauses script for 4 seconds
ws.sendkeys ("{TAB}") 'Presses the Tab key 6 times
WScript.Echo (222)
ws.sendkeys ("{TAB}")
ws.sendkeys ("{TAB}")
ws.sendkeys ("{TAB}")
ws.sendkeys ("{TAB}")
ws.sendkeys ("{TAB}")
ws.sendkeys ("{RIGHT}") 'Presses the arrow right key
ws.sendkeys ("~") 'Presses the OK button
wscript.sleep 2000 'Pauses script for 2 seconds
ws.run "Rundll32 User32.dll,LockWorkStation" 'Locks the workstation
Set ws = nothing 'Releases the resources used to create the back to the system
'*******************************************************************************************
'*******************************************************************************************
'Script/Version: Using SendKeys in a Script
'Purpose/Description: The script demo the correct usage of sendkeys
'Script – Using SendKeys in a Script
'Description: This script demos the usage of the SendKeys Method and gives examples of the Key to Code.
'Source Code: Modify the Scripts to fit your needs this is an example script
'*******************************************************************************************
'Section 1 is for packagers to make app specific changes
'*******************************************************************************************
'Section 1
'The packager changes the run line command
'Then the packager records the key strokes to be used and places them with the sendKeys command
' Keyboard Keys SendKeys Code
'Backspace {BACKSPACE} or {BS}
'Break {BREAK}
'Caps Lock {CAPSLOCK}
'Clear {CLEAR}
'Delete or Del {DELETE} or {DEL}
'Down Arrow {DOWN}
'End {END}
'Enter(numeric keypad) {ENTER}
'Enter ~
'Esc {ESCAPE} or {ESC}
'Help {HELP}
'Home {HOME}
'Ins {INSERT}
'Left Arrow {LEFT}
'Num Lock {NUMLOCK}
'Page Down {PGDN}
'Page Up {PGUP}
'Return {RETURN}
'Right Arrow {RIGHT}
'Scroll Lock {SCROLLLOCK}
'Tab {TAB}
'Up Arrow {UP}
'F1 through F15 {F1} through {F15}
'To combine a key with Precede the key code with
'Shift + (plus sign) Example ("+{F10}")
'Ctrl ^ (caret) Example ("^{ESC}")
'Alt % (percent sign) Example (“%{F4}”)
'*******************************************************************************************
'Section 2 Tested Code Library
'Do Not Modify Code Below This Line
'*******************************************************************************************
'set System variables
Dim ws
Set ws = CreateObject("Wscript.Shell")
WScript.Echo (111)
ws.sendkeys ("~")
ws.run "control.exe main.cpl,@0,0" 'launches mouse applet in control panel
wscript.sleep 4000 'Pauses script for 4 seconds
ws.sendkeys ("{TAB}") 'Presses the Tab key 6 times
WScript.Echo (222)
ws.sendkeys ("{TAB}")
ws.sendkeys ("{TAB}")
ws.sendkeys ("{TAB}")
ws.sendkeys ("{TAB}")
ws.sendkeys ("{TAB}")
ws.sendkeys ("{RIGHT}") 'Presses the arrow right key
ws.sendkeys ("~") 'Presses the OK button
wscript.sleep 2000 'Pauses script for 2 seconds
ws.run "Rundll32 User32.dll,LockWorkStation" 'Locks the workstation
Set ws = nothing 'Releases the resources used to create the back to the system
'*******************************************************************************************