none
Execution sequence of VBScript

    Question

  • Hi,

    I am trying to use VBScript to copy files in TARGETDIR to somewhere else. I get TARGETDIR in VBScript.
    However check in my VBScript, "if forlder TARGETDIR exists" always returns False.

    In InstallExecuteSequence table my custom action has sequence number 6500 which is after standard action InstallFiles (sequence number 4000).

    Any idea whats going wrong with my VBScript?


    --------------------------VBScript-----------------------------------------
    Dim objShell, cmd, cmd1, filePath, objScriptExec, objFSO
    Set objShell = CreateObject("WScript.Shell")
    'msgbox Session.TargetPath("TARGETDIR")
    filePath = Session.TargetPath("TARGETDIR") & "bin\TextFile1.txt"
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    if not objFSO.FileExists(filePath) then
        msgbox "File " & filePath & " does not exist."
    else
        cmd = "%COMSPEC% /C Echo Y| copy " & """" & filePath & """" & " c:\temp\debug1.txt"
        msgbox cmd
        Set objScriptExec = objShell.Exec(cmd)
        msgbox objScriptExec.Status
    end if

    ---------------------------------------------------------------------------------------------

    Regards,
    Ravi
    Thursday, July 3, 2008 3:22 PM

All replies

  • Hi,
    Some more details -
    I have created follwoing records

    Binary Table
            Name - TestVbs
            Data - File stream (Referencing above mentioned vbs file)
    Custom Action Table
            Action - RunTestVbs
            Type - 6
            Source - TestVbs
    InstallExecuteSequence
            Action - RunTestVbs
            Condition - NOT Installed
            Sequence - 6500


    Regards,
    Ravi
    Thursday, July 3, 2008 3:59 PM
  • Hi,
    I have changed following things in MSI and now I can manage execute my VBScript after installation files are copied to TARGETDIR location.

    Binary Table
            Name - TestVbs
            Data - File stream (Referencing above mentioned vbs file)
    Custom Action Table
            Action - RunTestVbs
            Type - 1030 (I am not sure what it means. I found this value from some internet post.)
            Source - TestVbs
    InstallExecuteSequence
            Action - RunTestVbs
            Condition - NOT Installed
            Sequence - 5999

    Now I have different problem that i am unable to read TARGETDIR property inside VBScript.

    I have tried to use Session.Property("[TARGETDIR]") and Session.Property("TARGETDIR") and Session.TargetPath("TARGETDIR").

    Last one <
    Session.TargetPath("TARGETDIR")> fails with error - Custom action RunTestVbs script error -2147467259, Msi API Error: TargetPath,Folder Line 22, Column 1,


    Any clue how i can read TARGETDIR in VBScript?

    My MSI package is built with .Net 2003. I do not have source code available. I am trying to modify it using ORCA to introduce this custom action using VBScript.

    Although i said in my first post that I want to copy files, my final goal is to assign ACLs to some files copied by installer.

    As first step i am trying to access files installed by installer in VBScript. Later I am planning to use "cacls" utility to assignrequired  ACLs to specific user.


    Regards,
    Ravi

    Friday, July 4, 2008 8:39 AM
  • You should not need to use Orca to change any of this. You just need an install custom action, the vbscript. Then set the CustomActionData property in the setup project for this custom action to be [TARGETDIR]. Then, in your vbscript use sessionproperty("CustomActionData") to get the value.

     

    Monday, July 7, 2008 8:25 PM