october icon indicating copy to clipboard operation
october copied to clipboard

Make scriptable

Open lzilioli opened this issue 2 years ago • 10 comments

I intend to use keyboard maestro to automatically sync my kobo highlights to readwise via october whenever I plug my kobo into my macbook, however for this to work, october would need to be scriptable.

This relates to #24

lzilioli avatar Nov 27 '23 16:11 lzilioli

Ah hey, thanks for expressing your interest 🙂 I'd need to do a bit of untangling to get a CLI working, as the codebase is a bit of a mess but hopefully as it's quieter during the holiday season, I'll have more time to sit down and figure out a plan

marcus-crane avatar Nov 27 '23 20:11 marcus-crane

For now I was able to get this working using keyboard maestro's recording feature using click + window offsets. Thank you for this excellent piece of software!

lzilioli avatar Nov 28 '23 00:11 lzilioli

Ah nice, glad to hear it 😅 It's definitely not as polished as I'd like it to be so nice words of encouragement are always appreciated to remind me to get back into the project haha

marcus-crane avatar Nov 28 '23 02:11 marcus-crane

Will keep watching this issue, as I would still prefer a headless mode, but just wanted to say thanks again. Cheers 🥂

lzilioli avatar Nov 28 '23 07:11 lzilioli

Hey there,

A pre-release version that includes a barebones CLI tool is available here if you want to give it a test: https://github.com/marcus-crane/october/releases/tag/v1.9.0-beta1

marcus-crane avatar Dec 30 '23 10:12 marcus-crane

@marcus-crane apologies for the delay, but I just tested this today, and switched my automation over to use the CLI. When run manually, this looks good on my end! M1 MacBook Pro running macOS 14.3

However when I run it from keyboard maestro, oddly the application launches (and will launch multiple instances) and it doesn't seem like any syncing is happening behind the scenes.

lzilioli avatar Jan 27 '24 19:01 lzilioli

@lzilioli Ah nice, I still need to officially release it but before I do that, I'd like to have some way to add and edit settings files so that a user could reasonably use the CLI by itself without having to open the desktop app at all

I haven't used Keyboard Maestro before myself but I've installed a free trial. Would you be able to send me a copy of the macro you've got set up so I can try to replicate the issue? You should be able to share it here (if there's nothing sensitive) or email it to [email protected]

marcus-crane avatar Jan 27 '24 21:01 marcus-crane

GitHub forced me to change the extension, but if you change it back to .kmmacros you should be able to import it directly. Thanks a ton @marcus-crane

Kobo Connected CLI.txt

lzilioli avatar Jan 28 '24 17:01 lzilioli

Here is the one that currently works for me, which uses click offsets to interact with the october window directly

Kobo Connected.txt

lzilioli avatar Jan 28 '24 17:01 lzilioli

Thanks for sending that though and yeah, I can replicate it on my end as well.

The issue seems to be related to how Keyboard Maestro is invoking shell scripts as the shell environment it's using isn't considered to be a proper tty which means the check at the start of October doesn't pass and the desktop app gets launched instead

CleanShot 2024-01-29 at 12 39 39@2x

For these sorts of cases, it might just be easier to add a magic environment variable that gets checked on startup than trying to figure out all the various automation tools that exist and how to configure their execution environments (if it's even possible)

Anyway, I'll look into doing that shortly

marcus-crane avatar Jan 28 '24 23:01 marcus-crane

Hey there,

I'm finally getting back to this after some life stuff has been moved out of the way. I've just released a new pre-release version that changes from trying to magically detect a terminal to moving CLI invocation to a subcommand so eg; October cli sync

I ran this through Keyboard Maestro and it seems to do the trick but I'd be interested to know if it works for you.

I'm just about to test this out on Windows and Linux so hopefully I'll release it properly later today if there aren't any unforeseen issues

marcus-crane avatar Jun 08 '24 04:06 marcus-crane

Hey there,

I've just released v1.9.0 which should close out this issue. I fired up the Keyboard Maestro script you had shared and it all seems to work fine. Feel free to open a new issue if you run into any issues.

Thanks again

marcus-crane avatar Jun 10 '24 07:06 marcus-crane