Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to run safari automator service?

I'm trying to run a Safari automator service, to close tabs to the right (like in Chrome). I found a webpage (https://redfinsolutions.com/blog/close-tabs-right-safari) with the following steps, which I've followed to the letter (I think), but I can't get the service to appear in the Safari -> Services list. Steps below:


  1. Open Automator on your Mac, and create a new "service."
  2. For actions to run, choose "Run AppleScript," and enter the following AppleScript:
    tell window 1 of application "Safari"
    close (tabs where index > (get index of current tab))
    end
    view rawgistfile1.txt hosted with ❤ by GitHub
    (which I thieved from this blog post.)
  3. Once you have that, save it - I named mine "close-right" (and I saved it to my iCloud, but I think you can put it anywhere).
  4. Now, one option is to show the script editor dropdown in your toolbar, and choose the script from there, but I've already got enough stuff there, so I'm just going to set up a keyboard shortcut for it instead. Open up "System Preferences" on your Mac, then pick "Keyboard."
  5. Here, you should select "App Shortcuts" and add a new shortcut for the "Safari" application. When asked about the menu item, you need to use the exact text that appears under Safari > Services for your new service (it should be the filename, like "close-right").
  6. Assign a keyboard shortcut (I used Command-Shift-Z).
  7. Now in Safari, when you press Command-Shift-Z, it closes tabs to the right of the one you're looking at!


The script does it's job when it runs, it's just the part of getting it to run outside of automator. I think the problem is in automator where it says "Service receives selected" and there's the drop-down list of options, which the guide fails to state what option it should be. The option after that list is "in" and the author later said that that option had to be "Safari.app", which I've selected.


For the "Service received selected" option, if say I select the option "text", then I can get the service to appear in Safari -> Services when I select some text on a given webpage, and then the service runs no problem (including the keyboard shortcut). Obviously though, I don't want to have to select some text every time I want to close the tabs to the right. I've tried the "web content" and "no input" options, but they still don't make the service appear in the Safari menu.


Any help would be greatly appreciated!


Cheers.

Lee

Posted on Nov 18, 2017 1:25 AM

Reply
Question marked as Best reply

Posted on Nov 18, 2017 1:38 AM

*** It's ok, I think I've found the solution now. You need to select the "no input" option for the "Services receives" drop down list in the Automator service. I had previously done this, to no avail, but after a few minutes it appeared. I'd previously selected this option and then restarted Safari, and it still hadn't appeared, so I had ruled it out. Maybe it was just a glitch at my end which caused the delay in the option appearing, but whichever way "no input" is definitely the solution. ***

1 reply

There are no replies.

How to run safari automator service?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.