Re: copy/paste fails
Re: copy/paste fails
- Subject: Re: copy/paste fails
- From: kai <email@hidden>
- Date: Fri, 28 Oct 2005 01:31:00 +0100
On 27 Oct 2005, at 16:14, Robert Poland wrote:
OS 10.4.2
This script now fails.
Window 1 is a recipe I copied off a web page. I tried to retype the
first line but it made no difference.
I see that the problem happens with other files that worked before.
Am looking for some new program that may have caused this.
I tried copy unstyled and paste unstyled, no change.
Is there some secret code imbedded in the file? ucode?
tell application "Tex-Edit Plus"
activate
set fileName to name of window 1
set w to window fileName
select paragraph 1 of w
set capitalization of selection to word caps
copy
set newName to clipboard
end tell
newName
--> {"Angel Hair Patties", «data
styl0001000000000012000E00030000000E000000000000»}
The contents of the selection-object in Tex-Edit Plus is
international text, Bob - which is why the returned list includes
style data. If you're trying to get a string, you could either coerce
the result:
-----------
set newName to clipboard as string
-----------
- or use "the clipboard" (from Standard Additions), rather than
"clipboard" (from Tex-Edit Plus). (While "the clipboard" will still
contain the style data, it returns the text that you want here.)
I'm not entirely clear about what you're ultimately trying to do.
Whatever it is, you may be able to do it slightly more directly -
without the need to select text, etc. For example...
To copy paragraph 1:
-----------
tell application "Tex-Edit Plus"
activate
tell paragraph 1 of window 1
set capitalization to word caps
set the clipboard to (get contents)
end tell
end tell
-----------
To set a variable to paragraph 1:
-----------
tell application "Tex-Edit Plus" to tell paragraph 1 of window 1
set capitalization to word caps
set newName to it
end tell
-----------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden