DVD burning script, keystroke return not working & error message help!

Hi,

I have a script kinda working, which burns a DVD in Toast, but it’s far from perfect!
Presently, the script opens Toast and won’t actually burn the DVD. I had it working some time ago, but now there seems to be a problem:-


tell application "Toast Titanium"
	open thefile
	set toast_project to current disc
	add to toast_project items files_to_add_1
	delay 3
	add to toast_project items files_to_add_2
	delay 3
	with timeout of 600 seconds
		write toast_project with asynchronous completion without asking
		delay 3
		tell application "System Events"
			keystroke return
			
--Doesn't burn the Disk ! Seems like keystroke return is not being implemented for some reason?
-- Also, I need to ensure that the DVD is written and ejected before the "DVD Disk Written Successfully" message appears. Need some kind of checking in here.

			try
				tell application "Toast Titanium" to quit without saving
			end try
		end tell
	end timeout
end tell

activate
display dialog "DVD Disk Written Successfully"

I’ve inserted some notes into the script after finding out that my end message “DVD Disk Written Successfully” appears even when the DVD isn’t burned!

My question (at last):

How do I stop the script from working if there’s an error at any time during the burn process, and it fails to produce my DVD (will setup an error message if this happens)?

Any help greatly appreciated.
Thanks in advance.

Hmmm . . . . no replies?

Can anyone help please?

Thanks
Steve

Hi,

I don’t know exactly what you’re going to accomplish, because there are a few “undefined” variables
like thefile and files_to_add.
Normally you have to create a new disk with the proper spcifiations, add the files and then burn the disk

This is a Toast-droplet I wrote once


on run
	set theseFiles to choose folder with prompt "Choose folder to write on disk" without invisibles
	toast(theseFiles as list)
end run

on open theseFiles
	toast(theseFiles)
end open

on toast(theseFiles)
	try
		set {folder:fFolder, name:fName} to (info for 1st item of theseFiles)
		if fFolder then
			tell application "Finder" to set theseItems to items of 1st item of theseFiles as alias list
			tell application "Toast Titanium"
				activate
				set newDisk to make new Data disc with properties {name:fName, file system type:Mac OS Extended}
				add to newDisk items theseItems
				write newDisk
			end tell
		end if
	on error e
		display dialog e
	end try
end toast


hope it helps

StefanK,

thanks for the reply, and apologies for the confusing script. It’s part of something I’m working through to pull several files into a Toast “template” (made some posts quite some time ago and had a lot of help from members of these forums including yourself at one point - thanks).

So what I’m hoping to achieve - is this:

My current script activates Toast and burns an individual DVD with relatively little problems (at this stage), but even if it fails, with the script I have, I still get the “DVD Disk Written successfully” message!

Obviously this is wrong as I don’t have any form of error checking in place.

What I’d like to accomplish is:

  1. Activate Toast and pull in the files (which is currently working ok)
  2. Burn the files to disk with no user intervention (I have a small problem with this but will tackle that later)
  3. If an error occurs the script provides me with an error message (“Your DVD has NOT been written” etc.!) Basically it should stop the script from continuing.
  4. The “DVD Disk Written Successfully” message only appears AFTER a successful burn.

I’ll admit, this is a little too advanced for me at this time, as I’m still playing with TELL commands, Repeats and trying to understand the logic of paths, but any help you may be able to provide would be most useful.

Please let me know if I’m not explaining myself very clearly.

Thanks

Of course you get the successful message, because it will be executed anyway.
Wrap the whole timeout block with a try block and catch the possible errors.

It’s better to create a new disc instead of working with current disc

StefanK,

. . . I think I understand and will give it a go (gulp).

The current disc situation (if I can remember back that far) was because I’m using a saved template in Toast, and this template has all the existing attributes I need, setups, name of disk etc.
Just tried to rename this to New Disc as a trial, but it failed.

Will checkout the Toast dictionary to see where I’m going wrong.

Thanks for your input, will post back if I get stuck!

Cheers,
Steve

. . . . Still can’t get this darned Keystroke return to work in Toast Titanium 10!

I’ve Googled and Googled, and I just can’t find any information to get this to work.
I tried several different delay values, but nothing!

Is there some way I can “see” (maybe in the Terminal) which command(s) is being activated so I can script it?

Come to think of it, understanding how to “see” my script working in terminal would be good to know anyway.
I know I can do this in the events window of the script editor, but only if the script works . . . otherwise I just see the following error message:

tell application "Finder"
	get keystroke "
"
		--> error number -1728 from keystroke "
"
Result:
error "Finder got an error: Can't get keystroke \"
\"." number -1728 from keystroke "
"

Idea’s please ?
Thanks in advance.