Why creating file when detecting file creation doesn't work

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Hi,

I need your help understanding how to do the following:

1. I have Audio Hijack record audio. It creates an mp3 file in a given folder.
2. Once the mp3 is created, I want to create a file with the same name with .txt extension and open it in TextEdit.

I have created a rule that uses as matching:

* file has extension .mp3
* it does not have a green color label.

When matching:

* set the green color label
* execute the shell script

Code: Select all
echo "# $(date +'%Y-%m-%d %A @ %H:%M\')" > "$1.txt"
open -e "$1.txt"


What I have noticed is that this rule is triggered only when the recording is stopped.
The file is created immediately by Audio Hijack.
But it is as if Hazel does not see the mp3 file until writing to this file is completed.
The Rule status shows the file as matching the rule I have defined.

What might explain this behavior?
alex
 
Posts: 10
Joined: Mon Sep 12, 2011 3:49 pm

This is normally desired behavior. Chances are Audio Hijack is opening the file with the proper locks so that Hazel can detect that the file is busy. Operating on a file being written to can cause corruption and other issues.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support