Hi Alex,
Thank you very much for the help.

I have tried  the code you posted but got an error  stopped the MSI
installation:
"Error 1720. There is a problem with this Windows Installer package. A
script required for this install to complete could not be run. Contact your
support personnel or package vendor. Custom action IfFileExist script error
-2146827850, Microsoft VBScript runtime error: Object doesn't support this
property or method Line 4, Column 5  "

I have googled this error and someone suggested to reinstall the latest
Window Script Host and I've done that but still got the same error.
Then I digged out another post explaining the reason of this error but he
didn't say how to fix it and here is the link:
http://www.pcreview.co.uk/forums/thread-1544447.php.

Do you have any idea with this error 1720?


Regards,
Justin


Alexander Shevchuk wrote:
> 
> Hi Justin,
> Take a look at suggested sequences in the sequence tables
> (http://msdn2.microsoft.com/en-us/library/aa372404(VS.85).aspx).
> For your example important to understand the order of the following
> actions (this is recommended order):
> - Checking launch conditions (LaunchConditions action)
> - Application Search (AppSearch action)
> - File Costing (CostInitialize, FileCost, CostFinalize, and
> InstallValidate actions).
> 
> The fragment
> 
> <Property ...>
>   <DirectorySearch ...>
>     <FileSearch ... />
>   </DirectorySearch>
> </Property>
> 
> is an application search phase and it is happening before File costing. 
> During file costing three major operations are performed:
> - Feature conditions evaluated
> - Component conditions evaluated
> - Directory table is resolved (meaning that INSTALLLOCATION will get its
> final value)
> 
> As you can see, using [INSTALLLOCATION] in Application Search phase is
> wrong because this property may change its value during file costing. 
> That is why instead of AppSearch you need to use custom action to set the
> value of XMLFILEEXISTS.  Now, because you want to change the installation
> state of the feature, your custom action must be sequenced *before*
> InstallValidate.  My apologies to RW, my advise should've been *before*,
> not *after* InstallValidate.
> 
> Regarding custom action.  This code is wrong:
> 
>     <InstallExecuteSequence>
>       <Custom Action='ifFILEEXISTS' After='Installvalidate' />
>        XMLFILEEXISTS
>       </Custom>
> 
> You should not condition your custom action based on the value of
> XMLFILEEXISTS property.  Remove condition.
> You did not show how you set your custom action.  For samples, visit this
> page (http://www.wixwiki.com/index.php?title=Guide_to_CustomActions).
> 
> The simplest sample I can suggest is Type 54 (the better choice is using
> C++ dll).  Warning - not tested:
> 
> <Property Id="IfFileExistScript">
>   <![CDATA[
>   Sub Main()
>     Dim path, fso
>     path = Session.Property("INSTALLLOCATION")
>     fso = CreateObject("Scripting.FileSystemObject")
>     If (fso.FileExists(path & "abc.xml")) Then
>       Session.Property("XMLFILEEXISTS") = "1"
>     End If
>   End Sub
>   ]]>
> </Property>
> 
> <CustomAction Id="IfFileExist" VBScriptCall="Main"
> Property="IfFileExistScript" />
> 
> <InstallExecuteSequence>
>   <Custom Action="IfFileExist" Before"InstallValidate" />
> </InstallExecuteSequence>
> 
> 
> Regards,
> Alex
> 
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Justintu
> Sent: Sunday, March 02, 2008 4:14 AM
> To: wix-users@lists.sourceforge.net
> Subject: Re: [WiX-users] Condition based on INSTALLLOCATION
> 
> 
> Hi Alex,
> I am having exactly the same problem as RW had, trying to check if a file
> exists or not in the installation directory. I have tried to use custom
> action but failed and my code is something like this:
> <Property Id="XMLFILEEXISTS">
>       <DirectorySearch Id="CheckXMLFileDir" Path="[INSTALLLOCATION]"
> Depth="0">
>         <FileSearch Id="My.XML" Name=" My.XML" />
>       </DirectorySearch>
>     </Property>
> 
>     <InstallExecuteSequence>
>       <Custom Action='ifFILEEXISTS' After='Installvalidate' />
>        XMLFILEEXISTS
>       </Custom>
> 
>     </InstallExecuteSequence>
> 
>          <Feature Id="MyXML" Level="1" Title="My XML" Description="Select
> to
> permit installer to backup and replace your XML with a clean version.">
>           <ComponentRef Id="MyXMLFiles" />
>           <Condition Level='1000'>
>             XMLFILEEXISTS
>           </Condition>
>         </Feature>
> 
> 
> Are you able to provide a sample on how to do this?
> 
> Many thanks.
> 
> Justin
> 
> 
> Alexander Shevchuk wrote:
>>
>> You need to schedule custom action after InstallValidate to set the value
>> of the XMLFILEEXISTS property.
>>
>> Alex
>>
>>
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of RW
>> Sent: Friday, February 01, 2008 11:23 AM
>> To: wix-users@lists.sourceforge.net
>> Subject: [WiX-users] Condition based on INSTALLLOCATION
>>
>> Hi,
>>
>> I'm trying to turn on and off a feature based on whether a file already
>> exists in the installation directory.
>>
>> To do this, I'm setting a property based on a FileSearch:
>>
>>     <Property Id="XMLFILEEXISTS">
>>       <DirectorySearch Id="CheckXMLFileDir" Path="[INSTALLLOCATION]"
>> Depth="0">
>>         <FileSearch Id="My.XML" Name=" My.XML" />
>>       </DirectorySearch>
>>     </Property>
>>
>> Then, in the feature I have a level condition on it:
>>
>>         <Feature Id="MyXML" Level="1" Title="My XML" Description="Select
>> to
>> permit installer to backup and replace your XML with a clean version.">
>>           <ComponentRef Id="MyXMLFiles" />
>>           <Condition Level='1000'>
>>             XMLFILEEXISTS
>>           </Condition>
>>         </Feature>
>>
>>
>> However, this doesn't appear to work.  Looking in the log files, it
>> appears
>> that XMLFILEEXISTS is evaluated as part of the AppSearch, which happens
>> before the INSTALLLOCATION property is even set, therefore I'm not sure
>> where it's looking!
>>
>> I could be totally wrong of course... but in the log file, the
>> INSTALLLOCATION is set much later than any reference to My.XML.
>>
>> Any ideas on what the right way to do this is?
>>
>> Many thanks
>>
>> RW.
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> WiX-users mailing list
>> WiX-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> WiX-users mailing list
>> WiX-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
>>
> 
> --
> View this message in context:
> http://www.nabble.com/Condition-based-on-INSTALLLOCATION-tp15233800p15787100.html
> Sent from the wix-users mailing list archive at Nabble.com.
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Condition-based-on-INSTALLLOCATION-tp15233800p15912889.html
Sent from the wix-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to