Is there a way to verify the path of the app running?

I am trying to provide a check box that allows the user to set the app as a log in item. I have found scripts to do this but I would like to verify the path of the app first before I set the hard coded path to the log in items script.

seeing as users can do a million and one things when copying over apps and 6 times out 10 the app will not end up where it is supposed to, I figure it best to verify the location of the app first before writing a script that in the end may not work. Is this prudent? Am i waisting my energy? what is the best way to go about this?

To get your app’s path, use “path to me”. About users moving the app after setting it up as login-item, you can’t do anything, except for checking every time if it changed, checking your current “path to me” against:

tell application "System Events"
   path of first login item whose name is "App Name"
end tell

Thanks for that one, but tell me, if the action of making the app a log in item is connected to a check box, what would be the script for removing the app from the log in items if the formentioned check box was unchecked.

The script I am currently using for the make a log in item is:

tell application “System Events” to make login item at end with properties {path:the_app, hidden:false}

I have tried variations of the script to try and remove login item but to no avail. Any suggestions would be greatly welcomed.

tell application "System Events"
	delete (first login item whose name is "App Name")
end tell

Could there possibly be another variation for this script as it idoesnt seem to wanna work. Just for kicks I tried switching "las"t with "firs"t and still nothing. How ever if I go ahead and remove the word “last” all together I at least seem to get an error message which at this point is the most I can get out of it. Any suggestions? Cheers.

For any one who comes up against this same problem, the correct solution is as follows:

– “name” is a single property, not a record.
Try:

tell application "System Events"
        delete (first login item whose path is the_app)
end tell