Jump to content

Refreshing A Text Box


Recommended Posts

Here's one way to stroke the cat .. :whistle:

One script is the main one, where you prompt for the user to input an override time. This script also launches a Big Brother to watch it .. and update the current time that it displays in the prompt dialog.

Just the geenral concept here - you can pretty it up with logic to close down the watcher etc B)

MAIN APP

;This app gets the user to input a time override
;.. while displaying the current time that gets updated 
;by the WatchMe process

   ;Launch the watcher
    Run(@COMSPEC & " /c START D:\AU3_Functions\Trids\ScrapPad\WatchMe.AU3","",@SW_HIDE)
    Sleep(1000)
    
   ;Get the user to input a value that the watcher can override
    $sUserTime = InputBox("Override Current Time - " & @HOUR & ":" & @MIN & ":" & @SEC, "New Value:")
    if @Error then
       ;Pressed cancel, so don't override
        Msgbox(4096, "Time setting", "No change from current time")
    else
       ;Apply new time
        Msgbox(4096, "Time setting", "Now you just need to parse this from HH:MM:SS .." & @LF & $sUserTime)
    Endif

    
EXIT

WATCHER APP - called "WatchMe.AU3"

;WatchMe.AU3
; 
;This applet watches and updates the Me.AU3 app
;for it's prompt of a time from the user.
;
    
    $sTitle = "Override Current Time - "

    While 1
        If WinExists($sTitle) then
           ;update with the current time
            WinSetTitle($sTitle, "", $sTitle & @HOUR & ":" & @MIN & ":" & @SEC)
        Endif
        Sleep(300)
    Wend
Link to comment
Share on other sites

I did something similar with SplashTextOn()

You can also make sure that your timing is always accurate when the computer slows down during a CPU intensive operation when you assign a variable to the current seconds and do a do...until loop like this

while 1 ; Do an infinite loop

$currenttime = @sec ; Set the current value of seconds to $currenttime

do ; Initiate a do...until loop

sleep(20) ; Wait 20ms over and over until...

until $currenttime <> @sec ; ...the $currenttime var. is NOT longer equal with the current second

SPlashTextOn("My Timer", "The current time is: "& @hour &":"& @min &":"& @sec &"") ; Then display a new SplashText

wend ; End of loop

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...