Indigo Rose Software

Professional Software Development Tools

 
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Jul 2006
    Posts
    57

    Working with dates

    Hi. I'm currently working on on particular project and i'm stuck in what i'll tell you right now.

    I'd like to get my system date and if the date correspond to a particular date, show the corresponding page.

    For exemple:

    I'd like the page "love" to show on the 15 of august. Then, it continues.. The page "Work" would show on the 16 of august... so on.

    How can i do that ?

    Thanks!

  2. #2
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Put these on the page you want to start with:

    Code:
    On Preload
    
    Page.StartTimer(1000)
    
    On Timer
    
    -- Date is in the form of MM/DD/YYYY
    strDate = System.GetDate(DATE_FMT_US)
    
    -- Change the date (keep the double-quotes) to what you need
    if strDate == "07/28/2006" then
    	Page.Jump("Page2")
    end
    Intrigued

  3. #3
    Join Date
    Jul 2006
    Posts
    57
    That was fast ! Thanks Intrigued.

    Can i ask you what is the timer for ?

    I'll try this tomorow morning right after wake up !

  4. #4
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    When thinking of timers remember that in AMS (and other programming languages for that matter) 1000ms (milliseconds) equals 1 second.

    I turned the timer on with the Page.StartTimer() Action and as an argument I put 1000ms (1 second). Then in the On Timer anything in that page will "fire" (take place) each second.

    Just remember to set the Page.StartTimer() (can turn it off with Page.StopTimer() by the way) outside of the On Timer event area.

    This is a good way to have Actions happen at predetermined time intervals.

    Becareful when using the On Timer area. Sometimes it's better to place code differently. For example, instead of setting up a time and guessing when a Webpage would load in a Web Object and then have some Action(s) take place. It would be better to use the Web Objects On Load for such. Thus when the Webpage loads fully, then and only then will those Actions take place.

    I hope this helps explain such a bit better.
    Intrigued

  5. #5
    Join Date
    Jul 2006
    Posts
    57
    Thas does explain a little more yes. I'm not a programmer and the knowlodge i get from programming is gain through AMS. Thanks for your time !

    If i may, i'd like to ask you another question... Could it be possible to only use days and months, excluding the years ?

  6. #6
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    If you'd read the help file, you'd see that you can use various arguments for your date:

    DATE_FMT_US
    0
    North American (MM/DD/YYYY)

    DATE_FMT_EUROPE
    1
    European (DD/MM/YYYY)

    DATE_FMT_ISO
    2
    ISO Date (YYYY-MM-DD)

    DATE_FMT_JULIAN
    3
    Julian Date (an integer value representing the number of days since midnight on January 1, 4713 B.C.)

    DATE_FMT_MONTH
    4
    Month (MM)

    DATE_FMT_DAY
    5
    Day (DD)

    DATE_FMT_YEAR
    6
    Year (YYYY)

    DATE_FMT_DAYOFWEEK
    7
    Day of the week (1-7)

    Yossi

  7. #7
    Join Date
    Jul 2006
    Posts
    57
    Thank you Yosik, but i'v already read the help file and it seems that i can't have a month and day format only. It's either the month or the day, but not both. My question is : is it possible to do what i want with those two separated formats ?

  8. #8
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    Yes it is. You just have to concatenate the two:
    System.GetDate(DATE_FMT_DAY)..System.GetDate(DATE_ FMT_MONTH)
    (you can add anything in between, before or after).

    Good luck

    Yossi

  9. #9
    Join Date
    Jul 2006
    Posts
    57
    Ok ! I'll try this ! Thanks for your help !

  10. #10
    Join Date
    Jul 2006
    Posts
    57
    That's working great !

    I have a last request to ask you, if you don't mind. I'd like to know how to show a particular page during a range of dates. For exemple, i'd like to show the page love during month 05 day 01 to month 05 day 06.

    I tried the "or" but it doesn't work well. I'm sure there is a better way to work this out.

    Thanks again for your time and help.

  11. #11
    Join Date
    Jul 2006
    Posts
    57
    Ok i just found it... but i'd like to know what you would've done !

    I did : if nombre >= 0321 and nombre <= 0325 then
    Page.Jump ..........

  12. #12
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Take at look over at lua.org for findpattern() (all lower-case)

    Here is a link to get you to what you need:

    http://lua-users.org/wiki/PatternsTutorial
    Last edited by Intrigued; 07-29-2006 at 11:20 PM.
    Intrigued

  13. #13
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Looks like AMS 6 does not support findpattern(). Sorry there. I'll add it to the suggestion box for the next version.
    Intrigued

  14. #14
    Join Date
    Jul 2006
    Posts
    57
    I guess that luapattern is a way to search for a string right ?

    Last night, i forgot to tell you that i used the String.ToNumber function so i could work with numbers instead of strings.

    Thanks for your help anyway Intrigued.

  15. #15
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Np. I went ahead and put this suggestion (findpattern()) in the Suggestion forum nontheless.

    Intrigued

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Working with Tables and Files
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 12-23-2003, 08:22 AM
  2. The ? char code is not working
    By Marker0077 in forum Setup Factory 6.0
    Replies: 7
    Last Post: 06-21-2003, 04:04 PM
  3. Set working directory
    By imanta in forum Setup Factory 6.0
    Replies: 1
    Last Post: 05-16-2003, 12:39 PM
  4. Could someone explain FILE > EXECUTE > working directory
    By Corey in forum AutoPlay Media Studio 4.0
    Replies: 1
    Last Post: 12-12-2002, 09:13 AM
  5. Created, Modified, Accessed Dates
    By AdamW in forum Setup Factory 6.0
    Replies: 0
    Last Post: 10-10-2002, 08:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts