
I want to make a countdown from 60 to 0, and I want to make it visual with a progress bar. Can you help me?
Greetings from Mexico,
Alfredo Mora Izaguirre
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller


Code: Select all
on mouseUp
  repeat with i = 0 to 59
    set the thumbPosition of scrollbar "MyProgressBar" to i
    put (60 - i) && "seconds left"
    wait 1 second
  end repeat
  set the thumbPosition of scrollbar "MyProgressBar" to 60
  answer "Your minute is up!"
end mouseUpCode: Select all
wait 1 secondCode: Select all
wait 1 second with messagesCode: Select all
on mouseUp
  send "CancelCountdown" to button "Countdown"
end mouseUpCode: Select all
on mouseUp
  set the uStatus of me to "started"
  repeat with i = 0 to 59
    set the thumbPosition of scrollbar "MyProgressBar" to i
    put (60 - i) && "seconds left"
    wait 1 second with messages
    if the uStatus of me is "cancelled" then
      put "Cancel was clicked!"
      exit mouseUp
    end if
  end repeat
  set the thumbPosition of scrollbar "MyProgressBar" to 60
  put "Your minute is up!"
end mouseUp
on CancelCountdown
  set the uStatus of me to "cancelled"
end CancelCountdown
Code: Select all
        repeat with i = 0 to 10
             put (10 - i) && "seconds left"
             -- set the label of button "timerButton" to (10 - i)
             wait 1 second with messages
        end repeat
I test your script (LC 5.5.4) and it works. I can see the label change and i & "seconds left" in the messageboxit refreshes the message box only when I comment the line which changes the label of a button