Le 13 mars 07 à 09:10 Matin, Aliacta a écrit:

>> Le 13 mars 07 à 00:10 Matin, Aliacta a écrit:
>>
>>>  tell application "System Events"
>>>     tell process "My Application.debug"
>>>             tell application "My Application.debug"
>>>                     activate
>>>             end tell
>>>             click UI element "<Button's Caption>" of front window
>>>     end tell
>>>  end tell
>>>
>>>  Sometimes simplicity rocks,
>>
>> Do you really have to write the tell process "My Application.debug"
>> statement twice?
>
> yes (note it's 'tell process' and 'tell
> application' though, not two times 'tell process')
>
> 'click' only works with 'tell process' and
> 'activate' only works with 'tell application'
> AFAIK.

Subtle difference!

But, in fact, that's logical:

In the dictionary of System Events, there is a "Process" class. This  
one knows and implements the click event.
However, the Activate event is defined in the whole AppleScript  
language. Since the language itself does not implement a Process  
class, it's logical to find it in the Application class.

I'm sure you may bring the app to the front using:
set frontmost of process "My Application.debug" to true

Here's your script in a simpler form. Unless a strange bug happen (in  
AppleScript, that's common), it should work the same way:

tell application "System Events"
        tell application "My Application.debug" to activate
        tell process "My Application.debug"      to click UI element "<Button's 
 
Caption>" of front window
  end tell
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to