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

Visual Basic Script custom action not invoked


3 replies to this topic

rhmorrison

rhmorrison
  • Members
  • 13 posts

Posted 24 February 2004 - 10:22

What can I possibly do wrong here?

I wrote a Visual Basic Script file (*.vbs) that reads a registry key to find the path of an installed program and then show an error dialog if not installed, otherwise to modify/add a key in an INI file located at the path read from the registry key.

This works fine when executed from explorer by double clicking on the .vbs file, when included as a Visual Basic Script custom action it is NOT EXECUTED.

What could the problem be and how can I fix it?
Robert H. Morrison
"Luke, use the source"

rhmorrison

rhmorrison
  • Members
  • 13 posts

Posted 24 February 2004 - 11:26

Some additional INFO:

QUOTE
'
'  XCVR_INI.vbs
'
'  This Visual Basic Script checks to see if OptoLyzer4MOST Professional is
'  installed or not.  If not then an error dialog is displayed, otherwise
'  the appropriate entry in the Transceiver INI file is added/modified.
'
'  Author:        Bob Morrison (BMO)
'  Created on:      Mon 23 Feb 2004
'  Last updade:  Tue 24 Feb 2004
'

MsgBox "Before DIM..."

Dim WSHShell, O4MPath, INI_File

MsgBox "After DIM, Before Set..."

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

MsgBox "After Set, Before On Error..."

On Error Resume Next

O4MPath = WSHShell.RegRead("HKCU\Software\SiliconSystems\Most\MostCenter\ProgPath")

If O4MPath = "" Then
  MsgBox "OptoLyzer4MOST Professional is not currently Installed"
Else
  INI_File = O4MPath + "\Transceiver.ini"
  WriteIni INI_File, "FrmVNode", "LogInfo", "2|243"
End If


This is my script (w/o the ReadIni/WriteIni functions).

So far I have discovered that my problem has two parts.
  1. I was using After Ready to Install dialog w/o having the dialog, and
  2. My script aborts before executing the IMPORTANT STUFF!

Or, to be more precise, in the code above I see two message boxes, the "After Set, Before On Error..." message I DO NOT SEE! This must mean that somehow the Set command (or WScript object) is not supported.

What IS SUPPORTED and how can I change the script to make it work?


Robert H. Morrison
"Luke, use the source"

hteichert

hteichert
  • Members
  • 158 posts

Posted 24 February 2004 - 11:55

You may not use "WScript.CreateObject". Instead simply use "CreateObject". (Remove the "WScript.")
h.teichert-ott

rhmorrison

rhmorrison
  • Members
  • 13 posts

Posted 24 February 2004 - 13:01

QUOTE
'Set WSHShell = WScript.CreateObject("WScript.Shell")
Set WSHShell = CreateObject("WScript.Shell")

Thanks, that fixed the problem!! biggrin.gif

Edited by rhmorrison, 24 February 2004 - 13:47.

Robert H. Morrison
"Luke, use the source"