سؤال

In El Capitan how can I get an applescript to make itself open at login? Such as adding it to the login items automatically?

I want to be able to send people the applescript and the first time they open it, it automatically sets itself to open at login in future.

If applescript is too limiting I don't mind using a cocoa applescript in Xcode, although I would like to avoid it.

هل كانت مفيدة؟

المحلول

Add it to the login items (like you mentioned.) Note that (to accomplish this easily) you have to save it as an application bundle.

Using this guide, you can automate the process.

tell application "System Events"
    -- Adding a login item for the current user
    make new login item at end of login items with properties {path:"/Applications/**{YOUR APP HERE}**", hidden:false}
end tell`
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى apple.stackexchange
scroll top