débogage VBScripts dans InstallShield est une douleur dans le cou. Ancien débogage scolaire, c.-à-écrire les fichiers journaux, est le meilleur, car, vous ne serez pas en mesure de saisir des messages d'erreur, etc.
lire également et écrit au registre de InstallShield peut se faire via winmgmts mais il est une douleur . Voici un exemple qui démontre cela. Puisque notre application utilise des clés de registre 32 bits et que nous ne savions pas si elle était traitée par Windows 32 bits ou 64 bits, nous devions vérifier les deux emplacements pour la clé de registre 32 bits (le Wow6432Node).
est ici un code que nous avons utilisé pour lire le Registre:
Option Explicit
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Dim SoftVersion
SoftVersion = RegReadString("HKLM\SOFTWARE\Co\Software\Version")
If SoftVersion = "" Then
SoftVersion = RegReadString("HKLM\SOFTWARE\Wow6432Node\Co\Software\Version")
End If
Function RegReadString(path)
' RegRead = CreateObject("WScript.Shell").RegRead(path)
Dim objReg, hkroot, pos, posNext, keyPath, valueName, value
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
hkroot = HKEY_CURRENT_USER
If Left(path, 5) = "HKCU\" Then
hkroot = HKEY_CURRENT_USER
path = Mid(path, 6)
ElseIf Left(path, 5) = "HKLM\" Then
hkroot = HKEY_LOCAL_MACHINE
path = Mid(path, 6)
End If
pos = InStr(path, "\")
posNext = InStr(pos + 1, path, "\")
While posNext > 0
pos = posNext
posNext = InStr(pos + 1, path, "\")
Wend
keyPath = Left(path, pos - 1)
valueName = Mid(path, pos + 1)
objReg.GetStringValue hkroot, keyPath, valueName, value
If IsNull(value) Then
RegReadString = ""
Else
RegReadString = value
End If
End Function
Sub RegWriteString(path, value)
Dim objReg, hkroot, pos, posNext, keyPath, valueName
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
hkroot = HKEY_CURRENT_USER
If Left(path, 5) = "HKCU\" Then
hkroot = HKEY_CURRENT_USER
path = Mid(path, 6)
ElseIf Left(path, 5) = "HKLM\" Then
hkroot = HKEY_LOCAL_MACHINE
path = Mid(path, 6)
End If
pos = InStr(path, "\")
posNext = InStr(pos + 1, path, "\")
While posNext > 0
pos = posNext
posNext = InStr(pos + 1, path, "\")
Wend
keyPath = Left(path, pos - 1)
valueName = Mid(path, pos + 1)
objReg.SetStringValue hkroot, keyPath, valueName, value
End Sub
`` `
Je ne suis pas familier avec installscript, donc je ne l'ajoute pas comme une réponse, mais ... généralement vous pouvez [appeler un vbs à partir de la ligne de commande] (https://technet.microsoft.com/fr -us/library/bb490816.aspx? f = 255 & MSPPError = -2147217396) avec 'cscript.exe/path/to/your.vbs' Je parie que cela fonctionnerait dans ce second champ à partir de votre sérigraphie. – JNevill
@JNevill - merci pour votre idée - il m'a conduit à la solution d'une manière ronde. Il s'avère que IS est assez intelligent pour lancer le script vbs comme je l'ai. En raison d'idiosyncrasies dans l'interface utilisateur IS, je n'avais pas spécifié la "condition" correctement. Je dois encore sauter d'autres obstacles pour obtenir le comportement que je veux, mais au moins je suis sur le bon chemin. –
Voilà de bonnes nouvelles! Si vous le souhaitez, vous pouvez ajouter votre solution en tant que réponse ici et la marquer comme telle.De cette façon, si quelqu'un d'autre dans le futur est coincé avec le même problème, il y aura de l'aide ici sur SO :) – JNevill