-1

Is there a way to write a bash script that opens a program and then executes a menu shortcut of the program?

For example,

open XCode project -> Command + R to run

open Chrome -> Command + N for new window

I thought it might look something like:

$ open MyProject.xcodeproj | exec ⌘ r

  • As a general statement no, you can't do this. Some applications have ways of triggering application actions from outside (via script/etc.) but not all. – Etan Reisner Dec 09 '14 at 16:30

1 Answers1

0

Some apps provide command line API which you can use to trigger the actions.

Instead that you can use Automator.app on OS X and use AppleScript for GUI scripting. Here is similar question like yours:

AppleScript or Automator to click on menus in an application?

Community
  • 1
  • 1
rastasheep
  • 10,416
  • 3
  • 27
  • 37