System Events - login items

Okay, been a while since I’ve done AppleScript, so can anyone tell me what I’m doing wrong here?

tell application "System Events"
	set loginItems to (login items)
	set loginItemNames to {}
	repeat with i from 1 to count of loginItems
		set loginItem to item i of loginItems
			-- set end of loginItemNames to (name of loginItem)
		properties of loginItem
	end repeat
end tell

Basically, I want to add my helper application as a login item, but only if it isn’t already in the list of login items. (I figure that’s smarter than blindly adding it, especially since this helper app only needs to run on the very next login, and then it removes itself from the list). I was trying to get a list of the names of the login items, and then check to see if the list contains the name of my login item, and go from there, but all I can seem to do is get errors.

Any ideas?

Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi Mark,

try this

set myloginItem to "myApp"
tell application "System Events"
	set loginItemNames to name of login items
	if myloginItem is not in loginItemNames then
		-- do something
	end if
end tell