Re: AppleScript object (Re: text item delimiters question)
Re: AppleScript object (Re: text item delimiters question)
- Subject: Re: AppleScript object (Re: text item delimiters question)
- From: Bill Briggs <email@hidden>
- Date: Wed, 5 Mar 2003 20:31:06 -0400
At 11:28 PM +0000 05/03/03, has wrote:
What's a bit more mysterious is that the following fails:
tell app "foo"
set text item delimiters to "" -- application error
end
I don't have the time to go through your entire slate of cases, but
you need to rework it considering something you didn't take into
account as concerns text item delimiters and other applications. Text
item delimiters can be assigned in a list (though AppleScript itself
only uses the first member of the list, though it reports that it has
the others as text item delimiters). But for an application that
supports them you could may bre required to assign them as {";",":"},
that is, the tid assignment may not "take" unless it's in a list,
even if you only assign one TID. To whit
set my text item delimiters to {",", "."}
set x to "what.is,it"
text items of x
-->{"what.is", "it"} -- AppleScript only uses the fist one
-- note that Scriptable Text Editor's default TID is a comma
tell application "Scriptable Text Editor"
set text item delimiters to {":", "."} -- no application error
get text item delimiters
--> {":", "."}
end tell
get AppleScript's text item delimiters
--> ""
in this case where the application supports its own text item
delimiters - not many do - the command is handled by the application
with no difficulty. If you fail to put a TID in {} then it is not
processed by the application, nor does it change AppleScript's text
item delimiters, nor does it error.
This, on the other hand, passes it up out of the tell block, as expected.
tell application "Scriptable Text Editor"
set my text item delimiters to {"[", "]"}
get text item delimiters
--> {":", "."}
end tell
get AppleScript's text item delimiters
--> {"[", "]"}
And this
tell application "Scriptable Text Editor"
set its text item delimiters to {"[", "]"}
get text item delimiters
--> {"[", "]"}
end tell
get AppleScript's text item delimiters
--> ""
also changes Scriptable Text Editor's text item delimiters. And both
of these recover Scriptable Text Editor's text item delimiters.
tell application "Scriptable Text Editor"
get text item delimiters
end tell
tell application "Scriptable Text Editor"
get its text item delimiters
end tell
Scriptable Text Editor has yet another oddity. You can assign
multiple text item delimiters, but if you attempt to use them the
application will only employ the first two characters of each text
item delimiter, viz.
tell application "Scriptable Text Editor"
set its text item delimiters to {"one", "two", "three"}
get it's text item delimiters
end tell
-->{"on", "tw", "th"}
Other oddities exist.
- web
_______________________________________________
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.