Problem with Sleep scripting addition

OSX 10.3.3 (Panther)

Hi all,
I’m using audio hijack pro which has a built in timer function that:

  1. Starts Realone player
  2. records a specific audio stream to mp3 to a specific folder
  3. Automatically quits RealOne Player after specified recording time.

I added a folder action script to move the captured audio file to itunes so that it would sync with my iPod. The script works ok but I’m running into the well documented problem of the folder action script running before the file has been closed by the application (Realone Player).

I found the sleep osaxen with the
sleep while someone is using
and
sleep while application is running
this appears perfect for my needs and I installed the osaxen into my User:Library:ScriptingAdditions folder.

Now using Applescript 2.0. Adding the sleep for 20 * seconds command to my script is OK. Attempting to add sleep while… fails with a syntax error message generated by Applescript editor.

I’m guessing the osaxen sleep is not compatible with X 10.3? If so - How do you tell if any osaxen is X or MacOS?

Why is the syntax of sleep for… appear to be OK? Does this belong to another dictionary?

Worst case I will probably use Finder to test to see if RealOne Player is still active but I preferred what was offered by the osaxen sleep.

Thanks in advance.
Regards Dwayne

You know a scripting addition is OSX-compatible if:

  • You tested it and it works
  • You read it in the documentation or somewhere else
    If you’re talking about “Sleep Commands”, by Eric Allen Grant, this is an “old” scripting addition (1998), and the first line in its documentation is “Sleep Commands is compatible with OS 8.5!”. :wink:
    You can emulate it using a routine similar to this (though there are some applications which don’t keep “opened” their documents):
set theFile to alias "path:to:file"

repeat
try
    set z to (open for access theFile with write permission)
    close access z
    exit repeat
on error -- still no permission
    delay 1
end try
end repeat

The term “sleep” is part of Finder and System Event’s dictionaries, and a command of the “XTool” osax.

jj - Thanks for the feedback. You are correct its the old SLEEP from 1998 and yes I also saw the comments in the description regarding MacOS 8.5. In a absence of anything that said that MacOS scripts were incompatible with OSX - I was hoping that it would work given it looked so elegant.

I tried your recommendation and it appears RealOne Player is one of those apps that does not behave well. Since Audio Hijack shuts down RealOne Player after the recording is complete, I’m going to try the Finder solution which checks to see if RealOne Player is still active.

Anyone else have any feedback.

Thanks,
Regards Dwayne

I ended up using System Events to watch for when RealOne Player shutdown. Just wish there was a better way of watch for file access:

	set RealOne_run to true
	repeat until RealOne_run is false
		delay 5
		tell application "System Events" to ¬
			set RealOne_run to exists process "RealOne Player"
	end repeat 

Thanks,
Regards Dwayne