Jump to content

dfay

Member
  • Posts

    1,054
  • Joined

  • Last visited

  • Days Won

    62

Everything posted by dfay

  1. Very nice - thanks for all your work on this - my approach to a workflow like this is always to do just enough to get it working for my needs, so I am always impressed when someone covers every option so exhaustively. Re: uf, my thinking is to always let the OS do the work if you can. (again I'm lazy ) I am enjoying using that ul command -- I've cleaned up dozens of dead links from notes imported from NVAlt & it's so much faster that wading through the Ulysses UI. Still, I feel like a lot of this would be a lot easier if the Ulysses devs would implement a rudimentary AppleScript dictionary. I'd really link to do a cross-linking script, i.e. create a link in sheet A to sheet B and automatically append a link in sheet B back to sheet A. But there's no equivalent in Ulysses automation to AppleScript's current document, hence no way to automatically get the title / identifier of the active document. I could use find or mdfind to get the most recently modified file (i.e. sheet A) immediately after pasting the link to sheet B, but that doesn't get me far b/c there's no way to get an identifier from a file as far as I can tell.
  2. I'd always prefer something native for accessibility to newer users and speed, but that sounds like a good solution if Andrew isn't forthcoming...
  3. Turns out the guy who wrote the Workflow workflow that I was looking also has a GitHub repo with a python version for the Mac: https://github.com/rovest/UlyssesReportAndMarkdown I haven't had a chance to check it out in detail.
  4. Please allow fuzzy search when "Alfred Filters Results" is turned on in a Script Filter. Thanks.
  5. Ok I've got it working. Here's the code for the script filter, which also requires that you check "Alfred filters results" and replace the access token in the code: #!/usr/bin/python import json import os import urllib def my_generator(json_input): if isinstance(json_input, dict): for k, v in json_input.iteritems(): if k == 'title': ti = v.replace('"', '').replace(',', '').replace(':','') elif k == 'identifier': arg = v elif k == 'type': subti = v else: for child_val in my_generator(v): yield child_val yield json.dumps({u'title': ti, u'arg': '['+ti+'](ulysses://x-callback-url/open?id='+arg+')', u'subtitle': subti}) elif isinstance(json_input, list): for item in json_input: for item_val in my_generator(item): yield item_val tmp = os.popen('/Applications/xcall.app/Contents/MacOS/xcall -url "ulysses://x-callback-url/get-root-items?recursive=YES&access-token=youraccesstokengoesHERE"').read() ulyssesLib = json.loads(urllib.unquote(tmp).decode('utf8')) items = json.loads(urllib.unquote(ulyssesLib['items']))[0] print('{"items":'+str(list(my_generator(items))).replace('\\\'','').replace('\'','')+'}') It searches the sheet/group titles for the query. it outputs a Markdown formatted URL, so to paste it into Ulysses you need to use Edit > Paste from > Markdown a.k.a. command-option-V
  6. Well I got a version of ul working last night, but it requires manually loading all the sheet titles and URLs into a list filter. From a CSV that's generated by a workflow in Workflow for iOS. Working as a proof of concept . Since there seems to be no way to get a sheet identifier from the sheet file itself, it seems we would need to use Ulysses get-root-items callback URL, and parse the whole library. I began to pick apart & try to replicate what the Workflow workflow does (it came from here: https://workflow.is/workflows/84934276b51643678643e1aa326637bd , & I modified it to output title, identifier, [title](ulysses url w/identifier) to a CSV), and convert it to write JSON which can then be read by a Script Filter. The xcall utility linked above was really helpful at that stage. Where I ran into trouble (and went to sleep) was at the stage of parsing the JSON. Here's the code I was running (in CodeRunner -- had to manually authenticate with Ulysses first, too): #!/usr/bin/python import json import os tmp = os.popen('/Applications/xcall.app/Contents/MacOS/xcall -url "ulysses://x-callback-url/get-root-items?recursive=YES&access-token=your token here"').read() ulyssesLib = json.loads(tmp)['items'] print (ulyssesLib) When I look at that output, it looks to me like it's a (long, messy) list of dictionaries but running type(ulyssesLib) says it's unicode.
  7. try http://starwars.wikia.com/wiki/Special:Search?search={query}&fulltext=Search in general, building web searches, you need to look at an actual search URL and figure out where the search term appears, then replace that with {query}
  8. My initial thought would be Option key and copy the link to the clipboard . But using ul instead you could then have copying to clipboard as default behavior and paste at cursor location as a modifier (or vice versa).
  9. Let me see. I have On My Mac turned off in Ulysses > Preferences > Library . I just tried turning it on & it's definitely empty (there's just the empty Inbox). Interestingly I added a sheet to it, and the workflow doesn't find it....but it's still showing everything else as being in 'On My Mac' And if I use the ug command, and search for 'On My Mac' it shows my groups as expected whereas if I search for "iCloud" (where they are) I get no results. Odd, isn't it? It's not really a problem since the workflow works perfectly otherwise. 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.
  10. 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.
  11. Wow this is looking great. I was writing some AppleScript to clean up a bunch of Ulysses sheets (by adding BibDesk keywords as native Ulysses keywords rather than hashtags, now that Ulysses keywords are exposed through the new URL scheme update) and found myself thinking someone should write a nice tidy API for the URL scheme.... 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.
  12. Big update to the URL scheme today: https://www.ulyssesapp.com/kb/x-callback-url/
  13. I got ExactScan b/c there was no native Mac driver for my scanner, & ExactScan supports it. It also lets you scan via AppleScript, with lots of customization options. Not cheap but may be worth it depending on your needs (it was cheaper than buying a new scanner, which sealed the deal for me).
  14. (this would be so much more pleasant if we could get human-readable names for the workflow directories....)
  15. Thanks That found update_settings in Search OmniFocus http://www.packal.org/workflow/search-omnifocus Date Calculator http://www.packal.org/workflow/date-calculator Ulysses http://www.packal.org/workflow/ulysses But none of mine (b/c I'm too lazy to set up updating ) But we should also be checking the library version for any of our own (and presumably any which the devs don't update too), correct?
  16. Is there any particular file or phrase we can search for to see if the update is necessary in any of our workflows?
  17. Good luck! I find the script here more useful than Accessibility Inspector: http://hints.macworld.com/article.php?story=20111208191312748
  18. Hmm. I did the 10.12.4 upgrade last night and now it needs to click pop up button 5 instead of 4 ... don't notice what changed in the UI but something must have. You may need to do some trial and error to get the correct pop up button # -- I use Mail Add-On and MailTags which modify the Mail window, so the # of the button may be different in your case. Such are the perils of being forced to use UI scripting. It may be an issue with the way Alfred calls scripts, and the handling of subprocesses / System Events therein. It's working for me with a Run Script > osascript (AS) > input as {query} object in the workflow. But...I just checked and it works as Run NSApplescript as well. Here's the exact code I am using with Run NSApplescript: on alfred_script(q) set theQuery to q set myComment to "xxxx@boards.trello.com" set theName to "Some name" set theAddress to "Some email address" set mySignature to "blank" try set the clipboard to myComment tell application "Mail" set theSelection to selection set theForwardedMessage to forward (item 1 of theSelection) with opening window tell theForwardedMessage make new to recipient at end of to recipients with properties {name:theName, address:theAddress} end tell activate tell application "System Events" to keystroke "v" using {command down} delay 1 try set message signature of theForwardedMessage to signature mySignature on error --BUG SIERRA tell application "Mail" to activate tell application "System Events" tell process "Mail" click pop up button 5 of window 1 delay 0.1 keystroke "b" --put here the first letter of the name of your signature delay 0.1 keystroke return delay 0.1 end tell end tell end try -- send theForwardedMessage end tell end try return theQuery end alfred_script
  19. If you look at the debugger are you getting messages there? (See https://www.alfredapp.com/help/workflows/advanced/debugger/ )
  20. set myComment to "xxxx@boards.trello.com" set theName to "Some name" set theAddress to "Some email address" set mySignature to "blank" try set the clipboard to myComment tell application "Mail" set theSelection to selection set theForwardedMessage to forward (item 1 of theSelection) with opening window tell theForwardedMessage make new to recipient at end of to recipients with properties {name:theName, address:theAddress} end tell activate tell application "System Events" to keystroke "v" using {command down} delay 1 try set message signature of theForwardedMessage to signature mySignature on error --BUG SIERRA tell application "Mail" to activate tell application "System Events" tell process "Mail" click pop up button 4 of window 1 delay 0.1 keystroke "b" --put here the first letter of the name of your signature delay 0.1 keystroke return delay 0.1 end tell end tell end try -- send theForwardedMessage end tell end try this worked for me (commented out the send for testing) this requires that you have a signature called "blank" that's active in the sending account
  21. Here's how I'd do it: create a Hotkey with Selection in MacOS as argument pipe that to a bash script object containing the following script: query=$1 echo "$query" | tail -r pipe that out to a Copy to Clipboard object, optionally setting it to paste to the frontmost app ....but this isn't going to capture HTML/rich styling or images. If Evernote lets you view the HTML source, you could select the source and run the same script - that would handle your images, then you'd need to run some other code to clean the HTML tags so the open and closing tags aren't flipped (there's the trick with HTML -- you're reversing the content, but the order of the tags actually needs to stay the same & not be reversed).
  22. Just looked a little more and found a workaround: http://macscripter.net/viewtopic.php?id=45184
  23. It looks to me like this is a bug in AppleScript (on Sierra at least). I tried a handful of Mail signature creation scripts and experimented with yours and none of them are working. See also https://gist.github.com/Moligaloo/3850710 . With Sal gone I fear it may never get fixed. But....Mail Act-On Outbox rules do work, so presumably they're accessing the signature some other way. It's $30 but if you work with a lot of email it's worth it IMHO.
  24. This is not an automator workflow, it requires the Alfred power pack.
×
×
  • Create New...