Delete an app from the login items

I have an AppleScript that is succesful in starting an app at login that looks like this:


		set appPath to POSIX path of "Macintosh HD:Applications:Example.app"
		
		tell application "System Events"
			make login item at end with properties {path:appPath, hidden:false}
		end tell

However, I also want to be able to delete that application from the list and have tried:


		set appPath to POSIX path of "Macintosh HD:Applications:Example.app"
		
		tell application "System Events"
			delete login item at end with properties {path:appPath, hidden:false}
		end tell

but it doesn’t work. Is there anyway to get this app of off the startup items list?

Have you tried this?

 set appPath to POSIX path of "Macintosh HD:Applications:Example.app"
       
       tell application "System Events"
           delete (login items whose path is appPath)
       end tell

Thank you so much! That worked perfectly!