How to run a keyboard shortcut via a file? - windows

Certain programs for Windows have specific keyboard shortcuts that execute specific functions. I was wondering if there is a way to create a small file that can activate any shortcut by clicking on it?
Example: Win+C opens up the charms bar in Windows 8. Can I create a file to click on that opens this function for me?
(I want this file to activate a different keyboard shortcut, not the one mentioned above in my example.)

It looks like you are trying to create a desktop shortcut.
To do so:
Use My Computer or Windows Explorer to locate the object to which
you want to create a shortcut.
Right-click the object, and then
click Create shortcut.
Drag the new shortcut to an open area on the
desktop.
You can also create a keyboard shortcut that will open or do whatever that shortcut would do if you opened it. See properties.
Reference: https://support.microsoft.com/en-us/kb/140443 (page no longer available since Windows 10)

Related

How to define a shortcut key for opening a terminal in Mac OS [duplicate]

One of my primary tools used for programming is my Terminal. It makes my programming process more efficient when I'm able to quickly open a Terminal window.
In Ubuntu, I was using (window+Alt+T) to open Terminal. But now I use a Macbook at my programming job.
Sometimes I use Spotlight to search "Terminal", and press Enter.
I'd like to know if I can assign a keyboard hotkey to do it.
I tested the following procedure under macOS Mojave 10.14.6 (18G3020).
Launch Automator. Create a document of type “Quick Action”:
(In older versions of macOS, use the “Service” template.)
In the new Automator document, add a “Run AppleScript” action. (You can type “run applescript” into the search field at the top of the action list to find it.) Here's the AppleScript to paste into the action:
on run {input, parameters}
tell application "Terminal"
if it is running then
do script ""
end if
activate
end tell
end run
Set the “Workflow receives” popup to “no input”. It should look like this overall:
Save the document with the name “New Terminal”. Then go to the Automator menu (or the app menu in any running application) and open the Services submenu. You should now see the “New Terminal” quick action:
If you click the “New Terminal” menu item, you'll get a dialog box:
Click OK to allow the action to run. You'll see this dialog once in each application that's frontmost when you use the action. In other words, the first time you use the action while Finder is frontmost, you'll see the dialog. And the first time you use the action while Safari is frontmost, you'll see the dialog. And so on.
After you click OK in the dialog, Terminal should open a new window.
To assign a keyboard shortcut to the quick action, choose the “Services Preferences…” item from the Services menu. (Or launch System Preferences, choose the Keyboard pane, then choose the Shortcuts tab, then choose Services from the left-hand list.) Scroll to the bottom of the right-hand list and find the New Terminal service. Click it and you should see an “Add Shortcut” button:
Click the button and press your preferred keyboard shortcut. Then, scratch your head, because (when I tried it) the Add Shortcut button reappears. But click the button again and you should see your shortcut:
Now you should be able to press your keyboard shortcut in most circumstances to get a new terminal window.
As programmers we want the quickest, most fool-proof way to get our tools in order so we can start hacking. Here are how I got it to work in MacOS 10.13.1 (High Sierra):
Option 1: Go to System Preferences | Keyboard | Shortcut | Services.
Under Files and Folders section, enable New Terminal at Folder
and/or New Terminal Tab at Folder and assign a shortcut key to it.
Option 2: If you want the shortcut key to work anywhere, create a new Service using Automator, then go to the Keyboard Shortcut to assign a shortcut key to it. Known limitation: not work from the desktop
Notes:
If the shortcut doesn't work, it might be in conflict with another
key binding (and the OS wouldn't warn you), try something else, e.g.
if ⇧⌥T doesn't work, try ⇧⌘T.
Don't spell-correct MacOS, that's not necessary.
iTerm2 - an alternative to Terminal - has an option to use configurable system-wide hotkey to show/hide (initially set to Alt+Space, disabled by default)
There is a third party app called hotkey app which can launch apps based on the configured shortcuts.
You can install it and setup required shortcut.
https://codenuts.de/en/posts/hotkey/
As others mentioned already, use the keyboard shortcut from services. I also had to restart the computer to take into effect.
mac - "command + t" will open a new terminal window.
Try command + t.
It works for me.

Is there a keyboard shortcut (hotkey) to open Terminal in macOS?

One of my primary tools used for programming is my Terminal. It makes my programming process more efficient when I'm able to quickly open a Terminal window.
In Ubuntu, I was using (window+Alt+T) to open Terminal. But now I use a Macbook at my programming job.
Sometimes I use Spotlight to search "Terminal", and press Enter.
I'd like to know if I can assign a keyboard hotkey to do it.
I tested the following procedure under macOS Mojave 10.14.6 (18G3020).
Launch Automator. Create a document of type “Quick Action”:
(In older versions of macOS, use the “Service” template.)
In the new Automator document, add a “Run AppleScript” action. (You can type “run applescript” into the search field at the top of the action list to find it.) Here's the AppleScript to paste into the action:
on run {input, parameters}
tell application "Terminal"
if it is running then
do script ""
end if
activate
end tell
end run
Set the “Workflow receives” popup to “no input”. It should look like this overall:
Save the document with the name “New Terminal”. Then go to the Automator menu (or the app menu in any running application) and open the Services submenu. You should now see the “New Terminal” quick action:
If you click the “New Terminal” menu item, you'll get a dialog box:
Click OK to allow the action to run. You'll see this dialog once in each application that's frontmost when you use the action. In other words, the first time you use the action while Finder is frontmost, you'll see the dialog. And the first time you use the action while Safari is frontmost, you'll see the dialog. And so on.
After you click OK in the dialog, Terminal should open a new window.
To assign a keyboard shortcut to the quick action, choose the “Services Preferences…” item from the Services menu. (Or launch System Preferences, choose the Keyboard pane, then choose the Shortcuts tab, then choose Services from the left-hand list.) Scroll to the bottom of the right-hand list and find the New Terminal service. Click it and you should see an “Add Shortcut” button:
Click the button and press your preferred keyboard shortcut. Then, scratch your head, because (when I tried it) the Add Shortcut button reappears. But click the button again and you should see your shortcut:
Now you should be able to press your keyboard shortcut in most circumstances to get a new terminal window.
As programmers we want the quickest, most fool-proof way to get our tools in order so we can start hacking. Here are how I got it to work in MacOS 10.13.1 (High Sierra):
Option 1: Go to System Preferences | Keyboard | Shortcut | Services.
Under Files and Folders section, enable New Terminal at Folder
and/or New Terminal Tab at Folder and assign a shortcut key to it.
Option 2: If you want the shortcut key to work anywhere, create a new Service using Automator, then go to the Keyboard Shortcut to assign a shortcut key to it. Known limitation: not work from the desktop
Notes:
If the shortcut doesn't work, it might be in conflict with another
key binding (and the OS wouldn't warn you), try something else, e.g.
if ⇧⌥T doesn't work, try ⇧⌘T.
Don't spell-correct MacOS, that's not necessary.
iTerm2 - an alternative to Terminal - has an option to use configurable system-wide hotkey to show/hide (initially set to Alt+Space, disabled by default)
There is a third party app called hotkey app which can launch apps based on the configured shortcuts.
You can install it and setup required shortcut.
https://codenuts.de/en/posts/hotkey/
As others mentioned already, use the keyboard shortcut from services. I also had to restart the computer to take into effect.
mac - "command + t" will open a new terminal window.
Try command + t.
It works for me.

Xcode 4: Keyboard shortcut for switching Assistant Editor to Tracking (Automatic) mode?

I like using the Assistant Editor in Xcode 4. I frequently Option-Click files to open them in the Assistant Editor, or use Open Quickly (Command-Shift-O), and hold the option key when selecting a file to open it in the Assistant Editor.
Both of these actions switch the Assistant Editor to Manual mode. Is there a keyboard shortcut to switch the Assistant Editor back to Tracking mode (also called Automatic)? In tracking mode it automatically shows the counterpart, e.g. the corresponding header/implementation file for the file in your main editor. know I can select Automatic mode it with the mouse on the Assistant Editor Jump bar, but I really want a keyboard shortcut to do this.
I made this to help answer another question... Does it help?
In the View -> Assistant Editor menu, there's an item called "Reset Editor". The default keyboard shortcut is Cmd-Opt-Shift-Z. It resets the Assistant View to show Counterparts.
I don't know if it's new in Xcode 4.1, but it should be a little easier than AppleScripting.
Alternatively, you could create a behavior to reset the editor how you'd like and bind it to a keyboard shortcut.
You can do it, but not with just a single "standard" keyboard shortcut. Assuming that you have just Option-Clicked on a file and opened it in the Assistant Editor, you would do the following steps to switch to "Counterparts" mode in the Assistant Editor:
If your focus is not on the Assistant Editor, press Command-Option-.
until you are on it.
Once focus is on the Assistant Editor, press Control-4 to drop down
the Assistant Editor menu.
"Manual" will be selected so Press DownArrow once to select
"Counterparts" and press Enter to switch to the counterpart of the
file in the main editor.
If this is too many keystrokes, you can put the keys for steps 2 & 3 in an AppleScript script and bind it to a key.

Windows 7 right click "Send to" file context menu

When I right click a file (in any folder) I see an option "Send to" and inside
Desktop
Documents
...
and a bunch of other locations.
How can I add my own location, ie "C:\stuff" to this context menu?
Open file explorer and navigate to: %APPDATA%\Microsoft\Windows\SendTo
Once in the SendTo folder, right click -> New -> Shortcut
In addition to the default shortcuts in the SendTo menu, there are hidden options that are exposed if you hold down shift while right clicking the targeted icon.
(This is Windows 7 only)
The easiest way to add your own is to type "shell:sendto" in a file explorer, ( or start -> run -> sendto ) and place whatever shortcut you deem useful. As mentioned before you can add shortcuts to programs as well as directories.
(This is more universal)
HERE is a nice article with a picture instructions.
in addition to shortcuts to folders, you can add shortcuts to apps. for example, add a shortcut to "send to notepad" to open a file in the notepad app. a useful function for a developer.

Launch default editor in Xcode

I've configured MacVim to be my default editor in Xcode. I can invoke it from Xcode by double clicking the file in the project view. Is there any keyboard shortcut I can configure or invoke to open the file being viewed in the Xcode editor in my default configured editor?
I am using Xcode 4.3. You can assign a shortcut to open the file in an external editor using the menu item File/Open with External Editor. To assign the shortcut you will need to go to System Preferences/Keyboard/Keyboard Shortcuts, choose Applications Shortcuts, click on the plus button, choose Xcode from the drop down menu, write 'Open with External Editor' in the Menu Title field and choose your shortcut.
Try Option-Command-O - if that doesn't work then you may need to go to Key Bindings in Preferences and set it up (I use the BBEdit Compatible key bindings which include this shortcut as standard).
I made a little write up here fwiw:
https://tmsh.github.io/visual-guide-opening-files-externally-xcode/

Resources