• 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: Seeing the state of an application with Script Editor?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Seeing the state of an application with Script Editor?


  • Subject: Re: Seeing the state of an application with Script Editor?
  • From: Jim Underwood <email@hidden>
  • Date: Sat, 28 Oct 2017 18:09:14 +0000
  • Thread-topic: Seeing the state of an application with Script Editor?

Jean-Christophe,

Phil has the right idea, but I suspect his script will produce way too much
information.


You probably will want to drill down on just one app at a time.
Here's an example for TextEdit, run in Script Editor.

Note here I included "whose background only is false" to limit the list.
Remove the "whose" clause to see everything.

________________________________

tell application "System Events"


  --- List Only Elements that are Visible ---

  set allUIElemList to its UI elements whose background only is false



  tell application process "TextEdit"



    set propList to its properties

    set uiElemList to its UI elements



  end tell

end tell

________________________________


Produces

________________________________

tell application "System Events"

get every UI element whose background only = false

--> {application process "Path Finder", application process "Finder",
application process "TextExpander", application process "ScanSnap Manager",
application process "Evernote", application process "Microsoft Outlook",
application process "LaunchBar", application process "Keyboard Maestro",
application process "Script Editor", application process "TextEdit"}

get properties of application process "TextEdit"

--> {has scripting terminology:true, bundle identifier:"com.apple.TextEdit",
file:alias "Macintosh HD:Applications:TextEdit.app:", creator type:"ttxt",
subrole:missing value, entire contents:{}, selected:missing value, application
file:alias "Macintosh HD:Applications:TextEdit.app:", orientation:missing
value, role:"AXApplication", accepts high level events:true, file type:"APPL",
value:missing value, position:missing value, id:87429980, displayed
name:"TextEdit", name:"TextEdit", class:application process, background
only:false, frontmost:false, size:missing value, visible:true, Classic:false,
partition space used:0, role description:"application", maximum value:missing
value, architecture:"x86_64", short name:"TextEdit", focused:missing value,
minimum value:missing value, help:missing value, title:"TextEdit", accepts
remote events:false, total partition size:0, description:"application",
accessibility description:missing value, enabled:missing value, unix id:32981}

get every UI element of application process "TextEdit"

--> {window "Untitled" of application process "TextEdit", menu bar 1 of
application process "TextEdit"}

end tell

________________________________



Best Regards,

Jim Underwood
aka JMichaelTX


From: AppleScript-Users
<applescript-users-bounces+jmichael=email@hidden<mailto:applescript-users-bounces+jmichael=email@hidden>>
 on behalf of 2551phil <email@hidden<mailto:email@hidden>>
Date: Saturday, October 28, 2017 at 11:06 AM
To: "ASUL (AppleScript)"
<email@hidden<mailto:email@hidden>>
Subject: Re: Seeing the state of an application with Script Editor?

Only if you’re a masochist (and maybe this fails your ‘complicated recursions’
condition anyway).

tell application "System Events"
try
set n to every application process's name
set p to every application process's properties
set a to every application process's attributes
set u to every application process's UI elements
-- on and on like this through all the possible variables
end try
end tell



Best


Phil
@sqwarq
 _______________________________________________
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

  • Follow-Ups:
    • Re: Seeing the state of an application with Script Editor?
      • From: 2551phil <email@hidden>
References: 
 >Seeing the state of an application with Script Editor? (From: Jean-Christophe Helary <email@hidden>)
 >Re: Seeing the state of an application with Script Editor? (From: 2551phil <email@hidden>)

  • Prev by Date: Re: Seeing the state of an application with Script Editor?
  • Next by Date: Re: Seeing the state of an application with Script Editor?
  • Previous by thread: Re: Seeing the state of an application with Script Editor?
  • Next by thread: Re: Seeing the state of an application with Script Editor?
  • Index(es):
    • Date
    • Thread