samrockw22
samrockw22

Reputation: 59

how do you make something happen if a button is pressed in applescript

I am trying to make an app in applescript where if you try to turn the volume down the volume is set to 16. I am still a beginner and i was wondering if there is a 'if buttonpress' sort of command. Thanks!

Upvotes: 0

Views: 1741

Answers (1)

William T Froggard
William T Froggard

Reputation: 738

Assuming I'm understanding you, this is the basic idea:

set button_returned to button returned of (display dialog "hi")

if button_returned is "OK" then
    #do something
end if

You put up a dialog, then check for the name of the button clicked, and if the name matches whichever button you're checking for, then "do something".

Upvotes: 2

Related Questions