Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the '10.5: Set Time Machine disk via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Set Time Machine disk via AppleScript
Authored by: sbossinger on Dec 22, '09 12:18:42PM

I had a devil of a time getting this script working in my environment. Of course, part of that, I'm sure, is that this is the first AppleScript I've ever worked with.

What was happening to me was that the script was ending by canceling the screen where it chooses the buttons to "Use for Backup" or "Cancel". I traced this back to the script using the value "0" for the value of desiredrownumber.

So, I changed it to this:

(*  Altered the test to ensure the property desiredrownumber would trigger the script to run, even if the desiredrownumber was 0 (as it is in cases where the script encounters only one drive attached, and that drive is in the first position - position 0).
			if desiredrownumber ≥ 0 then
					select row desiredrownumber of table 1 of scroll area 1 of sheet 1 of window name_tm -- select the desired volume in list
					click button (item lg of names_usebutton) of sheet 1 of window name_tm -- click the localised "use" button
					set message_title to (item lg of msgs_general) -- tell user that a backup volume has been successfully selected
					set message to (item lg of msgs_newvolume) & desired_name
					my growlnote(growl_general, message_title, message)

(*   Changed the error setting to -1.
				on error
					set desiredrownumber to -1 -- if failure for some reason, reset row number to -1 = nothing
				end try
			end if

[ Reply to This | # ]