How can I create a multiline text input dialog using Applescript? Creating a single line dialog is simple...
3 Answers
One workaround is to make the default answer include a linefeed, but it will also be included in the default answer:
display dialog "" default answer linefeed
CocoaDialog supports multi-line dialogs:
do shell script "/Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog \\
textbox --editable --title Title --button1 OK --button2 Cancel" without altering line endings
tell result
if item 1 is not "1" then return
set answer to text 3 thru -2
end tell
I couldn't get the text view to have focus when full keyboard access is enabled, even with ‑‑focus‑textbox
or --selected
.
Try application called Pashua. It's brilliant even for relative beginners and it's free.
I know how to create a simple log-in type of application in AppleScript Editor. So, you first go-to AppleScript Editor, then you type-in the code bellow, then click "Run"
tell application "Finder"
set passAns to "I'm not a spy, and I will always follow the rules"
if the text returned of (display dialog "Hello, welcome to this App!
Thank you, for visiting.
TO-DO:
Please look at the code a decide that you 'prove' that you are not a spy, and that you will always follow the rules. if you don't agree, type-in the code ''I don't agree''
Thank You!__________________________" & return & "" default answer "I'm not a spy, and I will always follow the rules" buttons {"Cancel", "I Prove-it and Continue…"} with icon stop with title "Application (Locked)" default button 2 with hidden answer) is passAns then
display dialog "Loged-in! Thank you!" buttons {"Okay"} default button 1
else
display dialog "Sorry if you don't aggre, you are not allowed to enter open this app. Please click ''Cancel'' to close, or if you still want to enter, just re-open this app.
________________________" buttons {"Okay, Cancel"} with icon stop with title "Application (Can't Open)" default button 1
end if
end tell