Add Multiple files to Toast Project?

(Damn naming confusion !!)

it’s correct in case of as alias specifier

set a to alias "Path:to:file"

Your “syntax”

looked like you want to create as alias file in Finder like

tell application "Finder" to make new alias file to file "Path:to:file"

Sorry about that.

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).

This test is none of BBEdit’s or other application’s business,
it’s absolutely reliable outside any application tell block.

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

Maybe it’s easy to solve?

Hello.

tell application "Finder"
	set ml to (sort every file of (folder "HD2:sjungarna_inspelningar:199 - Mohedaskolan:bounce:") by name) as alias list
end tell

Hi!

this script

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


hey that’s just great! It works just fine.

Many thanks to you McUsrII! (and Stefan!).