macOS Service & script bundle

(Alberto González Ramírez) #1

One way to create a macOS service is via Automator.
I usually copy the script into an Run AppleScript action and it’s fine.
But, what if I wanted a specific icon, resources, etc, for the script?
I have thought to embed all into a script bundle.
Do you think…

  1. is it a good solution to call the script bundle via “run script” command inside Automator´s Run AppleScript action?
  2. Should the script bundle be placed in the Service folder (/Users/Alberto/Library/Services/)?

I think it could be a solution to have together the service (.workflow file) and the script bundle in the same folder so as not to have the files in different locations.

What’s your opinion?

Thanks in advance.

(Jonas Whale) #2

The best solution is to save your script as an Applet, giving it a bundle ID and a custom icon.
In Automator, tell the applet to run as you would do for any application:
Tell application ID "" to run

You can place this applet anywhere you want.

capture 001

(Mark Alldritt) #3

I think all you really need is a unique bundle ID. The custom icon is cosmetic only.

(Alberto González Ramírez) #4

Hi ionah. Thanks for your reply.