Domanda

I am creating an installer and I have a custom action that manipulates a string:

<CustomAction Id="CheckDataPath2" Script="vbscript" Execute="immediate" Return="ignore">
  <![CDATA[
    Dim p
    p=Session.Property("DATALOCATION")
    Dim s
    s=Right(1,p)
    If (s="/") OR (s="\") Then
       Session.Property("PROCEED")="1"
    Else
      Session.Property("PROCEED")="2"
    End If
  ]]>
</CustomAction>

<InstallExecuteSequence>
    <Custom Action="CheckOrigPath2" Before="InstallInitialize">CONTINUE</Custom>
</InstallExecuteSequence>

In the log file, I can see that this custom action is throwing an error. It says:

Microsoft VBScript runtime error 5: Type mismatch: '[string: "C:\"]'

"C:\" is the value of the DATALOCATION property. I have tried p = CStr(Session.Property("DATALOCATION")), which also doesn't work.

Anyone know what's going on here?

Any suggestions would be greatly appreciated.

È stato utile?

Soluzione

You've encountered one of the reasons that people avoid using script in Windows Installer custom actions: They are hard to debug. See this answer for more.

You have the arguments to Right reversed.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top