Jump to content

robwalton

Member
  • Posts

    48
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by robwalton

  1. On 7/14/2018 at 3:05 AM, PAUL R FONTENOT said:

    I would be greatly appreciative if you did that; that would be some real-world problem-solving.

    Thanks for the challenge. I only work on projects which I have some personal interest in though; and I have plenty of 'real-world problem-solving' to get on with already! Sorry.

  2. Hi @Altimor, @dfay, @EvanLovely & @Joel a,

     

    Thanks for the error reports. I've fixed this in v.1.0.4 to GitHub. Please let me know if it all works as expected and I'll push to packal.

     

    (The update to Ulysses 13 changed the file format of the plist file used to describe each group to a binary format not supported by the built in python library. At some point this thing will probably fail terminally as it ties in below Ulysses' supported API.)

  3. On 19/02/2018 at 2:13 PM, JPal said:

    Can I use the un command to append text to an existing sheet? In the description on GitHub it looked like that was possible, but I can't get it to work. Creating a new sheet works great, though. Not sure what I'm doing wrong... I would appreciate any help =)

    HI @jpal, unfortunately the `un` command does not append. I've removed the suggestion that it does from the doc.

     

    It would be a great feature, but I recall it being very difficult to add. The workflow reverse engineers the data structure stored on disk, and this does not give access to Ulysses note's UUIDs required for appending to a note via x-callback. Sorry. If I start using Ulysses again sometime in earnest I'll give it another shot.

  4. 21 hours ago, alfredclough said:

    There is one enhancement that would help me a bunch--the ability to open a sheet or a group in a new Ulysses window. I uses Ulysses for enough things that I frequently need to open something but not lose the sheet I have open already. I have a work around, but it would be great to have a modifier key or something that enabled opening a selected group or sheet in a new Ulysses window.

     

    I've added a ticket to GitHub as this is a good idea: Add modifier key to open group or sheet in new window .

  5. How would a ulysses temporary 'context' work?

     

    I'm finding myself spending more extended periods working in one group than I used to. I'm imaging two new commands:

    usc -- Select a group to act as a search-limiting context and open that group; no argument to clear.

    uc -- Open a sheet or group from within the search-limiting context; warns if no context set.

     

    Would anyone else use this? or any better suggestions!

     

  6. On 08/01/2018 at 4:23 AM, alfredclough said:

    Just want to say this workflow is amazing--it makes working with Ulysses so much more efficient.

    Thanks for the positive feedback. I've started using Ulysses after a bit of a break and I'm just remembering how the workflow works again!

  7. Hi @40-02, @apoc527, @dfay (thanks for the stack trace). Thanks for the reports that the workflow is broken with Ulysses 12.

     

    I had the same problem. Try this new release  v1.0.2. Please let me know if it looks okay and I'll upload it to Packal later and close issue. Thanks.

     

    EDIT: updated link to v1.0.2 as I've also fixed the 'uo' command to work with the new app name (although this one always has mixed results and I've tweaked the way it wants for ulysses to be ready to receive cmd-O.

     

     

     

  8. Hi @dfay, have been out for a while. How goes it?

    On 14/06/2017 at 3:29 AM, dfay said:

    Also - writing a callback handler in AppleScript and registering it is pretty easy - I have one that lets me create a new Ulysses sheet then pass the URL back to BibDesk to attach to a publication record , & I'm happy to share it and the links I used to figure it out if you're interested.  

     

    I had an attempt at packaging up something to make x-callback-url calls and then receive the callbacks. You might try https://github.com/martinfinke/xcall from the command line. I've put a python wrapper around it here: https://github.com/robwalton/python-xcall . I've not really used it in earnest, or checked it for race conditions or threads safety and whatnot. But it might help and it has tests so we might be able to improve it if you come across any issues! It may also be total overkill, if you've found a lighter way @dfay. I wanted something signed with apple that could be distributed easily.

  9. On 19/04/2017 at 6:42 AM, dfay said:

     

    Actually there's a typo in Rob's code … in ulysses_calls.py --  open_recent() should call the URL that patgilmour pasted above.

     

    Whoops! Thanks for spotting that. No tests for those bits. Have fixed the workflow on master. Will have to start thinking about a release when it settles down.

  10. On 20/04/2017 at 5:28 PM, robwalton said:

    This reminds me I meant to post about a weird issue I had last night. I kept getting a message "xcall.app is no longer running". In activity monitor there were like nine instances of xcall active.  I had to kill them all manually before the workflow would work again.

    Hi again, I tried pretty hard to reproduce by firing off call from threads in parallel, but seemed okay. I haven't checked if xcall is thrad/process safe yet, but a quick glance in the code makes me think not. For this, and your issue, python-xcall now throws an AssertionError if it finds xcall already running. There is 20-30ms period after making one call where a second will still go through though. It should help a bit--and it might help you diagnose want wrong for you? The real solution is (from the outside of xcall at least) is a file lock--but those cause so much grief! 

  11. On 20/04/2017 at 5:56 PM, dfay said:

    Just ran into another issue when I sat down at my iMac for the first time in a week....workflows sync via Dropbox but of course Ulysses authentication tokens are not the same from one Mac installation to another.  I think I will need to do something like this 

     and pass the authentication token when I call the script in the Script Filter.  Unless you see a better way.

    Thanks @dfay, I'll get this bit working in the workflow first. 

     

    I think that in bringing in the x-callback stuff, given the lack of tests in the workflow, I'll run old and new next to each other for a bit with some assertions. May still be a bit until I add your new commands, as will be working on foundations.

     

    Thanks for your ideas, work and debugging to date! --Rob

  12. On 13/04/2017 at 1:43 AM, dfay said:

    I poked around in the XML in the library a bit and it seems that the DisplayName for my root is set to "On My Mac" even though it is in fact in iCloud.  Seems like a Ulysses bug that is otherwise invisible but which the workflow may make evident by using the DisplayName?  Just a guess.

    Hi there, just integrating the x-callback stuff into ulysses workflow. I think I will go back to supporting iCloud only for now as this seems more trouble than its worth (unless you got further analysing it?)

  13. 22 minutes ago, deanishe said:

     

    @robwalton I'm looking over the workflow code. There's no need for such long imports. The AW API is defined in __init__.py.

     

    from workflow import Workflow3

     

    is enough, unless you're using some internal functions—at your peril ;)

    Thanks Python tutor :). I've fixed this on my local development version (it did feel a bit clunky at the time). I have a huge project in my day job which would could probably do with using defining  package APIs in __init__s. Will look at that too. I did a huge refactor of that a while back to make it less Java-like, but I guess I still missed some Python tricks.

     

    BTW, is there is there a good way to get Alfred to run off a git repo's working copy? Now I ask it: I guess I could just replace my e.g user.workflow.A661A55B-8CCD-4E74-BC15-54528262B74E folder with a symbolic link to my git working copy?

  14. 4 minutes ago, dfay said:

    This reminds me I meant to post about a weird issue I had last night. I kept getting a message "xcall.app is no longer running". In activity monitor there were like nine instances of xcall active.  I had to kill them all manually before the workflow would work again.

    Uh oh! I must have called it thousands of times with automated testing and haven't noticed this. But I noticed sometimes when calling ulysses with a wrong id there are long delays in returning. Possibly there might be other causes of this too. I wonder if your issue might be caused by making a call before another has returned and it all getting out of sync? I'll see if I can reproduce.

     

    Also, you mentioned a while back:

    Quote

    One thing I noticed, though, was that the authentication token I'd acquired earlier today no longer worked and I had to re-authenticate.  Have you been able to consistently use the same token without repeat re-authentication?

    I've not seen a problem with this one. Even if you request new token, old ones seem to keep working.

  15. I've extracted the xcall part of ulysses-python-client into a separate project python-xcall. I think this could be quite a handy tool and I'll try and put this up on PyPi if I can work out how to distribute the lib folder including Martin's xcall.app. Seems like pip wheels are the key!

     

    Then maybe after doing some actual work I'll include your ul command @dfayinto the ulysses workflow this thread is supposed to be about ;)

  16. On 17/04/2017 at 11:18 AM, deanishe said:

    Cool. Love the way you're using xcall.

    Thanks. Using xcall is an easy way to handle things and Martin signed it too so no brainer to use it. I haven't profiled it to see how much overhead there is in firing it up every time---in principle leaving the url-callback receiver part running would be quicker---but it seems to be fast enough. 100ms to Ulysses and back again for most calls most of the time.

     

    On 17/04/2017 at 11:18 AM, deanishe said:

    Couple of observations. I haven't been through all the code (let alone run it—I don't have Ulysses), but it seems to me that this line will explode if you aren't running it from your project root due to the relative path.

    Good spotting! I've fixed that.

     

    On 17/04/2017 at 11:18 AM, deanishe said:

    Also, the from ulysses_client import ulysses seems a little awkward. Would it not be better to rename the top-level package ulysses and import the API functions into __init__.py (or define them there), so you can just do import ulysses?

    Totally agree. I was a bit shy about taking the package name ulysses which is partly why it was awkward. Have followed your suggestions.

     

    I just need to do something useful with it now (like ul @dfay), to see what needs changing about the API.

     

  17. Hi @dfay, Looks like you've made good progress on the ul command. I've gone off on one and pretty much finished a full ulysses python client to the 23 calls described here and put it up at github. Example use:

     

    >>> from ulysses_client import ulysses
    >>> ulysses.get_version()
    u'2'
    >>> token = ulysses.authorize()
    >>> ulysses.set_access_token(token)
    >>> library = ulysses.get_root_items(recursive=True)
    >>> print library[0]
    Group(title='iCloud', n_sheets=0, n_containers=4, identifier='4A14NiU-iGaw06m2Y2DNwA')
    >>> print '\n'.join(ulysses.treeview(library[0]))
    ...

    Will use it (or about 5% of it!) to add an append command to the workflow and also your cool ul workflow fragment fairly soon.

     

    I was all fired up to replace all calls in the Ulysses workflow with this (rather than the reverse engineered file system parsing approach it currently uses). However, it would be hard or impossible to replace the uf find command at his point. This command currently uses spotlight to find the location on disk of entries who's internal content matches a query; and then uses this list of file locations to filter the richer structure built up from reverse engineering the library. The problem is that it would currently take a call to

    ulysses.get_quick_look_url(id)

    on every single node in the tree obtained via x-callback to get path that backs each node. (The Ulysses API has no find call.) I'll ask the Ulysses guys about this, but with this version of the Ulysses API it doesn't seem like I can do a full replacement---was hoping this would fix the muddle with 'On My Mac' items and provide access to external folders without more reverse engineering (also its always nice to throw away fiddly code!)

  18. 5 hours ago, dfay said:

    Is there any chance you could add a keyboard modifier to uf to copy the link to a sheet instead of opening the sheet?  Ulysses lacks an easy way to create links between sheets (the one thing I miss from abandoning NVAlt....) and this would be a great way to fill that gap. 

    This would be a very cool feature. I guess we'd just want to paste it at the cursor location of the currently open sheet? I loose track of keyboard modifiers: would this warrant a new ul (for link) command?

  19. On 11/04/2017 at 7:25 AM, dfay said:

    One quirk I've noticed with the Ulysses Alfred workflow -- even though i have "On My Mac" turned off in Ulysses prefs., and all my sheets are in iCloud, the subtitle for the workflow always shows the path as /On My Mac/correct path from here on out .  Everything else works, it just says my stuff is On My Mac instead of in iCloud.

    Sond like there are two issues:

    1. The workflow should only look in 'On My Mac' if preference is set.

    2. I don't see the 'On My Mac' prefixes that you see. Is it possible you once enabled 'On My Mac' and had some stuff in there? The workflow will find old things on disk---this would not account for everything having 'On My Mac' in front, but could cause confusion

     

    Will look at #1. Regarding #2, could you check that you don't have stuff in 'On My Mac' that be causing confusion

     

    P.S. Could just disable On My Mac support until I have time look at it properly. This was just a stepping stone to supporting external folders.

     

  20. On 11/04/2017 at 1:53 PM, deanishe said:

     

    On iOS at least, http URLs work fine with x-success. Theoretically, applications shouldn't care what the URL scheme is, as they just pass it off to the system to open.

    So I tried this out and unfortunately Ulysses won't send callbacks to html schemes. I asked Ulysses technical support and got a very quick and helpful answer. This is a deliberate choice for security reasons. They pointed me at a command line utility they'd made for calling a url scheme and getting a callback xcall. I'll go with this. Thanks for the suggestion though, it would have been tidy and self contained.

  21. It is a URL callback and that looks like a good library, thanks. I'll give it a go. If it worked it would bypass a lot of cruft (I have an old school fifo pipe in the mix too)---it depends, I guess, on wether ulysses is happy sending its callback's to an http server rather than a locally registered url application scheme tied by OSX to a specific application (described here).

  22. On 05/04/2017 at 2:53 PM, dfay said:

    Big update to the URL scheme today:

     

    https://www.ulyssesapp.com/kb/x-callback-url/

    I've started work on a ulysses python client on github. Need to work out how to create a call back receiver which is quicker: it currently takes .4s which adds up. Looks like you can leave an NSApplication running in an app bundle running rather than depending on AppleScript firing up each time as it does now (example). 

  23. I've uploaded a new version 1.0 to packal and github. Big improvements are the addition of uf find command to search inside content and the introduction of fuzzy searching (from @deanishe's workflow) to other search commands. Don't know I lived without those two @katie. Also updates Alfred-Workflow to fix hanging in Sierra and add's @dfay's code for opening or importing files--no appending yet.

    Quote

    version 1.0

    • Fixed 100% cpu hang on Sierra with update of alfred-workflow to 1.25.1
    • Added `uf` command to find groups and sheets based on their internal content
    •  u, ug and uf now use fuzzy search Ulysses' path to groups and sheets
    • Added un command to create new sheet with optional text
    • Added Alfred file actions to open text-like files in Ulysses or to import them
    • Added support for Inbox items
    • Added support for local Ulysses (non-iCloud) items (still no external folders)
    • Added warning when no iCloud files found
    • Fixed race condition with `uo` command when Ulysses is not activated

     

×
×
  • Create New...