0

Is it possible to run an applescript ONLY if a specific input is inserted If I put in my attempts at the code i might be clearer at what Im getting at

set x to display dialog "What is your password?" default answer "" with hidden answer
set y to (text returned of x)


display dialog (text returned of x)
display dialog y

if (text returned of y) is 3232 then
  display dialog "Hi" buttons ["OK"]
end if

All the in-between stuff is just testing and making sure everything is working properly

1 Answer 1

2

First, you're trying to check against text returned of y, where y is text returned of x – a string, not a dialog result so text returned of y won't work. Just use y.

Second, you need to be testing your string stored in y against another string, not a number. Wrap 3232 in quotes:

set x to display dialog "What is your password?" default answer "" with hidden answer
set y to (text returned of x)


display dialog (text returned of x)
display dialog y

if y is "3232" then
  display dialog "Hi" buttons ["OK"]
end if

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .