Having created a small standalone that installs in the MacStatusMenu, I would like, on first launch, to place the standalone in the "login item" of the OSX.
In order to do that, I found on the web the following AppleScript that, running on the script editor, returns the following error:
Code: Select all
login item "UNKNOWN" of application "System Events"
Code: Select all
try
set appName to name of (choose application)
set appPath to (path to application appName)
on error
display notification "Application with this name NOT founded" sound name "Frog"
return
end try
tell application "System Events"
try
set allLoginItems to name of every login item as string
on error
set allLoginItems to {}
end try
if appName is not in allLoginItems then tell application "System Events" to make login item at end with properties {path:appPath, hidden:false}
end tell
Thanks
Trevix