I just wrote and applescript application that i want to run for every user at startup. Should i use a login hook to do so? if so what is the best way to do so.
Rich
I just wrote and applescript application that i want to run for every user at startup. Should i use a login hook to do so? if so what is the best way to do so.
Rich
Hi,
Note that login hook is different from login item. Here’s an example of a script that makes itself a login item:
set my_ref to (path to me)
set my_info to (info for my_ref)
set my_name to (name of my_info)
tell application "System Events"
if my_name is not in (name of every login item) then
make new login item at end of login items with properties ¬
{name:my_name, kind:"APPL", path:my_ref, hidden:false}
end if
end tell
display dialog "I'm somebody!"
Login hooks can run for every user. Here’s a link that show how to make a login hook:
http://docs.info.apple.com/article.html?artnum=301446
Edited: I changed the ‘kind’ to “APPLICATION”:
set my_ref to (path to me)
set my_info to (info for my_ref)
set my_name to (name of my_info)
tell application "System Events"
if my_name is not in (name of every login item) then
make new login item at end of login items with properties ¬
{name:my_name, kind:"APPLICATION", path:my_ref, hidden:false}
end if
end tell
display dialog "I'm somebody!"
gl,