How To: Key Press Events in Principle

#1

I’ve seen some threads on here asking how to use key press events in Principle.

This is a relatively simple workaround which allows you to control principle with key presses!

Keyboard%20Demo
First Download Keyboard Maestro. (There’s a free trial)
https://www.keyboardmaestro.com/main/

Keyboard Maestro is a super simple automation app which will allow you to click areas on the display via key presses.

Open Keyboard Maestro and add a new group for your macros. Under the first option select [Available in these applications > Principle] This will allow the macros within the group to only trigger within Principle.


Create a macro by pressing [Command N]. Click [New Trigger] then select [Hot Key Trigger]
Set the key press to whatever key you want.

Under “Will execute the following actions:” click [(+) New Action]
Then search the actions menu and find the [Move or Click Mouse] action and drag it into your actions area.
Make sure to change “relative to the” from [front window’s corner] to Absolute Position.

Open the Principle Preview window in full screen to make sure positions don’t change.

Then go back to Keyboard Maestro and within the “Move and Click” Action select the [Get] button.
A 5 second countdown will start so go back to the fullscreen Principle preview window and position the mouse over the element you want to click. Wait for the countdown to end and go back to Keyboard Maestro.

The finished macro should now look similar to this:
(you don’t have to the add sound action but you can to test if the macro is working correctly)


Once you’re done, exit out of edit mode by hitting the darkened [edit button] and test it out within the Principle Preview :slight_smile:

Extra Info and Fun Things

  • You can add multiple mouse clicks within the same macro, allowing you to activate multiple components all with one key press.

  • You can add dragging and holding behaviour to mouse click actions.

  • Create “invisible” (0% color opacity) trigger buttons which you map the mouse position macros to. This would be helpful if you wanted to simply tap through artboards OR to have hidden controls triggering multiple components.

  • Use if statements and the “Find image on screen” action to only allow keypresses when on certain artboards.

  • Keyboard Maestro is super powerful and allows many different input types to trigger macros. Control Principle through MIDI inputs, or even from a server trigger!

0 Likes

#2

This is amazing, very clever workaround, I’m sure many people will find this useful, thanks for sharing it!

1 Like

#3

Aaaah!!! brilliant exactly was i was looking for. I’ve been using Protopie for my prototypes lately but I can now move back to Principle. Huge thanks, Patrick

1 Like