in

Quark Forums

Create a Digital Clock with 4 actions in QuID

Last post 11-14-2007 6:21 AM by Kabir(Quark). 18 replies.
Page 1 of 2 (19 items) 1 2 Next >
Sort Posts: Previous Next
  • 08-13-2007 6:09 AM

    Create a Digital Clock with 4 actions in QuID

    Hi

    In this exercise we will create a digital clock using just 4 actions. This exercise will also help explore some lesser used actions in QuiD.

    Steps
    -----

    1) Create a text box and make it a textbox object , call it "clock"
    2)Create a new script and add the following actions to it

    (i) Apply the Expression set action and type the expression below-
    Clock.Append(Date.GetHours() + ":" + Date.GetMinutes() + ":" + Date.GetSeconds())

    The Append() function is used to put some text in a text box object e.g. Clock.Append("The time is") would put the text within quotes in the text box named clock

    The function Date.GetHours() returns the hour as apecified by the system time. e.g. if the time is 11:33 , this function will return 11

    The function Date.GetMinutes() returns the minute as apecified by the system time. e.g. if the time is 11:33 , this function will return 33

    The function Date.GetSeconds() returns the second as apecified by the system time.

    The + operator serves as a concatenation operator that just joins the various strings togther , here it is used to join the values returned by these functions with a semi colon ":"

    (ii) Apply Action Other->Delay and give a delay of 1 second

    This is done to update the clock every 1 second as we will add a run script action to make this script run in an endless loop

    (iii) Apply action Object-> Reset to the text box object "clock

    This is done to clear the content of the text box every 1 second so that the new current time can be displayed in it

    (iv) Apply Action Script run -> Script 1 (Where Script1 is the current script that you are creating)

    This is done so that this script plays in an endless loop every 1 second

    3)Now , all you have to do is use this script as the page entry script and you have a working digital clock using just 4 simple actions.


    Hope you enjoy this.


    Regards,
    Kabir
    Filed under:
  • 08-16-2007 3:38 PM In reply to

    Create a Digital Clock with 4 actions in QuID

    Kabir,

    I would like also to play a sound each hour, how is it possible to make the expression break if minute=0 and second =0, i have tried with no success and as i have to wait each hour to test it, its a bit long to use my trial and error way :wink:
    thanks again
    jacques
    http://www.parcequelecielestbleu.com
  • 08-16-2007 3:57 PM In reply to

    Create a Digital Clock with 4 actions in QuID

    Kabir,
    second question for the cuckoo clock, i tried to put in a second text box the date day and month, it works but how do i tell QID that 0 is "monday" 1 is "mardi" on so on? same for the months of course, i also tried the date to string expression by lazyness but it displays in english and i would like to display in french and without the hours of course
    regards
    jacques
    http://www.parcequelecielestbleu.com
  • 08-16-2007 8:07 PM In reply to

    Create a Digital Clock with 4 actions in QuID

    third question more cosmetic but useful to understand, when it's 22:02:00 my QID clock says 22:2:0 which is'nt very nice how do i get rid of this?
    by the way i discover a strange apple thing, i have 10.4.10 installed but when using the function get OS info in QID it reports 10.4.9 funny no! so i think they forget to rename the update internally
    http://www.parcequelecielestbleu.com
  • 08-17-2007 7:01 AM In reply to

    Create a Digital Clock with 4 actions in QuID

    Hi Jacques

    To make the clock play a sound every hour you will need to add the following actions just before the last action (i.e. the run script action)

    1) Apply the Control If action and select Expression from the object type field.

    In the expression field type -
    Date.GetMinutes()==0 && Date.GetSeconds()==0

    this statement checks when the minute and second are zero i.e. every new hour

    2)Now you can add the play sound action

    3) Close the If condition using Control -> End if action

    Now , this condition will check every second if the minute and second values are zero and play a sound every hour.

    --------------------------------------------------------------------

    As for the days and months , we would need to craete a script with multiple If conditions e.f. 7 conditions for the day of the week and 12 conditions for the month of teh year. This is what the script would look like:

    1) Add a control -> if condition
    2)Choose expression from the drop down and type the expression
    Date.GetDay()==0
    add another action after this and choose Expression -> set
    TextBox2.Append("Sunday")
    3)Close this if condition using Control -> End if action

    Now simply duplicate these 3 actions (6 times) using the duplicate action button and make slight modifications for the rest of the days and you are done.

    You will have 7 closed if conditions.

    Please note that you would need to loop this script like the "clock" script by giving it a delay and adding the last action as run script that calls this script again. So after the last if end if condition add Delay action (300 s) and script run-> Script 2

    --------------------------------------------------------------------

    As for the third question , I am afraid I cant give you a work around to solve this but this is something we might want to fix in an upcoming release.

    I havent checked the getOS function but if thst the case you just might have found an Apple or a Flash bug :wink:

    Hope this helps.

    Regards,
    Kabir
  • 08-17-2007 8:17 AM In reply to

    Create a Digital Clock with 4 actions in QuID

    Hi, Jacques,

    Kabir(Quark):
    As for the third question , I am afraid I cant give you a work around to solve this but this is something we might want to fix in an upcoming release.

    And of course you can "fix" it yourself, using expressions to calculate that yourself.

    However, soon this will get into a coding lesson, not really what you probably want to do. If still, here's how:

    (assuming your text box is called Clock)

    If Date.GetMinutes()<10
    Clock.Append("0")
    endif
    Clock.Append(Date.GetMinutes())

    You need to repeat that for hours and seconds too.

    YOu can also construct that using variables, however you will loose the ability to do that in one statement. Construct them bit by bit using "IF hours <10 ClockString = "0"+Hours Else ClockString + Hours" and then the same for minutes and seconds.

    Whether that's the best use case for Quark Interactive Designer, I doubt it. Maybe get an SWF downloaded where somebody already created this and just load it into an SWF object in Interactive.

    Best
    Matthias
    Matthias Günther
    Senior Product Manager
    Quark Software Inc.

    (Please note: As I am traveling frequently, answering your post might sometimes take longer)


    Want to easily publish for the iPad, using high-fidelity designs with stunning interactivity? See here:
    English: http://youtu.be/Gldk5lvXXTA
    French: http://youtu.be/nsgB4Q7lQzg
    German: http://youtu.be/lecdenqaUGY
    Italian: http://youtu.be/wjBpYZsF-8s


    Need help? Contact Quark's support: http://support.quark.com/contact_us.html


    Please don't install the newest update 10.7.3 of Mac OS X Lion yet.
    For details please see here: http://goo.gl/AzKeR

  • 08-17-2007 10:05 AM In reply to

    Create a Digital Clock with 4 actions in QuID

    Thanks Kabir and Matthias for your wises answers, i'm gonna try it this afternoon, i already add a new feature to my clock, it displays screen resolution of the viewer!, in fact the expression editor is incredibly powerful for a newbie, it makes me believing i can "code" things! great
    best regards
    jacques
    http://www.parcequelecielestbleu.com
  • 08-20-2007 2:32 PM In reply to

    Create a Digital Clock with 4 actions in QuID

    but as usual thanks again matthias & kabir, now my clock displays correctly the hours minutes and seconds ! it also beeps every hour and shows day and month by clicking the hour, i know it's a bit silly but i am quite happy with this nonsense clock
    by the way very slignt bug for frenchies the expression editor does'nt accept words accented even with"" just like "février"

    best regards
    jacques
    http://www.parcequelecielestbleu.com
  • 08-20-2007 8:21 PM In reply to

    Create a Digital Clock with 4 actions in QuID

    Good afternoon gentlemen,
    Thank you for this interesting idea. I have done the script and have had it play successfully in the ID page that I created it on.
    Do I need to do something when I save the SWF to have it play when I place it into the project's web page? I tend to create stand-alone swfs so I can add them to my web pages as needed. But this one doesn't seem to play.
    Any help will be appreciated. I'm not a programmer (I was put on earth to run them) so this is all new to me.
    Kathy A.

    http://www.mgtparty.org/
    All Quark designed web site. Look for the blank red box in lower left corner, this is where the clock should be.
  • 08-21-2007 5:35 AM In reply to

    Create a Digital Clock with 4 actions in QuID

    Hi Kathy

    After saving the swf file , you need to use it in the web layout using get picture command. I see you have done this but I think the box is too small as compared to the size of your swf. For the swf to work properly on the web page you need to right click on the picture box and do a "Fit Box to Picture"
    If this is not done then only a snapshot of your swf is exported with the web page. Doing this ensures that your swf is exported and will play on export.

    Note: Make sure you do not make any other change to this picture box e.g. change its shape , size , color , frame, etc

    If your swf's dimensions are too large I suggest changing the layout properties of your presentation layout to make it smaller and re-export it.

    Hope this helps.

    Regards,
    Kabir
  • 08-21-2007 12:05 PM In reply to

    Create a Digital Clock with 4 actions in QuID

    Hi Kabir,
    Thanks, that works. It's not the first time that I've been tripped up by the picture box size. I think I redid a whole presentation for this very same reason but got lucky the second time and had the box size correct. I'll make sure that I put this on my cheat sheet that I keep next to the system!

    Now for the next thought... is there any way to adapt this (or even a new script) to have QID create a page hit counter?
    My attempts at using the service providers plugin haven't been successful (probably because I don't understand the coding sequences) in getting a counter to appear on the page. I'd love to be able to do it with ID.

    Thanks again,
    Kathy
  • 08-21-2007 12:31 PM In reply to

    Create a Digital Clock with 4 actions in QuID

    Kabir,
    Maybe I spoke too soon...
    I previewed the page in Quark and the clock shows but after downloading the new html page to the server the clock doesn't play. Any other ideas?
    Kathy
  • 08-21-2007 1:05 PM In reply to

    Create a Digital Clock with 4 actions in QuID

    Hi Kathy

    Did you copy the corresponding "image" folder of the HTML page as well on the web server?

    This should hold the swf file for the clock.

    Regards,
    Kabir
  • 08-21-2007 2:53 PM In reply to

    Create a Digital Clock with 4 actions in QuID

    Hi Kabir,
    I redownloaded the index page and the clock and all is well. Thanks so much!
    Kathy
  • 11-05-2007 5:42 PM In reply to

    • chrisk
    • Top 500 Contributor
    • Joined on 06-06-2007
    • Kent, UK
    • Posts 37

    Create a Digital Clock with 4 actions in QuID

    Hi all,


    I seem to be strruggling with this.

    I’ve got the time and the date working fine.

    I’ve tried replacing with Monday, Tuesday etc as described earlier in this thread, but it seems to put it at the end of the string not replacing the specific bit.

    ie.

    1:10:2007Monday

    Any ideas

    All the best
    ChrisK
Page 1 of 2 (19 items) 1 2 Next >
Powered by Community Server (Commercial Edition), by Telligent Systems