5 Replies Latest reply on Jul 28, 2006 8:31 AM by Datredigital

    CD Program Expiration

    Datredigital Level 1
      Hi all,
      I'm looking for a Lingo script or behavior or Xtra that will let me tell my CD program to stop playing after a certain date. I've seen one script which tells the program to expire after 30 or 60 days, but the client wants to prevent playback of a given video in my Director program by a particular date, say September 1 2006. Has anyone tried this before? I think I can do this by using the viewer's computer date/time, but I'm not sure of the script to use or where to put it in the Director project. Any suggestions welcomed.
        • 1. Re: CD Program Expiration
          Level 7
          The systemDate command will tell you what the computer thinks the date is.

          put the systemDate
          -- date( 2006, 7, 28 )

          put the systemDate>date(2006,9,1) --that is the date of Sept 1,2006
          -- 0

          Thus, in your startMovie handler, you can put something like this:

          if the systemDate>date(2006,9,1) then halt

          and then the program will stop running on that date (actually on the day
          after... you can change the > to >= if you don't want it to run on the 1st)

          Bear in mind of course that merely changing the date on your computer
          will "beat" this protection scheme.
          • 2. Re: CD Program Expiration
            Level 7

            Ah, now that I reread your question, it is to block the paying of a
            video after a date, not make the projector stop. In that case, wherever
            you have the code for the playing of the video, add the date check there

            basically

            if the systemDate<date(2006,9,1) then
            --play the video
            else
            alert "Sorry the time limit has expired"
            end if
            • 3. Re: CD Program Expiration
              Datredigital Level 1
              Sorry for my confusing post. Yes they want a video to stop playing within the projector on a given date, say Sept. 1. I inserted the code into the frame script that is controlling the video and I'm getting a Script error:
              Handler definition expected. if? the systemDate<date(2003,9,1)then

              I've been working in Director for ten years but must admit I'm awful with Lingo so I apologize if I've make a basic error. To me it looks like the Lingo is asking if the computer system date is less than 9/1/2006, then play the video, otherwise send an alert your time has expired.

              Am I missing something?
              • 4. Re: CD Program Expiration
                Level 7
                You need to put that script inside a handler, like 'on mouseUp me' or
                something. It depends how your program works. If you have for instance
                a button that you click in order to play the movie, then the button gets
                this script:

                on mouseUp me
                if the systemDate<date(2006,9,1) then
                --play the video
                else
                alert "Sorry the time limit has expired"
                end if
                end

                If you have it setup where the movie start automatically, then put this
                script on the movie sprite

                on beginSprite me
                if the systemDate<date(2006,9,1) then
                --play the video (if the movie starts on its own, you don't need
                anything here)
                else
                alert "Sorry the time limit has expired"
                go "someOtherFrame" --Change this to wherever you want to go
                end if
                end
                • 5. Re: CD Program Expiration
                  Datredigital Level 1
                  Thank you very much Mike it worked! I appreciate you taking the time to help me.
                  -Melissa