Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Making Install expire


5 replies to this topic

dkerwin

dkerwin
  • Members
  • 4 posts

Posted 04 December 2003 - 21:21

I'd like to make my installation 'expire', by which I mean if the user tries to run the install a year from the release date, I'd like it to tell them it's out of date, and they should get a new CD. The issue is how can I get a date value from the target machine that is useful in this calculation?

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 05 December 2003 - 08:24

You can try GetSystemInfo with DATE

dkerwin

dkerwin
  • Members
  • 4 posts

Posted 05 December 2003 - 15:18

Right - but that will return a date like 2-5-2004, and it isn't obvious to me how to compare that with the date I want it to expire (for example 12-4-2003). I could parse the numbers from the string, getting 1242003. I'd like to get a number value that always increases with the passage of time - a straight compare of the numbers won't work, because for example if I release the product on February 15, 2004, then I want it to expire on February 15, 2005 (2152005). the date Feb 14, 2005 (2142005) is less than the expiration date, so it would install, but the date December 15, 2004 (12152004) which should also install wouldn't because it is greater than the expiration date.
Something like the number of seconds elapsed since Jan 1, 1900 would work.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 05 December 2003 - 19:30

I don't think there such a value in InstallScript. You would have to prototype and call the appropriate WinAPI for this.

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 05 December 2003 - 20:32

I tried to do something similar in Installshield Developer 8. Installscript has very limited support for dates, you will have to do most of the work on your own.

On another note: I think Installscript has very poor support for quite a few things that should be frequently used. The most notable is the lack of certain String functions (replace etc...).
Regards
-Stein Åsmul

Ozone

Ozone
  • Full Members
  • 77 posts

Posted 08 December 2003 - 23:02

Do the GetSystemInfo with DATE as Stefan Krueger suggested
PLUS...
GetFileInfo( SRCDIR ^ "Data2.cab", FILE_DATE, nvResult, svResult );

Parse the Month - Date - Year strings to format as YYYYMMDD
Make sure that any Month or Date string is two characters ( 01 not 1)

Then compare dates......

I use the date attribute of Data2.cab in the code so I do not have
to remember to change any hard coded dates in the setup.rul file.

Yes, we have to do some coding to accomplish specific tasks.