5

The script I have helps with my computers ability to edit videos. I only use my computer for editing. The script just activates a program that I have made. I want to be able open my computer after it has been shut down and get the program to open/run automatically.

I have tried to use the System Preferences' "open at log in" feature, but that doesn't work. Is there any other way?

The script I have is an application and the code is:

set appPath1 to path to resource "Opening 5.app"

tell application "Finder"
    open appPath1
end tell

When I double click the app, it opens up my program which changes the way FCPX renders, plays and saves videos.

5
  • Did u convert the script to an application then use the System Prefs login items feature?
    – airsquared
    Commented Sep 19, 2018 at 23:24
  • You said, "the script just activates a program that I have made"... please provide more details, what type of program did you make and why do you need AppleScript with this other program. Maybe posting the AppleScript code might be helpful too. Commented Sep 19, 2018 at 23:25
  • 1
    See here: AppleScript at Startup and specific time Commented Sep 19, 2018 at 23:27
  • @rubik's sphere, Good to see you, but if all he needs is for it to open at Login, the link you've provided maybe overkill however, lets get some actual details from the OP. Commented Sep 19, 2018 at 23:29
  • 2
    Why do you need to launch the app from another app to begin with? Have you tried adding "Opening 5.app" to Login Items instead of the AppleScript app? Commented Sep 20, 2018 at 2:10

3 Answers 3

6

I use this ..

  1. Open System Preferences.
  2. Go to Users & Groups.
  3. Choose your nickname on the right.
  4. Choose Login items tab.
  5. Press +
  6. Check startup programs you want to add.

enter image description here

For macOS Sonoma (>=14.0)

  1. Open System Settings.
  2. Go to General.
  3. Choose Login items tab.
  4. Press + At Open at Login.

enter image description here

2
  • 2
    The OP already stated: "I have tried to use the system preferences "open at log in" but that doesn't work " Commented Sep 20, 2018 at 0:06
  • 1
    This answer should work if and only if the original script is actually saved as an application.
    – DonielF
    Commented Sep 20, 2018 at 1:54
5

You should be able to just add “Opening 5.app” to the System Preferences » Login Items.

But if that doesn’t work for some reason, this sounds like the perfect job for a launchd .plist. They can be tricky to write, but there are two apps which are very good for getting the hang of them. The first is Lingon and the second is LaunchControl. They both have demos, and I would recommend trying them both and seeing which one you prefer.

If you're keen to learn more about launchd, a good resource is http://www.launchd.info.

Here's an example of how you might handle launching that app at login:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.tjluoma.opening5</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/open</string>
        <string>-a</string>
        <string>Opening 5</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Save that to ~/Library/LaunchAgents/com.tjluoma.opening5.plist (where ~ refers to your home directory).

When you reboot (or logout and then login), it should launch “Opening 5” at login.

4

If the script you provided is the actual script, you can launch “Opening 5.app” directly from the login items instead of the script.

If your script does other things not shown in your question, you can still use the script but you’d have to save the script as an application instead of a plain script to use it with login items.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .