Re: [AS & AW] class of selection
Re: [AS & AW] class of selection
- Subject: Re: [AS & AW] class of selection
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 29 Dec 2004 22:28:39 -0800
In many applications you have to resolve selection by setting a variable to
it or using the explicit 'get'. I don't have AppleWorks but I expect it's
the same thing here.
set verif to ""
try
set verif to (class of (get selection)) as text
end try
--
Paul Berkowitz
> From: cheshirekat <email@hidden>
> Date: Wed, 29 Dec 2004 22:55:04 -0700
> To: yvan-koenig <email@hidden>, AppleScript Users Mailing List
> <email@hidden>
> Subject: Re: [AS & AW] class of selection
>
> On Wed, Dec 29, 20046:09 PM, the following words from yvan-koenig yvan-
> email@hidden, emerged from a plethora of SPAM ...
>
>> Trying to help a friend, I wrote these instructions:
>>
>> tell application "AppleWorks 6"
>> activate
>> (*
>> try
>> name of document 1
>> on error
>> error msg2 number 8002
>> end try
>> *)
>> -- ...
>> set verif to ""
>> try
>> set verif to (class of selection) as text
>> end try
>> -- ...
>> end tell -- to AppleWorks
>>
>> If the running OS is higher than Mac OS 9.1, it works well, setting
>> verif as an empty string if the selected object is a frame which has
>> never been moved (or named).
>>
>> If the running OS is 9.1, verif is ALWAYS the empty string.
>
> Have you tried the coercion outside of "tell application AppleWorks"?
>
> Sometimes, I get strange results with coercions and find that subroutines
> are a convenient method to circumvent the conflicts within application tells.
>
> to getSelectionClass()
> tell application "AppleWorks 6"
> set the frontDoc to the front document
> tell frontDoc
> return (the selection's class)
> end tell
> end tell
> end getSelectionClass
>
> set the classOfSelection to (my getSelectionClass()) as string
> -- OR
> set the classOfSelection to ("" & my getSelectionClass())
>
> HTH
>
> cheshirekat
> --
> Perhaps all music, even the newest, is not so much something discovered
> as something that re-emerges from where it lay buried in the memory,
> inaudible as a melody cut in a disc of flesh. A composer lets me hear a
> song that has always been shut up silent within me.
> - Jean Genet (1910-1986), French playwright, novelist. Prisoner of Love,
> pt. 1 (1986, trans. 1989).
>
> * 867 PowerBook G4 * OS X 10.2.8 * 768 MB Ram *
> * Addictions: iTunes * AppleScript * iLife 4 * FileMaker Pro *
>
> _______________________________________________
> 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
>
_______________________________________________
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