OS X - list all open documents

Jim Sims sims at ezpzapps.com
Fri Mar 6 04:57:24 EST 2009


On Mar 5, 2009, at 11:54 PM, Richmond Mathewson wrote:
> Just type   lsof   in a Terminal window and hit enter.

Thanks for the reply Richmond.

I tried that before emailing the List, thinking there must be an  
easier way as tons of OS files and OS processes are listed with that  
method. Maybe I'll return to it however if an easy, lazy method  
doesn't appear   ;-)



On Mar 6, 2009, at 12:09 AM, Terry Judd wrote:
> Hi Jim 0 This might be a round about way but...You could use  
> applescript to
>
> 1. Get the name of every application process
>
> Tell application "system event" to get the name of every application  
> process
>
> 2. parse the list, then weed out the background apps via
>
> Tell application "system event" to get the background only of process
> <<processname>>
>
> And finally...
>
> 3. Tell application "system event" to get the name of every document  
> of
> process <<processname>>
>
> Just be aware that not every application will necessarily yield up a  
> full
> list of documents using this approach. Safari for example will only  
> give you
> the title of the active tab in each window and Firefox will probably  
> give
> you nothing. If you want more then you may have to resort to iterating
> through a processes windows and attempting to capture the relevant
> information through one or other of the window's properties. I've  
> probably
> got some routines that might help if you want to go down that path.

That looks very promising, thanks Terry!

I think that using the following with some Rev scripts will get me  
what I need  :-)
[posting in case someone searches the list archives for such a thing]

tell application "System Events"
	set theProcesses to every process whose visible is true and name is  
not "Finder" and name is not (name of me)
end tell

-- NOTE: THE FOLLOWING SEEMS TO REQUIRE ACCESS FOR ASSISTIVE DEVICES  
TO BE ENABLED
tell application "System Events"
	get name of every window of application process "Preview"
end tell

sims

www.ezpzapps.com
Skype:   sims.jim
iChat:   techietours
______________________
Opportunity by Design







More information about the use-livecode mailing list