user2437443
user2437443

Reputation: 2257

Installer Custom Action Error - Type Mismatch: [string: "C:\"]

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.

Upvotes: 0

Views: 617

Answers (1)

Tom Blodget
Tom Blodget

Reputation: 20782

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.

Upvotes: 1

Related Questions