Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

running VBScript from within the MSI...


6 replies to this topic

mjb750q

mjb750q
  • Members
  • 15 posts

Posted 26 September 2003 - 14:27

Hi,

I have an MSI which works fine. However, I wish to perform an additional task at the end of the MSI. The task has been programmed with 5 lines of VBScript.

This code works perfectly when saved as a .vbs.

Now, I have managed to get the msi to run the script, however, this seems a long way round... I have "executed a program from destination", being : cmd /c cscript c:\yadayadayada.vbs.

Now, this works, however, within Wise for Windows there is an option: "Run VBScript from embeded code". Placing this code in here doesn't work, it throws back a nice little error message 17??.

But surely, this is the reason why this option and feature is there and it clearly doesn't work. Has anyone else had this problem, or know the fix, or even think the same....

Answers greatly appreciated.

John Penford, - AVECIA Ltd.



ijahman

ijahman
  • Members
  • 15 posts

Posted 26 September 2003 - 15:20

If i understand you right:
you start an CA type 6 and get an error.
if you use an CA type 50 (or something like that) and it works

The thing that happened to me in this area was: using wscript.quit (or something like this, eg. wscript.scriptfullname)
wscript object is not supported with CA Type 6 (i think the script engine in this case is the installer itself, not wscript or cscript)

did i catch your problem?

mjb750q

mjb750q
  • Members
  • 15 posts

Posted 30 September 2003 - 13:05

Yeah, I think i get what you're trying to say. for example I'm trying to instantiate the wshshell object:

set wshshell = wscript.createobject(wscript.shell).

And this is why it's failing?

Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 01 October 2003 - 09:14

It's Active Scripting, a technology to execute scripts in your software. The client (or "host") instantiates a script engine, and adds a couple of program specific objects.

For instance, Internet Explorer adds objects that allow access to the page. Windows Installer adds objects that allow access to installer functions, for instance setting and getting objects. Look on MSDN if you want to add active scripting on your software.

And Cscript.exe, and Wscript.exe includes an object called "WScript". If I'm correct, it allows access to command-line parameters, keyboard input etc.

So, in a CA 6, the "WScript" variable does not exist, and your script fails. If you run this in a VBS, "WScript" does exist, and your script runs.
Try replacing "WScript.CreateObject" with "CreateObject".

mjb750q

mjb750q
  • Members
  • 15 posts

Posted 01 October 2003 - 09:47

Right, excelent, I have that now working....well, sort of.

We distribute applictions throughout the business via MSI's, and MSI's only. I have been tasked with applying service pack 3 to MSOffice 2k and therefore have to create an msi to do this.

Currently, I have a CA for VBS:

Set WshShell = CreateObject("Wscript.Shell")
return = WshShell.Run ("c:\windows\system32\msiexec /fvd " & """" & "f:\Core\Microsoft Office 2000 SR-1 Standard\data1.msi" & """" & " reboot=reallysupress /l*v c:\windows\logs\o2ksp3.log /qb",0,True)

This command works as a seperate vbs file (subject to changing 'create object' mentioned in previous threads). An alternative would be to run a cmd prompt to call this script, however, it looks messy and I was wondering if you can 'repair/reinstall' other msi's from the 'running' msi?

Edited by mjb750q, 01 October 2003 - 09:47.


Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 01 October 2003 - 14:11

You cannot run two installations at the same time, so you cannot create an Msiexec process to install some other software.

But: you can nest installations. Look at CA type 23 and 39. Nesting also deals with reboot issues.

mjb750q

mjb750q
  • Members
  • 15 posts

Posted 02 October 2003 - 09:32

Thanks again.

I did look at those CA's but it appears that it's impossible to 'repair' as there is no property, (e.g. ADVERTISE=ALL, or INSTALLDIR etc) which starts of a repair.

Does anyone know of a repair property/value that can be set?

John.