I’ve been working on some steppers to set time values, but I’m hung up on AM/PM.
My stepper is set to a value of 0 and 1, but doesn’t produce anything in the text field, no error, either!
if name of theObject is "ampmstepper" then
set theStepperValue to ((contents of stepper "minStepper" of tab view item "auto" of tab view "tabs" of window "Mocktail") as integer)
set contents of text field "ampm" of tab view item "auto" of tab view "tabs" of window "Mocktail" to ""
if theStepperValue is equal to "1" then
set contents of text field "ampm" of tab view item "auto" of tab view "tabs" of window "Mocktail" to "am"
else if theStepperValue is equal to "0" then
set contents of text field "ampm" of tab view item "auto" of tab view "tabs" of window "Mocktail" to "pm"
end if
set ampmvalue to theStepperValue
end if
As a side note, you might be able to shorten your code if all of your controls are in the same view:
if name of theObject is "ampmstepper" then
set theStepperValue to (contents of stepper "minStepper" of theObject's super view) as integer
set contents of text field "ampm" of theObject's super view to ""
if theStepperValue = 1 then
set contents of text field "ampm" of theObject's super view to "am"
else if theStepperValue = 0 then
set contents of text field "ampm" of theObject's super view to "pm"
end if
set ampmvalue to theStepperValue
end if
Yes, this could indeed save me a lot of extra code! Thanks very very much. One question, is the “super view” reference Pather and Jaguar safe, or is it a more recent addition to ASS?