Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make scriptable #101

Closed
lzilioli opened this issue Nov 27, 2023 · 14 comments
Closed

Make scriptable #101

lzilioli opened this issue Nov 27, 2023 · 14 comments

Comments

@lzilioli
Copy link

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

@marcus-crane
Copy link
Owner

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

@lzilioli
Copy link
Author

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!

@marcus-crane
Copy link
Owner

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

@lzilioli
Copy link
Author

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

@marcus-crane
Copy link
Owner

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

@lzilioli
Copy link
Author

lzilioli commented Jan 27, 2024

@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.

@marcus-crane
Copy link
Owner

@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 october@utf9k.net

@lzilioli
Copy link
Author

lzilioli commented Jan 28, 2024

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
Copy link
Author

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

Kobo Connected.txt

@marcus-crane
Copy link
Owner

marcus-crane commented Jan 28, 2024

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
Copy link
Owner

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
Copy link
Owner

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

@lzilioli
Copy link
Author

@marcus-crane Apologies for not following up here, I just switched my keyboard maestro integration over to the CLI and its working great. I have the macro configured to run /Applications/October.app/Contents/MacOS/October cli sync whenever I connect my kobo.

Good stuff, much appreciated.

@marcus-crane
Copy link
Owner

Neat! Thanks for the report 🙂

I haven't fleshed out the CLI functionality at all but I'll make sure to keep it intact

I really need to make a release checklist to keep track of all the stuff I don't personally use as part of my workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants