/build/static/layout/Breadcrumb_cap_w.png

VBScript doesn't run InstallShieldWizard in Windows 8

Hey, i need some help please, i'm trying a setup in InstallShieldWizard on windows 8 system,
i prepared a VBScript to do so, but commands like Tab or Enter doesn't effect in the Intaller.
Running same commands out side the Installer - the commands work.
is there some unique command to do so that the keys will work in the installer?

My script:
Set WshShell = WScript.CreateObject("WScript.Shell")
dim timetowait
timetowait = 1000

dim longwait
longwait = 3000

'open installer
WshShell.Run ("""Location\Setup.exe""")
WScript.Sleep longwait

WshShell.SendKeys "{TAB}"
WScript.Sleep timetowait

WshShell.SendKeys "{ENTER}"
WScript.Sleep longwait

Thank you for you help
Good day :)

2 Comments   [ + ] Show comments
  • Hey, what i was trying to do is to run Setup = Installer of some program which uses the InstallShieldWizard, and to navigate it with automatic commands (the vbscript). the goal: to save screenshots of each step to test the GUI.
    In windows 7 this script works just fine (and also in Windows 8 just not in the InstallerShield
    Thank you so much for the anwers and the thougth! - NoLogin 9 years ago
  • So, you DONT want it to run silently...
    Are you running it all from an elevated command prompt. Would it not be easier to user the built in PSR??

    There was another tool, I have forgotten the name but for some reason keep thinking of butterfly, you configure it to take a screen shot on each mouse click. - Badger 9 years ago

Answers (4)

Posted by: jagadeish 9 years ago
Red Belt
1

This script will work perfectly when you run it outside the installation package. But if you try to use it as a custom action, you will end up with the following error message: "Error 1720: A script required for this install to complete could not be run."

This happens because Windows Installer does not support WScript objects directly.


Set WshShell = WScript.CreateObject("WScript.Shell")
dim timetowait
timetowait = 1000

dim longwait
longwait = 3000

'open installer 
WshShell.Run ("""Location\Setup.exe""")
WScript.Sleep longwait

WshShell.SendKeys "{TAB}"
WScript.Sleep timetowait

WshShell.SendKeys "{ENTER}"
WScript.Sleep longwait


Comments:
  • >Windows Installer does not support WScript objects directly.<BR>
    Hmmm...Consider your use of language here. WI *does* support WScript objects - how else would 'WScript.Shell' objects get created? - but it does *not* support use of the Windows Scripting Host directives, as I believe I had explained earlier. - anonymous_9363 9 years ago
    • A workaround would be not to use the WScript object inside your scripts. For instance, you can use the "CreateObject" function directly. Here is an example:

      Set objFSO = CreateObject("WScript.Shell") - jagadeish 9 years ago
      • Gosh! That's *so* unlike what I already said 2 days ago... - anonymous_9363 9 years ago
Posted by: jagadeish 9 years ago
Red Belt
1
Did you try this with AutoIT script?
Posted by: anonymous_9363 9 years ago
Red Belt
0
While I consider using SendKeys to be a lazy option - I would be re-packaging this - I suspect your problem is if you're trying to run this as an "internal" script, rather than storing it in the Binary table. The problem is that the Windows Installer engine uses its own (let's call it) interpreter for VBS and not Windows Scripting Host. Therefore, while it still has access to standard scripting objects (e.g. WScript.Shell), it knows nothing of the directive to use WSH's CreateObject method. Thus you need to change this:

Set WshShell = WScript.CreateObject("WScript.Shell")

to this

Set WshShell = CreateObject("WScript.Shell")

Talking of re-packaging, are you sure that the set-up EXE doesn't extract and execute an MSI?
Posted by: Badger 9 years ago
Red Belt
0

Funny when you read these things and get a different take on it. It sounds to me like he (she) is trying to launch the exe with a VBS, a small wager on the session isolation preventing the key strokes being passed through.

So, its an exe? Not confirmed if it extracts to an MSI (check taskmgr) if it is a proper real exe, with the installshield wizard, why dont you try the 'Unique command' of creating an answer file for the exe??

Setup.exe -r (when you have finished it will create a setup.ISS file in the windows folder) then use the -s switch to tell it all the magic answers (key strokes).

Please let us know if its just an exe. If you are only sending an enter key, you could probably just run it silently anyway.

Good luck


Comments:
  • Hey, first of all thank you very much for the answer. it's an exe file which openes in installershield. i dont want to run it silently, i need the GUI screenshots.
    i tried the tips here
    Set objFSO = CreateObject("WScript.Shell")
    and
    Set WshShell = CreateObject("WScript.Shell")
    but the keys (tab / enter) still dont reach the installer. if you have some more ideas, i'll be very very happy
    thank you :)
    Julia - NoLogin 9 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ