Jump to content

Help with Applescript Dialogs


This topic is 8142 days old. Please don't post here. Open a new topic instead.

Recommended Posts

code:


display dialog "Please enter your password..." default answer "" default button "OK" giving up after 5

copy (dialog reply button returned) to v_button


I run the dialog and get an "Execution Error" message. It says "Cannot make some data into the expected type".

I am sure that I have some formatting errors, but I do not know what. Any suggestions?

Link to comment
Share on other sites

Kurt:

What are you trying to do here?

display dialog "Enter PW" default answer "" buttons {"OK"} default button 1

set v_button to button returned of result as string

display dialog v_button

will return and display the name of the button clicked

whereas

display dialog "Enter PW" default answer "" buttons {"OK"} default button 1

set pw_text to text returned of result as string

will capture what's entered in the text box

Old Advance Man

Link to comment
Share on other sites

Basically I am trying to do 2 things. One is to make sure that the user pressed the "OK" button and if so capture the text that they entered into the "Password" field.

I am sure that my process is correct, I am just having touble with the syntax. I'll try your suggested format and see what the results are.

Link to comment
Share on other sites

quote:

Basically I am trying to do 2 things. One is to make sure that the user pressed the "OK" button and if so capture the text that they entered into the "Password" field.


here a little solution.

set PWT to ""

set PW to {text returned:PWT, button returned:"", gave up:false}

repeat until (gave up of PW is true) or (text returned of PW is not PWT)

set PW to (display dialog "Enter PW" default answer "" buttons {"OK"} default button 1 giving up after 5)

end repeat

if gave up of PW is false then

-- something using (text returned of PW)

else

-- other thing

end if

Link to comment
Share on other sites

This topic is 8142 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.