batch change event calendar's

Hi,
I am attempting to batch change all events in one calendar to another calendar but I am new to scripting.
I think i am missing a set for finding the calendar I want to move it to.

Any help would be much appreciated.

Clinton

on getInput(thePrompt)
repeat
tell application (path to frontmost application as text)
set inputText to text returned of (display dialog thePrompt default answer “” default button 2)
end tell
if ((count inputText) > 0) or (thePrompt contains “optional”) then exit repeat
end repeat

return inputText

end getInput

set eventString to “Test Event”
set calName to getInput(“what calendar do you want to move?”)
set calName to getInput(“Move it to?”)

tell application “iCal”
move (every event of (calendar whose title is calName) whose summary is not “test event”) to end of (some calendar whose title is calName)
end tell

iCal calendars have a name, not a title.
You used the same variable to refer to different calendars.
One thing that’s harder to find out: ‘whose’ only works with iCal when you refer to ‘first object’, not just ‘object’.
Here’s the amended code:

on getInput(thePrompt)
	repeat
		tell application (path to frontmost application as text)
			set inputText to text returned of (display dialog thePrompt default answer "" default button 2)
		end tell
		if (count inputText) > 0 then exit repeat
	end repeat
	return inputText
end getInput

set fromCalName to getInput("From what calendar do you want to move events?")
set toCalName to getInput("Move them to which calendar?")

tell application "iCal"
	move (every event of (first calendar whose name is fromCalName) whose summary is not "test event") to end of (first calendar whose name is toCalName)
end tell

I removed some redundant code as well, and changed prompts to indicate what the script is going to do.
Be prepared for a bit of a wait when running this script.

Thanks alastor933,
Works just how I wanted it to.

Much appreciated

Clinton