Clock

Discussion in 'Perl Misc' started by TheOrangeRemix, Jul 20, 2006.

  1. Hi,

    I would like to set up a script that includes a Windows API interface
    of a pop-up that displays a changeable date and time. Whatever date and
    time is set, the program will input that data into a time array.

    For example, I if I run the program, set today's date and time on the
    interface: July 20, 2006 10:40 AM, it will output the result into an
    array like this:

    @runtime = (0, 40, 10, 20, 6, 2006); ### (seconds, minutes, hours, day,
    month (-1), year)

    I guess there are two questions involved: how do I call the described
    API and how does it get placed into an array for processing?
     
    TheOrangeRemix, Jul 20, 2006
    #1
    1. Advertising

  2. TheOrangeRemix

    Guest

    TheOrangeRemix wrote:
    > For example, I if I run the program, set today's date and time on the
    > interface: July 20, 2006 10:40 AM, it will output the result into an
    > array like this:
    >
    > @runtime = (0, 40, 10, 20, 6, 2006); ### (seconds, minutes, hours, day,
    >
    > I guess there are two questions involved: how do I call the described
    > API and how does it get placed into an array for processing?


    You can use a module like Date::Manip to convert the man-readable date
    to something your system can understand. Date::Manip can also provide
    the info for the array, or you could use Perl's own gmtime/localtime
    function (which outputs in array form if called in array context - you
    just use a [0-5] slice to get what you want in @runtime).

    --
    David Filmer (http://DavidFilmer.com)
     
    , Jul 20, 2006
    #2
    1. Advertising

  3. TheOrangeRemix

    Ben Morrow Guest

    Quoth "TheOrangeRemix" <>:
    > Hi,
    >
    > I would like to set up a script that includes a Windows API interface
    > of a pop-up that displays a changeable date and time. Whatever date and
    > time is set, the program will input that data into a time array.
    >
    > For example, I if I run the program, set today's date and time on the
    > interface: July 20, 2006 10:40 AM, it will output the result into an
    > array like this:
    >
    > @runtime = (0, 40, 10, 20, 6, 2006); ### (seconds, minutes, hours, day,
    > month (-1), year)
    >
    > I guess there are two questions involved: how do I call the described
    > API and how does it get placed into an array for processing?


    Win32::GUI is the literal answer to your question. It hides very little
    of the Win32 API though, so it may be rather hard to use.

    I quite liked Win32::GUI::XMLBuilder when I was playing with it, but I
    didn't try to do anything serious.

    Tk used to be the standard GUI toolkit for Perl, but it seems to be
    looked-down-upon nowadays.

    Wx is what most people would recommend now, though as I understand it
    the Perl documentation is somewhat poor, and you have to use the C++
    docs.

    TMTOWTDI :)

    Ben

    --
    I touch the fire and it freezes me, []
    I look into it and it's black.
    Why can't I feel? My skin should crack and peel---
    I want the fire back... Buffy, 'Once More With Feeling'
     
    Ben Morrow, Jul 21, 2006
    #3
  4. TheOrangeRemix

    Sisyphus Guest

    "TheOrangeRemix" <> wrote in message
    news:...
    > Hi,
    >
    > I would like to set up a script that includes a Windows API interface
    > of a pop-up that displays a changeable date and time. Whatever date and
    > time is set, the program will input that data into a time array.
    >
    > For example, I if I run the program, set today's date and time on the
    > interface: July 20, 2006 10:40 AM, it will output the result into an
    > array like this:
    >
    > @runtime = (0, 40, 10, 20, 6, 2006); ### (seconds, minutes, hours, day,
    > month (-1), year)
    >
    > I guess there are two questions involved: how do I call the described
    > API and how does it get placed into an array for processing?
    >


    David has given you advice on how to manipulate the date.

    I don't quite follow the Windows API requirements, but if you are wanting to
    create a message box pop-up on Windows you can do so with the
    Win32::MsgBox() function:

    use warnings;
    use Win32;

    my $message = "wow!!";
    Win32::MsgBox($message);
    __END__

    But if you need your perl script to read in the info from a pop-up .... then
    that's not so straightforward. If that's the case, let us know, and someone
    (probably not me :) might be able to help out.

    Cheers,
    Rob
     
    Sisyphus, Jul 21, 2006
    #4
  5. Thank you all for the suggestions. What I am looking for is a Windows
    API that displays a editable clock and whatever the user inputs will be
    read into the script and processed in an array.
    Is there a function or a set of functions that I can use to accomplish
    these two tasks?
     
    TheOrangeRemix, Jul 21, 2006
    #5
  6. TheOrangeRemix

    Ben Morrow Guest

    Quoth "TheOrangeRemix" <>:
    > Thank you all for the suggestions. What I am looking for is a Windows
    > API that displays a editable clock and whatever the user inputs will be
    > read into the script and processed in an array.


    AFAIK windows doesn't provide such a control. You could build one
    yourself, using one of the toolkits I mentioned; or you could see if you
    can find an ActiveX control that does what you want (though this may be
    a lot of pain :) ).

    Ben

    --
    Joy and Woe are woven fine,
    A Clothing for the Soul divine William Blake
    Under every grief and pine 'Auguries of Innocence'
    Runs a joy with silken twine.
     
    Ben Morrow, Jul 21, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Valentin Tihomirov

    Are clock and divided clock synchronous?

    Valentin Tihomirov, Oct 23, 2003, in forum: VHDL
    Replies:
    11
    Views:
    3,302
    louis lin
    Oct 28, 2003
  2. Replies:
    4
    Views:
    726
    Peter Alfke
    Apr 27, 2006
  3. Replies:
    5
    Views:
    2,176
    Ricardo
    Jun 23, 2006
  4. himassk
    Replies:
    1
    Views:
    1,236
    Paul Uiterlinden
    May 16, 2007
  5. pankaj.goel
    Replies:
    6
    Views:
    942
    pankaj.goel
    Nov 25, 2008
Loading...

Share This Page