What actually happened is that two times at least, an alias to a non existant file hasn’t generated a run time error.
Within a BBedit tell block, and the other time outside. Maybe it has been because of some corruption of the AppleScript run time environment, but I don’t trust those tests anymore for checking if a file exists or not:
set isThere to true
try
set a to "non:existant:file" as alias
on error
set isThere to false
end try
I use blatantly Finder or System Events, and exists, (or a do shell script with test).
Here’s how my script (for Toast 10) looks like currently (thanks for the help so far!):
tell application "Finder"
set ml to every file of folder "HD2:sjungarna_inspelningar:199 - Mohedaskolan:bounce:" as alias list
end tell
tell application "Toast Titanium"
activate
make new Audio disc with properties {name:"testing Disc"}
add to current disc items ml
save current disc in "/Users/Tobias/Desktop/CDSKIVA_2.disc"
end tell
Possible the last thing to solve is how to add the files in alphabetical order. My file names are 1.wav, 2.wav etc.
What happens now is that the track order is:
1.wav
10.wav
11.wav
12.wav
2.wav
tell application "Finder"
set ml to (sort every file of (folder "HD2:sjungarna_inspelningar:199 - Mohedaskolan:bounce:") by name) as alias list
end tell
tell application "Finder"
set ml to (sort every file of (folder "HD2:sjungarna_inspelningar:199 - Mohedaskolan:bounce:") by name) as alias list
end tell
tell application "Toast Titanium"
activate
make new Audio disc with properties {name:"testing Disc"}
add to current disc items ml
save current disc in "/Users/Tobias/Desktop/CDSKIVA_2.disc"
end tell
returns this error:
error “Can’t make «class docf» "1.wav" of «class cfol» "bounce" of «class cfol» "199 - Mohedaskolan" of «class cfol» "sjungarna_inspelningar" of «class cdis» "HD2" of application "Finder" into the expected type.” number -1700 from «class docf» “1.wav” of «class cfol» “bounce” of «class cfol» “199 - Mohedaskolan” of «class cfol» “sjungarna_inspelningar” of «class cdis» “HD2”
Hello. I’m sorry about that, the result of the sort command doesn’t get coerced to an alias list.
I have changed the code slightly into something workable.
tell application "Finder"
set ml to (sort every file of (folder "HD2:sjungarna_inspelningar:199 - Mohedaskolan:bounce:") by name)
end tell
repeat with anItem in ml
set contents of anItem to anItem as alias
end repeat