0
OS: OS X 10.9.1 Mavericks
Is it possible to execute any global hotkeys from the command line?
For example, if I wanted to copy and paste, is there a command to let me type the exact hotkey and execute it?
Like this (This command is just for an example, doesn't actually exists):
hotkey "ctrl+c"
hotkey "ctrl+v"
I know there's already a command to copy and paste "pbpaste" and "pbcopy", I was just using copy and paste as an example.
This would be very useful to execute commands that could be very lengthy on the command line. If you wanted to lock the computer on the command line you'd have to do something like:
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
If there's a command to execute hotkeys all you had to do is:
hotkey "ctrl+shift+eject"
Great answer! But is there another way to do this without using AppleScript? If there are no none, then I will accept your answer. Thank you for taking the time to write that, I appreciate it. – Timber – 2014-02-20T03:19:23.653
1@TimothyOnggowasito, If you're expecting to control user input (keyboard commands) there's really no other way in OS X that I'm aware of; if there was any other way Lauri Ranta might very well be the only person who would know. – l'L'l – 2014-02-20T22:35:31.073
@LauriRanta Looks like there are no other way, I will accept your answer and award this answer with bounty :). Thank your very very much! – Timber – 2014-02-23T05:30:21.057