• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UI referencing a window by number not name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UI referencing a window by number not name


  • Subject: Re: UI referencing a window by number not name
  • From: Brett Conlon <email@hidden>
  • Date: Fri, 20 Jan 2006 10:18:58 +1000


Many thanks for your code Carmin. It helped big-time with the Quark Print window.

However, regarding FreeHand (the second part of my original question) , trying to obtain the ID of all FreeHand's windows fails. I changed it to "name" and that worked fine but the document window is not seen as the first item. The palettes sitting above the document are seen as higher than the document. I tried using "last item" and that worked to locate the name of my document window until I had 2 or more documents open and the one on top ( the one I wanted to target) was no longer the last window.

I tried using "document 1" and that worked until I realised FreeHand assigned documents a number and that number didn't change when you swapped between documents, so if document 2 was on top the script would still target document 1 under it (Quark doesn't act that way, whatever doc is on top is doc 1).

I then tried "active document" but it wouldn't compile and "front document" didn't work... can't remember the reason now. So with FreeHand I'm kinda stuck being able to target the front most document's window.

I altered your script to the following:

tell application "FreeHand MX"
        activate
        tell application "System Events"
                tell process "FreeHand MX"
                        set zWindows to windows
                        set zId to properties of last item of zWindows
                end tell
        end tell
end tell

Which gave this result in the Event Log:
....snipped
get properties of window "Untitled-1" of application process "FreeHand MX"
                {position:{59, 25}, maximum value:missing value, name:"Untitled-1", size:{1218, 992}, subrole:missing value, class:window, minimum value:missing value, enabled:missing value, selected:missing value, role:"AXWindow", help:missing value, title:"Untitled-1", value:missing value, orientation:missing value, description:"window", focused:false}

I noticed there's a property of focused:false. I then tried to write some code that looks for a document whose window has the property of focused:true but couldn't get the syntax right.

Any thoughts?

Cheers,

Coj




email@hidden

19/01/06 05:22 AM

To
email@hidden
cc
Subject
Re: UI referencing a window by number not name





somewhere along the line you had to have been able to reference the window
forget the name, use the window id

tell
application "Script Editor"
   
set zWindows to windows
   
set zId to id of first item of zWindows
   
display dialog zId
end
tell
 _______________________________________________
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

  • Prev by Date: Re: Counting Messages in "Inbox"
  • Next by Date: Re: text item delimiters
  • Previous by thread: Re: UI referencing a window by number not name
  • Next by thread: Re: NDN: Re: Finder scripting bug
  • Index(es):
    • Date
    • Thread