DateAdd returns a date, Session.Property must take a string, hence the type 
mismatch error you were likely receiving.

Try this instead... Use FormatDateTime to convert your date object...

    <CustomAction Id="CalcOldDate" Script="vbscript">
      SUB CalcMigratorDate
      Session.Property("OLDDATE") = 
FormatDateTime(DateAdd("d",-30,DateValue(Now)))
      End SUB
      call CalcMigratorDate
    </CustomAction>


<Standard disclaimer regarding script CAs goes here, though I didn't realize 
WiX made them so darn easy to add/use!/>


-----Original Message-----
From: Reddy, Mallikarjun (GWM-CAI) [mailto:mallikarjun_re...@ml.com] 
Sent: Tuesday, February 24, 2009 12:44 PM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Date calculations

Hello, 

In a custom action, I am going to run an exe with args. One of the args
is a date that is 30 days older than today. Could some let me know how
this could be done? 

Here is how I am trying to solve this.

Create a property calle "OLDDATE"
Create a custom action that has vbscript which runs before the above the
exe's custom action. 
My VBScript custom action looks like this. This is throwing an error. I
tried without set. No luck. Any way of fixing this and any other smart
of doing this ? Thanks in Advance 

<CustomAction Id="CalcOldDate" Script="vbscript">
      SUB CalcMigratorDate()      
       set Session.Property("OLDDATE") = DateAdd("d",-30,DateValue(Now))
      End SUB
      call CalcMigratorDate
    </CustomAction>

--------------------------------------------------------------------------
This message w/attachments (message) may be privileged, confidential or 
proprietary, and if you are not an intended recipient, please notify the 
sender, do not use or share it and delete it. Unless specifically indicated, 
this message is not an offer to sell or a solicitation of any investment 
products or other financial product or service, an official confirmation of any 
transaction, or an official statement of Merrill Lynch. Subject to applicable 
law, Merrill Lynch may monitor, review and retain e-communications (EC) 
traveling through its networks/systems. The laws of the country of each 
sender/recipient may impact the handling of EC, and EC may be archived, 
supervised and produced in countries other than the country in which you are 
located. This message cannot be guaranteed to be secure or error-free. 
References to "Merrill Lynch" are references to any company in the Merrill 
Lynch & Co., Inc. group of companies, which are wholly-owned by Bank of America 
Corporation. Secur
 ities and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed 
* May Lose Value * Are Not a Bank Deposit * Are Not a Condition to Any Banking 
Service or Activity * Are Not Insured by Any Federal Government Agency. 
Attachments that are part of this E-communication may have additional important 
disclosures and disclaimers, which you should read. This message is subject to 
terms available at the following link: 
http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you 
consent to the foregoing.
--------------------------------------------------------------------------
 

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to