Re: Display Dialog Text
Re: Display Dialog Text
- Subject: Re: Display Dialog Text
- From: kai <email@hidden>
- Date: Sat, 15 Nov 2003 14:51:42 +0000
on Fri, 14 Nov 2003 20:02:19 -0800, Domains4Days wrote:
>
For some reason the display dialog command (listed below) only seems to
>
store about a paragraph worth of text - the rest gets cut-off.
I expect the reason is that dialogs are generally intended to handle only
relatively short strings, rather than act as some kind of word processor.
The limit handled by dialogs is normally 255 characters - so anything longer
usually gets truncated to that.
>
Question: what is the best way to display a dialog and allow someone to
>
paste in lots of text ( maybe several pages worth), and then transfer the
>
entire contents to a variable?
>
>
Thanks in advance - RevDave
>
>
-code start
>
>
set message_text to "Paste or Type Some Stuff"
>
display dialog "Enter the text" default answer message_text
>
copy the text returned of result as string to texttest
>
set the clipboard to "bub " & texttest
>
>
- code end
If we're ready to paste into a dialog, it means that some text has been
recently copied - and is therefore already on the clipboard. So we can
probably take advantage of that by modifying our approach slightly.
This may seem a trifle long-winded, but should perform roughly as you've
described:
-------------------------------
set c to the clipboard
set d to "Enter some new text"
if c's class is string then
set t to c
set d to d & " - or use all copied text..."
else
set t to "New text here..."
end if
set t to (display dialog d default answer t)'s text returned
if t is "" then return -- nothing to copy
if c starts with t then set t to c
tell "bub" to if t does not start with it then
if t starts with space then
set t to it & t
else
set t to it & space & t
end if
end if
set the clipboard to t
-- do something with the clipboard's contents
-------------------------------
---
kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.