Script inexplicably failing

I’m absolutely stumped. I’m calling the following script from another app:

on run (removeItem)
	tell application "System Events"
		delete login item removeItem
	end tell
end run

This script fails to do anything at all, including throw an error, when calling it the way I’m trying to. I’m passing in a value for removeItem that I know exists, but it stubbornly refuses to go anywhere. If I change the script to this:

set removeItem to "Genieo"
tell application "System Events"
	delete login item removeItem
end tell

…and run the script from the other app, it works fine. The login item goes bye-bye.

I would think that there’s a problem with the string being sent from the other app, but I have used a “display dialog” call to display the string, and it’s fine. Further, I’ve got a number of other scripts that receive strings from this app, and in all other cases those scripts work fine. It’s just this one script that is misbehaving.

Any ideas?

Try :

on run (removeItem)
	log class of removeItem # maybe itsn't a string
	set removeItem to removeItem as text
	tell application "System Events"
		delete login item removeItem
	end tell
end run

If the log instruction doesn’t return text we may hope that the added coercion solves the problem.
If it does you may use a shorter version :

on run (removeItem)
	tell application "System Events"
		delete login item (removeItem as text)
	end tell
end run

At this time, my guess is that removeitem contains in fact something like :
item i of aList

Yvan KOENIG (VALLAURIS, France) vendredi 5 septembre 2014 16:26:31