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: Laurent Vinet <email@hidden>
- Date: Fri, 4 Feb 2011 14:57:15 +0100
Mahal,
Not exactly.
I am trying to describe the workflow of files in the area of digital music (a composer produce a final mix by using different source files (wav files, etc.) who can be transformed.
So i need to store somethings like this:
wav1 file --> opened by Audacity -> save as wav2 file (TBC the file wav1 transformed) --> |
wav3 file --> | -> the 2 files opened by a sequencer --> a (new) mix file
Most of the applications are not scriptable neither conform to document architecture of the Application Kit. More, some files are "imported" (wav file in a sequencer) but are not one of the document types the application can open or edit.
So DTrace can be the solution if i can develop a tool/thread in my app like opensnoop. Below the output of opensnoop when I double-click a wav file :
502 2936 Finder 19 /Users/Vinet/Music/bugsbunny1.wav
502 34 mds 12 /Users/Vinet/Music/bugsbunny1.wav
etc...
.... many other "events" but at the end :
502 14917 QuickTime Playe 0 /Users/Vinet/Music/bugsbunny1.wav
After reading this http://www.macresearch.org/tuning-cocoa-applications-using-dtrace-custom-static-probes-and-instruments
I think it's possible but I don't know if i can replace Instruments by my app (in this case my app active some custom Probe ... and must used the output stored in a log file(?))
On the other hand if a more simple/realist approach exist....
Regards
Laurent
Le 4 févr. 2011 à 11:39, Martin mahal Halter a écrit :
> 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