Creating New Ulysses Sheet

Hello,

I'm trying to create a few of my first KM macros and am running into some trouble with one.

I'm trying to assign the keyboard shortcut ⌃N to Open Ulysses, go to my Inbox group, create a new sheet, and then insert a TextExpander snippet for my basic note.

When I press the shortcut it seems to do the last step (the ;uly) while still in the open dialog, like it's getting ahead of itself. I've tried adding in manual pause actions, and running through the macro step by step in the debugger (which works perfectly), but I still can't get it to work properly with the keyboard shortcut.

Any tips for this KM novice would be greatly appreciated :slight_smile: I've read great things about this application and really want to get it automating things well for me!

Thanks,

-Cody!

Hello, I added the pauses to the macro, otherwise the process is too fast. Please adjust the pauses (yellow) of your hardware. Maybe they need to be longer.

You can download the macro here

Ulysses_Test.kmmacros (5,3 KB)

Ulysses_Test

The macro in action:

ScreenFlow

This is how it looks in my workflow when I work with Ulysses, TextExpander, PDFpen Pro (OCR) and Hazel 4 (folder) & Keyboard Maestro macros :wink:

1 Like

Another approach would be to use Ulysses URL Scheme to create a new sheet in the inbox.

In this link, is the reference:

Ulysses X-Callback-URL Support

Keyboard Maestro 8.1.1 “New Ulysses Sheet copy” Macro

New Ulysses Sheet copy.kmmacros (1.9 KB)

2 Likes

Thank you @unlocked2412 for your posted macro. That saves a lot of work. I didn't know this possibility until now.... you never finish learning :wink:

Wow, thanks so much @appleianer and @unlocked2412 This is all really helpful!

I’ve heard of the Ulysses X-Callback-URL before, but TBH I had no idea how to even use/understand it :stuck_out_tongue_winking_eye: But it seems to be a great thing in this case since it’s built in by the developers themselves.
@unlocked2412 I’ve switched out the variable from “Hello world” to my TextExpander snippet, but it isn’t expanding. It’s just leaving the snippet ‘;uly’ Any clue on how to get that snippet to expand after properly?

1 Like

Hi Cody,

First, let me say I highly approve of your Link avatar :sunglasses::+1:t2:

As to your snippet, what does it expand to? If it’s not too complex and/or reliant on TextExpander-only functionality, I think it might be easier and more robust to replicate it in KM and use that in place of the “Hello World” variable.

2 Likes

It really isn’t a complex snippet. It expands to:
(#
(##

(-
(-

So an H1, H2, a return, and a couple of empty bullet points (without the parenthesis). And then having the cursor inserted back at the H1. I know I could just fill that Markdown in the KM variable, but is KM also able to control the cursor location too?

And thanks, this version of Toon Link is one of my favs :sunglasses:

1 Like

KM is indeed able to control the cursor location with the %|% token, so in KM parlance, you could recreate that snippet like this (you can use backslashes here to escape markdown characters like # and - so that they show up as intended):

#%|%
##

-
-

Unfortunately, that won't work when included as part of a URL like this, so you would need to stick with your original idea and have it inserted in the newly created Ulysses sheet once Ulysses is frontmost (especially since it seems like you want to use this macro to quickly start typing, which the x-callback URL scheme doesn't seem to help with since, at least in my tests, it doesn't bring focus to the newly created sheet). Here's a version of your original macro idea that uses Pause Until and Select or Show a Menu Item actions along with the snippet that positions the cursor (in my experience, I've found the former to be faster than arbitrary Pause actions, and the latter more precise then simulated keyboard shortcuts):

New Ulysses Sheet.kmmacros (6.5 KB)
01 PM

Feel free to post again if you have any further questions!

I’m sure the text snippet would need to be URL encoded. As a sample try a %20 instead of a space. (That’s a percent char, followed by a 2, and then a 0.)

I did a lot of research and found that it’s possible to return a value from x-callback urls, making possible to open the newly created Ulysses Sheet.

Also, it’s possible to expand Text Expander abbreviations via Applescript (version 6.2.2 onwards).

I didn’t test that feature as I’m not a TE user myself, but apparently it’s possible with expand string command:

tell application "TextExpander" to expand string ";uly"

Improved macro:

Keyboard Maestro 8.1.1 “Create New Ulysses Sheet & Open” Macro

Create New Ulysses Sheet & Open.kmmacros (3.7 KB)