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

vb-script startet nicht


2 replies to this topic

sven

sven
  • Members
  • 15 posts

Posted 15 April 2004 - 12:45

moin,

ich hab jetzt mal versucht, die registriesuche als script zu realisieren.
standalone funktioniert das auch. aber im msi wird die datei nicht ausgeführt
----------------------------------------------------
listing: von test.vbs

Option Explicit
' Connect to Windows Installer object
On Error Resume Next
Dim installer : Set installer = Nothing
Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError

Dim oWSHShell, sWert, iWert, IResult

Set oWSHShell = WScript.CreateObject("WScript.Shell")
sWert = oWSHShell.RegRead("HKLM\Software\xxx\yyy")

' versionsüberprüfung
if (swert >= "5.0") then
iWert = 1
Wscript.Echo sWert
' Wscript.Quit 1
'1
' msiDoActionStatusSuccess
else
iWert = 0
Wscript.Echo "hallo"
' Wscript.Quit 0
end if

' wert in proberty setzen
IResult = MsiSetProberty(hMSI, "WERT", iWert)
if (IResult = ERROR_SUCCESS) then
' 0
' msiDoActionStatusNoAction

Wscript.Quit 0
else
' 1
' msiDoActionStatusSuccess
Wscript.Quit 2
end if

Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText
End If
Wscript.Echo message
Wscript.Quit 2
End Sub

-----------------------------------------------------------------
wie gesagt, dat luppt.

einstellung in tabellen:
binary table
fkt1 | [bin data] (datei ist wirklich geladen)
custom action
action | type | source
Fkt2 | 19 |
Start | 6 | Fkt1
installuisequenz
action | condition | sequence
Fkt2 |NOT WERT | 2 --> nur zum test
Start 1 --> sollen ja als erstes ausgeführt werden
proberty
WERT | 0

logmeldungen besagen, das korrekt ausgeführt wurde (keine fehler)
wo ist denn hier der wurm begraben?

wäre nett wenn mir jemand helfen könnte, bevor ich keine haare mehr habe

schon mal danke

Edited by sven, 15 April 2004 - 14:15.


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 15 April 2004 - 21:14

In deiner Custom Action legst du fest, dass die Funktion Fkt1 in deinem VBScript aufgerufen werden soll. Die sehe ich nicht im Listing.

sven

sven
  • Members
  • 15 posts

Posted 16 April 2004 - 08:06

hallo,
danke erstmal für deine antwort.

aber ich dachte, daß Fkt1 nur der schlüssel in tabelle für weitere aktionen sei und da ich das ganze script ausführen wollte, ich ja auch keinen, so wie microsoft es beschrieben hat, optionalen funktionsnamen angeben bräuchte?

also ich bin der meinung, daß die syntax für das vb-script, wenn es aus dem installer heraus aufgerufen werden soll, völlig falsch war.
ich habe diesbezüglich ein paar änderungen vorgenommen und siehe da, es funktioniert.

listing test.vbs
Option Explicit

Function Check()
Dim sWert, iWert

sWert = Session.Property("WERT")
if (swert >= "5.0") then
iWert = 1
' msiDoActionStatusSuccess
else
iWert = 0
msgbox("hallo")
end if

sWert = "19"
Session.Property("WERT") = sWert
msgbox(Session.Property("WERT"))
End Function


tabelle binary
name = Testaufruf
[binary data] = entsprechende datei
tabelle customaction
action = Start
type = 6 (ertmal nur zum test)
source = Testaufruf
target = Check
tabelle installuisequence
action = Start
sequence = 1 (ertmal nur zum test)

aber irgendwie gefällt mir das alles nicht.
das script sieht mir zu primitiv aus (ich bin ja eigentlich c und assembler- system-/netwerkprogrammierer), vieleicht ist das nur glück, daß es läuft.
ich hab mir mal weitere informationen geholt und kann es sein, daß das erste listing ein script für die kommandozeile ist, um ein msi-paket einzulesen und dann entsprechende aktionen durchzuführen?

trotzdem nochmal vielen dank für die schnelle antwort.