0

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks so much! I never would have thought of that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.