My friend pranked me by creating a batch file which opens a YouTube video and added it to the startup folder, so that the batch file launches every time I log in. This is what he wrote in the batch file:

start /min https://www.youtube.com/watch?v=Kob0G2hE8IY

On top of that, he scheduled the batch file to run every 10 minutes using Task Scheduler.

This is done on a Windows PC. So my question is, how do you do the same thing on a Mac?


The macOS counterpart is an AppleScript. You can create an AppleScript using Automator app and configure it to run upon system startup by going to System Preferences → Current User → Login Items.

To create the AppleScript, launch Automator.app. Under Library (in the left pane), select Utilities. From the centre pane, drag and drop Run Apple Script action into the pane shown towards right. Now enter the following script into the editor:

tell application "Safari"
    tell window 1
        set current tab to (make new tab with properties {URL:"https://www.youtube.com/watch?v=Kob0G2hE8IY"})
    end tell
end tell

This is how the final result will look like:

enter image description here

Now save the workflow by selecting File → Save... command. When saving change the File Format to Application.

Now go to System Preferences → Users & Groups, select your user under Current User and click on the Login Items tab. Click on the + button shown at the bottom and select the app saved in the last step. This will add the workflow that we created to the list of items set to be opened automatically when you log in.

enter image description here

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