Graphics

 View Only
  • 1.  Clock Widget - Up and Down

    Posted 02-28-2017 17:47
    I'm working with a Timer Widget that needs to be able to count both up and down. I figured out part of the script to change the clock's direction (clock.direction = 0 or 1). It looks like when the clock is counting up, it's fine. When I reverse it's direction it resets to 0:00 - I want it to count down from where the clock was last stopped.

    Do I need to copy/set the clock time before resuming the clock? When I had the clock resume counting up, it picked up where it left off.

    Or do I need to have 2 clocks to accomplish this? And can I copy one clock's value to another?


  • 2.  RE: Clock Widget - Up and Down

    Posted 02-28-2017 20:23
    You can get the current timer value using the "TimerValue" property and you can set it that way as well.
    Here is a script that starts counting up, and one that starts counting down..
    I attached these to two keyboard macros and can toggle between Up/Down with them.


    dim wid as xpClockTimerWidget
    dim val as long
    engine.GetWidgetByName("ClockTimer2", wid)
    wid.Stop
    val = wid.TimerValue
    wid.Direction = ClockTimerDirection.ctd_Up
    wid.TimerValue = val
    wid.Start



    dim wid as xpClockTimerWidget
    dim val as long
    engine.GetWidgetByName("ClockTimer2", wid)
    wid.Stop
    val = wid.TimerValue
    wid.Direction = ClockTimerDirection.ctd_Down
    wid.TimerValue = val
    wid.Start

    #XPression


  • 3.  RE: Clock Widget - Up and Down

    Posted 03-01-2017 17:50
    Makes perfect sense... thanks Brian!
    #XPression