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: Wed, 23 Jun 2010 21:54:51 -0400
On Jun 23, 2010, at 8:27 AM, Tommy Bollman wrote:
> You mean puzzling like this:
> set theRes to "This is a proof of concept" display dialog buttons {"Ok"}
>
No. This is not puzzling, this is an error. There are two commands in one line
I assume that because of the first tell block, the second tell block is not seen as such.
But I am not sure!
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
> I think it illustrates that there is no strict left to right parsing of expressions and that some expressions have
> a higher priority than others, Messages and properties being parsed before variables, and that you can promote an expression in the evaluation
> chain as you would in other languages by enclosing subexpressions in parenthesis.
>
>
> On 23. juni 2010, at 11.21, Thomas Fischer wrote:
>
>> Deivey
>>
>>>>> Thomas,
>>>>> You got the id of the window because TextEdit is scriptable and might (it does in this case) have "id" as its window's property.
>>>>> If you try your script with a non-scriptable app, you will get an error.
>>>>
>>>> I agree, but my point was that even if the application is scriptable, there is no
>>>> id of window 2 of process "TextEdit"
>>>> while there is one for
>>>> window 2 of application "TextEdit".
>>>
>>>
>>> This is so, because in SL you do not need to "tell" an app.
>>>
>>> You can run the script:
>>>
>>> get id of window 2 of application "TextEdit"
>>>
>>>
>>> And it will work.
>>> So in effect your script above is like:
>>> Tell app "System Events" to tell app "TextEdit" to get id of window 2
>>>
>>> And you can see that the first tell does absolutely nothing.
>>> So, your suggestion of app will only work with an app that is scriptable.
>>> Otherwise is not useful.
>>
>> Basically I agree, but checking I came about a puzzling effect:
>>
>> set appName to "AppleScript Editor"
>> tell application "System Events" to tell application appName to get id of window 2
>>
>> doesn't work, although
>>
>> set appName to "AppleScript Editor"
>> tell application appName to get id of window 2
>>
>> and
>> tell application "System Events" to tell application "AppleScript Editor" to get id of window 2
>>
>> do.
>> So there is some difference in the evaluation of variables. Any idea?
>>
>> Thomas _______________________________________________
>> 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
>
> Best regards
>
>
>
> Tommy Bollman
> --------------------------------------------------------------------------------------------------
> Mollison's Bureaucracy Hypothesis:
> If an idea can survive a bureaucratic review
> and be implemented it wasn't worth doing.
>
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