Re: how to trace files opening from a specific folder
Re: how to trace files opening from a specific folder
- Subject: Re: how to trace files opening from a specific folder
- From: Martin mahal Halter <email@hidden>
- Date: Fri, 04 Feb 2011 11:39:16 +0100
Laurent,
Raskin.app implements this behaviour by showing open documents with a screenshot of the respective window. is this something you have in mind?
we implemented it using several API:
* NSRunningApplication to find out which apps are running
* CGWindowList to get a list of open windows
* AppleScript and AXAPI to ask a specific app about it's open documents
* AXObserverAddNotification(observer, process, kAXWindowCreatedNotification, self);
None of them are close to the Filesystem, it's based on the assumption that one window represents one file. if you find any other means of finding such information using the filesystem, i'd be very glad to know about it :-)
tell application id "com.apple.TextEdit"
set mydoc to document of window id %@
try
set myPath to path of mydoc
return myPath
end try
end tell
regards
mahal
http://raskinformac.com (30-day free trial)
Am 04.02.2011 um 10:51 schrieb Laurent Vinet:
> Hi,
>
> More or less, I need to receive "events" notifying that some files have been opened.
>
> My goal is : if I know that a "file1.txt" is opened, for example by TextEdit, followed by the creation of a "file2.txt" by TextEdit; I can suggest that file2 is a descendant of file1 (the result is a "genealogy" of the files). I use FSEvent and activeApplication for monitor the creation of new file and I looking a solution for monitor the opening.
>
> Kind regards,
> Laurent
>
> Le 3 févr. 2011 à 18:07, Quinn The Eskimo! a écrit :
>
>>
>> On 3 Feb 2011, at 17:05, Laurent Vinet wrote:
>>
>>> my cocoa app needs to trace files opening from a specific folder
>>
>> What are your requirements for binary compatibility. It's relatively easy to do this with DTrace, but DTrace is a debugging tool, not something you'd want to have your application depend on.
>>
>> S+E
>> --
>> Quinn "The Eskimo!" <http://www.apple.com/developer/>
>> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
>>
Am 03.02.2011 um 18:05 schrieb Laurent Vinet:
> Hi All,
>
> my cocoa app needs to trace files opening from a specific folder. More precisely I need to know what files are "opened" in what application (for exemple TexteEdit reads in the file and then closes it, and only reopens to save changes.)
>
> After using opensnoop who use Dtrace I think it's possible but I don't find the way (with DTrace or...). Any ideas ?
>
> Thanks in advance
> Regards
> Laurent
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden