2

I want to ultimately create an executable file that will run a terminal command:

open -a "Google Chrome" --args --profile-directory="Guest Profile"

I want to know what other text and where to add into the Script Editor with the above command so I can create an executable file that runs that command. I would like to do it with out the Terminal window opening. But if it has to open, I would like to add some more code so that is closes.

If there isn't, there should be a Chrome extension that does this.

Thanks.

4

You can use the do shell script command, however, I've changed the double-quotes to single-quotes in the open command, so as not to have to escape them with a backslash character.

Example AppleScript code:

do shell script "open -a 'Google Chrome' --args --profile-directory='Guest Profile'"

You can save this as an AppleScript application.

Note that if Google Chrome might already be running and you want to be switching to e.g. Guest Profile, then change the -a option of the open command to: -na



On my system it opens Google Chrome with the following dialog box:

enter image description here

2
1

While user3439894 has provided the correct answer to your question, I would like to point out a simpler solution would be to use the Automator to create an application. Here you would not have to wrap the open -a "Google Chrome" --args --profile-directory="Guest Profile" command in do shell script. The steps are given below.

  1. Open the Automator application.

  2. In the window shown below, choose Application.

  3. Highlight Utilities under Library, then drag and drop Run Shell Script as show below.

  4. Enter your command, as shown below.

  5. Save as an Application. Below is an example.

  6. Quit the Automator application.

(Optional) Changing the Icon

I do not have Chrome installed, so I will use Safari for this example.

  1. Do a Get Info on both Safari.app and Guest Chrome.app. The following will be displayed.

  2. Drag and drop, the larger Safari icon on to the smaller Automator icon, as shown below.

  3. The result is shown below. Close both windows.

2
  • As this is opening Google Chrome, why would not not give the application its icon instead of Safari? -- Never mind, I just saw: "I do not have Chrome installed, so I will use Safari for this example." – user3439894 Feb 27 at 23:53
  • As I stated, I do not have Chrome installed. I used Safari just as an example. If you add how to to your answer, I will remove it from my answer. – David Anderson Feb 27 at 23:56

You must log in to answer this question.

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