Re: System Events: window id's instead of window names?
Re: System Events: window id's instead of window names?
- Subject: Re: System Events: window id's instead of window names?
- From: Deivy Marck Petrescu <email@hidden>
- Date: Thu, 24 Jun 2010 09:49:39 -0400
On Jun 24, 2010, at 3:04 AM, Thomas Fischer wrote:
>
>> No. This is not puzzling, this is an error. There are two commands in one line
>
> Do you mean error like bug?
> Or a programming error?
Programming.
This is the same as
set x to 1 set y to 2
> The result doesn't change if I unravel the line to
>
> set appName to "AppleScript Editor"
> tell application "System Events"
> tell application appName
> get id of window 2
> end tell
> end tell
>
>> I assume that because of the first tell block, the second tell block is not seen as such.
>> But I am not sure!
>
> I don't know of any such limitation for nesting tell blocks in the documentation.
Sorry if I was not clear. Axel puts it very well in his post.
The first tell, makes System Event to get everything else as targeting System Events.
So, as Axel puts it, when the second tell comes in, it is clear to AS that it is not another "tell app", but something that System Events has to handle.
As I pointed out, change application to process and there is no error.
>
>> The error that one gets is an error of System Events.
>> If you change "application" to "process" there is no error.
>>
>> Also, if the variable appname is changed then script runs ok:
>>
>> set appName to application "AppleScript Editor"
>> tell application "System Events" to tell appName to get id of window 2
>>
>
> This I interpret as a hint that it is not the nesting itself but the combination of the evaluation of the variable with the call to the application that is not working.
> Thus it rather looks like a bug to me.
I don't think so. I believe that in this case there is a disambiguation and tell targets the application itself.
>
> Thomas _______________________________________________
>
Deivy Petrescu
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:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden