Problem Solved: OS X Keyboard Shortcuts & IDE Scripts

In a few conversations, such as:, many were baffled at an apparent bug some where when assigning a keyboard shortcut to an IDE script using the OS X Keyboard Shortcuts.

Sometimes it will Load the file in the Script Editor, other times it will actually Execute the script as desired. Today when I experienced the problem again, it just snapped as to what is going on. It’s rather simple and obvious :-/

When you set the keyboard shortcut in OS X Control Panel, it does not take the full menu path to execute. It takes just the name of the menu item to execute. For example, “Format Code.xojo_script”. Well, it will always execute the script from the File > IDE Scripts > Format Code.xojo_script menu entry until you happen to Open that file in the script editor to make a change, view its content, or whatever.

At that point in time, when you press, say Ctrl+F to run Format Code.xojo_script, Apple now sees the menu in File > Recent > Format Code.xojo_script and executes that menu entry instead, which of course, opens the xojo script file in the script editor.

Clear your recently opened documents and Ctrl+F will begin to work as usual again.

Great catch, and luckily there is a solution. Define the menu item like this:

File->IDE Scripts->Script Name

It’s important start at the main menu and use “->” as the separator.

It’s also important to note that shortcuts that have Option in them will also cause the editor to open.

Yes, that’s a handy little shortcut.

File > IDE Scripts > Option Click a script will open it in the editor.