Add Multiple files to Toast Project?

Morning guys,

I’ve been trying to learn AS for a few weeks, and have managed to get to a reasonable point in my first project, but now I’m faced with the next challenge and can’t seem to find posts which cover this - I’m probably looking for the wrong search term.

I managed to successfully “add” a file to my toast project using the following scripts:

set file_to_add to ":Users:steveg:Desktop:CFCARD:EVNZ0001.MPG" as alias

and then later in the script:

add to toast_project items (every file of thePath)

. . . but I’m stuck, if there’s more than one file I need to “Add” to the project.

Can anyone either - advise me what search term I need to look for on the forums, or point me in the right direction for adding multiple files to the project.

Any help would stop me pulling the rest of my (limited) hair out, this morning!

Thanks in advance.

. . . . . anyone???

. . . . or a link to another place in the forum maybe??


the add command expects obviously one or more aliases.
every file of thePath looks like a line within a Finder tell block.
Finder file specifiers must be coerced to alias.
And be careful not to mix up application tell blocks

As Stefan says you will need to use a finder tell block first to get every file.

Also look at as alias list

and the use of ( ) in a command

Good evening guys,

Many thanks for the pointers . . . . I think!

Not sure exactly what you mean here StefanK, but it gives me a direction to start from!

Mark - Yes I think I understand this part, and I do believe I have some issues with this elsewhere - thanks also!

I’ll have a go and see what results I come up with (opens up his “Applescript for Dummies” book to look for “coerce”)
Have a very good evening.

Hi steevg,

could you share the script you came up with?


I actually never got it going . . . . sorry.
But hopefully by adding to this post, hopefully someone else might be able to help you.

Good luck.

I’m using Toast 11 and at this point I have this script:

set files_to_add to "HD2:sjungarna_inspelningar:199 - Mohedaskolan:bounce:1.wav" as alias

tell application "Toast Titanium"
	add to current disc items files_to_add
end tell

I want to be able to add multiple files but without the choose file option, but point directly to file files.


This should get a list with aliases, wich I believe will work, if not, then you’ll have to iterate over the list, adding one item at a time.

tell application "System Events"
	set ml to every file of folder "HD2:sjungarna_inspelningar:199 - Mohedaskolan:bounce:" as alias as list
end tell
tell application "Toast Titanium"
   add to current disc items ml
end tell

Repeating over the track list would look something like below, this code is just for prosperity, as I don’t have Toast, so it is untested!

tell application "Toast Titanium"

repeat with aTrack in ml
	add to current disc items aTrack
	# I don't know toast

end tell


I used this some years ago, save it as application (bundle).
You can drop files onto the icon or run it normally

on run
	set theseFiles to choose file with prompt "Choose files to write on disk" with multiple selections allowed
end run

on open theseFiles
end open

on toast(filesToToast)
	display dialog "Enter Disk Name" default answer "" buttons {"Cancel", "OK"} default button "OK"
	set diskName to text returned of result
	tell application "Toast Titanium"
		set newDisk to make new Data disc with properties {name:diskName, file system type:Mac OS Extended}
		add to newDisk items filesToToast
		write newDisk
	end tell
end toast


for some reason your script returns error “Can’t make class Data disc.”
Maybe it has to do with the later version of Toast I’m using (ver. 11)?


your script returns this error for every file in the folder.
"Can’t make {file "HD2:sjungarna_inspelningar:199 - Mohedaskolan:bounce:1.wav" of application "System Events"

SInce I have near to zero troubleshooting skills here I pretty much don’t know what to do…

Probably. I have version 10


Try changing “System Events” to “Finder” that may work better!

This throws an error in both Finder and System Events, if the folder contains more than one file

 every file of folder "HD2:sjungarna_inspelningar:199 - Mohedaskolan:bounce:" as alias as list

This works in Finder but not in System Events

every file of folder  "HD2:sjungarna_inspelningar:199 - Mohedaskolan:bounce:" as alias list


I actually tested it with System Events under SL, with a folder with more than one file, and it worked.

I really didn’t know that the alias would be an alias to a file from System Events and not a general alias. :expressionless:

I really meant alias list! Thanks!

class alias in AppleScript represents always the file specifier alias.

The class alias file (pointer to a real file) exists only in the Finder

In System Events an alias file can be identified by the kind property

That is surely a good thing to know! Thanks Stefan! :slight_smile:

I don’t like it though, I think it would be much more logical if they all represented the same thing, and System Events let me down this time! That an alias list is different from as alias as list, is also a bit startling. :slight_smile:

( I just recently learned that from Leopard onwards, an alias doesn’t need to exist In AppleScript, that is, you can make an alias to a non existent file. :slight_smile: First, and for along time, I thought it was BBEdit that behaved peculiarly. )

What is the purpose to create an alias to a non existing file ??

I am not sure what the purpose of a non-existant alias. :slight_smile: But I read that it was possible.

It turned out that I missed a detail here, and that is that it was resolved compile time in AppleScript 1.9 but is resolved at run-time in AppleScript 2.x. Still, I have experienced that a non-existant alias haven’t generated run time errors at least inside BBEdit tell blocks. And it happened once outside a BBEdit tell block too, for some reason, and then I looked it up last time, somewhat hastily. After last time, I started using exists, within System Events and Finder blocks! :slight_smile:

I looked it up, both in ASLG and in the Dictionary.