2

I've seen a few questions dealing with this issue but nothing recently. I'm not sure if El Capitan (10.11) is breaking something, and I'm an AppleScript (and Automator) newbie.

I just want to have the basic functionality where a keyboard shortcut opens a new terminal window in the space I'm in. After doing the following things, absolutely nothing happens when I trigger the keyboard shortcut

1. Create an Automator Service

  1. Open Automator and choose Service for my document type.
  2. Set Service recieves selected to no input
  3. Drag a Run AppleScriptaction into my workflow.
on run {input, parameters}
    tell application "Terminal"
        do script ""
        activate
    end tell
    return input
end run

(At this point, running the workflow from automator by pressing Play opens a new terminal window correctly).

  1. Save the service as Launch New Terminal Window

2. Assign a Keyboard Shortcut

  1. Open System Preferences -> Keyboard -> Shortcuts -> Services
  2. Assign Shift Command T to Launch New Terminal Window

When I try my new command, nothing happens.

Note, I tried to delete the service and retrace my steps. When I recreated a new service with the same name, the keyboard shortcut was remembered by the system. Does anyone know which .plist/where these keyboard shortcuts are saved?

If anyone can help me out, that would be great. A 30 second project has turned into 30 minutes of hair pulling.

Water Crane
  • 43
  • 1
  • 9
  • [Try this.](http://superuser.com/questions/466619/open-new-terminal-tab-and-execute-script) – Craig Smith Apr 03 '16 at 22:50
  • @CraigSmith That doesn't really seem to solve anything. I don't have a problem running the AppleScript, I have a problem linking it to the shortcut. – Water Crane Apr 04 '16 at 01:27
  • I see. As for the location, it should be in this folder: ~/Library/Services. I also found [another possible solution.](http://superuser.com/questions/553107/keyboard-shortcut-for-service-in-os-x-doesnt-work) – Craig Smith Apr 04 '16 at 01:40
  • @CraigSmith Thanks for the link. Unfortunately, the issue is that the service appears but my keyboard shortcut doesn't work. The link specifies issues in 10.7 and 10.8, but hovering doesn't seem to solve the issue for me. – Water Crane Apr 04 '16 at 17:46

4 Answers4

2

I also encountered a similar problem. The issue is that, most probably some other application is using the key combination that you tried. You can check by using a bizarre key combination and check whether it works and then modify it. Try using something like Shift + alt + command + G. Or something like this ( use at least 4 keys ). It worked for me. Hope it helps you.

2xSamurai
  • 1,221
  • 12
  • 18
1

For future reference, since it seems a very common question, I think the only reason why a shortcut won't work is that it's being used by other application, as 2XSamurai said.

You can have quick feedback if the shortcut is going to work or not by navigating to Finder and then Services.

If your brand new shortcut is showing next to the service you created, that means is going to work, otherwise, it won't.

No need to perform other actions, you just need to pick a good shortcut. Somewhere on the web, you may also read that you must include the command key to make your shortcut work. That's also not necessary (see the screenshot with just ctrl + T combination working just fine).

PS I can't post pictures on answers yet so StackOverflow generated links to the images instead, but this caused the answer to broke (I was getting a message error stating there was code in my answer (??), so no screenshots, sorry, I hope the answer is clear enough even without them :)

gmc
  • 11
  • 3
0

I did exactly what you've described (Automator Service, no entry, only one Applescript Action, and assign the Automator Service to short cut key (in my case command shift Y).

All is working OK on my ElCapitain with bellow script in Automator action : (I mean the short cut opens a new Terminal window as expected)

tell application "Terminal" to activate
tell application "System Events"
tell process "Terminal"
    keystroke "n" using {command down}
end tell
end tell

But I still ask myself the basic question : what do you really want to achieve ? usually the bash instruction could be done in do shell script command...no need for Terminal window... may be you have an other constraint.

pbell
  • 2,965
  • 1
  • 16
  • 13
  • I just want to open a new terminal window in whatever space I'm in regardless of how many other spaces and windows I have open (ala what I'm used to on my arch machine) :P I'll try your constrained version. – Water Crane Apr 04 '16 at 18:15
0

I had the same problem before, solved it somehow, forgot about it and ran into it again when setting up a new MacBook today.

This solution works for me on several Macs:

Instead of using System Preferences -> Keyboard -> Shortcuts -> Services (screenshot 1 - for some reason I'm not allowed to insert pictures directly into posts) you can use

System Preferences -> Keyboard -> Shortcuts -> App Shortcuts (screenshot 2).

There you have to spell out the name of your service.

There are some issues with the App Shortcuts menu as well. For example a shortcut for the "Tags..." menu in Finder simply won't work but for services it works for me.