Thursday, October 30, 2014

#1 2005-10-13 04:12:52 pm

julifos
Administrator
From: MalasaƱa, Madrid
Registered: 2002-11-20
Posts: 2014

How can I get the name of an opened document in an application?

First, you can examine the related application and see if it is "scriptable". Drop it onto your script editor's icon and examine its terminology. More probably, it will accept a syntax similar to this:

Applescript:

tell application "Scriptable App"
   set docName to name of window 1
end tell

If your target app is not scriptable, you may try UI Scripting, and a syntax similar to this:

Applescript:

tell application "System Events"
   tell process "Whatever"
       set docName to name of window 1
   end tell
end tell

If you don't find the propper syntax, try inspecting the application UI hierarchy with tools as Apple's UI Element Inspector or PreFab's UI Browser.

Anyway, there are some circumstances where you won't able to retrieve the name of some elements, because they were not designed to do so.


Filed under: System, scriptable

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.027 seconds, 8 queries executed ]

RSS (new topics) RSS (active topics)