Jump to content

phyllisstein

Member
  • Posts

    366
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by phyllisstein

  1. Haha, so I did. Alright, since I'm having a hard time finding archived documentation for some of this stuff, I'm just going to focus on the compiled version and see if I can't get this working there. I've made some good headway in the past couple of hours, so check back in a bit (or keep an eye on Alleyoop).
  2. Okay, great, thanks! Try this: http://alfred.daniel.sh/Workflows/OpenMetaTags.alfredworkflow . I didn't spot any other obvious compatibility issues, so let's see how it goes.
  3. I think you may need to add an initial slash to your path, and watch the case sensitivity; try it with: >>> path = "/Users/theo/Desktop/tagtest.txt".encode("utf-8") I'm also reviving some old Objective-C tagging code, just in case.
  4. Curiouser and curiouser! Well, believe it or not, that could've gone worse. I can add a version check and not look for the second value in Python < 2.7. There's one other call to NSPropertyListSerialization that I'm a little worried about; if you have a tagged file you can try this on, that'd be great, otherwise I'll upload what I have and we can see what happens. Here's s'more code for the interpreter; as convention goes, lines that start with >>> should be input, and lines that don't are what the output ought to look like. >>> from Foundation import * >>> from ctypes import * >>> libc = cdll.LoadLibrary("libc.dylib") >>> path = "/Users/danielsh/Desktop/tagged.txt".encode("utf-8") >>> cPath = c_char_p(path) >>> data = create_string_buffer(4096) >>> name = "com.apple.metadata:kMDItemOMUserTags".encode("utf-8") >>> dataSize = libc.getxattr(cPath, name, data, 4096, 0, 0x0001) >>> dataSize 52 >>> nsData = NSData.dataWithBytes_length_(data, dataSize) >>> NSPropertyListSerialization.propertyListWithData_options_format_error_(nsData, kCFPropertyListImmutable, None, None) (( sublime ), 200, None) You'll have to enter the line path = ... by hand, since you'll need to give it the path to a file with tags. What we're looking for is for a positive number to come after dataSize, and three values, one of which is a list of tags, to be returned by NSPropertyListSerialization. If it's more or less than three, I'll have to add another version check.
  5. Sorry it's giving you so much trouble—I haven't been able to do any testing on 10.6. It'd be a big help if you could spend a couple of minutes in the Python interpreter for me, but I don't want to cause too much trouble; the other thing I can always do is rewrite it in Objective-C and trust that compiled code will be more reliable than interpreted code. Not something I mind doing, though it might take a day or two. Anyway, if you want to really debug the bastard, fire up a Terminal and run python. Paste the lines below in one at a time, hitting Return after each one: from Foundation import * t = NSMutableArray.arrayWithCapacity_(0) t.addObject_(NSString.stringWithCString_encoding_("foo".encode("utf-8"), NSUTF8StringEncoding)) t.addObject_(NSString.stringWithCString_encoding_("bar".encode("utf-8"), NSUTF8StringEncoding)) t.addObject_(NSString.stringWithCString_encoding_("baz".encode("utf-8"), NSUTF8StringEncoding)) t.addObject_(NSString.stringWithCString_encoding_("qux".encode("utf-8"), NSUTF8StringEncoding)) NSPropertyListSerialization.dataWithPropertyList_format_options_error_(t, kCFPropertyListBinaryFormat_v1_0, NSPropertyListImmutable, None) You shouldn't get any output from any of that until the last line; on my machine, hitting Return spits this out: (<62706c69 73743030 a4010203 0453666f 6f536261 72536261 7a537175 78080d11 15190000 00000000 01010000 00000000 00050000 00000000 00000000 00000000 001d>, None) It'd be a great help to know whether you get something similar. But, again, if you're not feeling Terminal, hang tight for a couple of days and I'll look into redoing it.
  6. Ah, yeah, that's what I thought. Try the version I just uploaded and see if it does any better for you; it's at http://alfred.daniel.sh/Workflows/OpenMetaTags.alfredworkflow and can be downloaded through Alleyoop.
  7. Since check_output was added in a fairly recent version of Python, it's possible that 10.6.8 doesn't ship with it. Could you open up a Terminal and run python --version and paste the output here? I'll meanwhile work on switching to an older subprocess call.
  8. Hey everybody, it's your old pal Daniel. I just wanted to share a workflow that I threw together this morning. I've gotten a number of requests for an alp tutorial that walks one through the process of making a workflow with Alfred 2 and alp one step at a time, and I needed a sample to look at as I was working. And lo, "Yourls Stats" was born. It's not especially complex, but it makes use of many of alp's more advanced features—some of which got slightly rewritten as I worked—to do something marginally useful. I thought I'd get it out there in advance of writing the tutorial to see if it had any lingering bugs. Enter "ystat" (or a keyword of your choice) to trigger the workflow. The first time you invoke it, it'll need to be configured; go to your Yourls admin site's "Tools" page and copy your secret signature token, then enter "ystat url=mysite.ly signature=0123456789" into Alfred. You'll note that the workflow guesses the location of the API PHP as you type, and that the feedback item won't be valid till both values are entered. Once they are, hit Return. Your signature token will be stored securely in the Keychain, your URL in cleartext in the workflow's settings JSON. Alfred will pop back up with your custom keyword already entered and begin downloading your Yourls data. Enter a query to search fuzzily through the links' titles and short keywords, and press Return to copy a link to the clipboard. You can download the workflow here, and, as always, do let me know if it breaks.
  9. Good news, everyone! I've just pushed a new version of the workflow that has Unicode working without a hitch. You can get it through Alleyoop or at http://alfred.daniel.sh/Workflows/Downer.alfredworkflow . Share and enjoy!
  10. Whoa, how did I manage to miss this?! Very well done, dear, I'm duly impressed! Would love to get a look at the Objective-C, if you've a mind to stick it on Github. Also, I'm gonna be a feature freak and ask: Since it looks like the workflow collects shortcut keys, is there any way to show them in its feedback? It'd be a boon for memorizing more esoteric Sublime key-combos.
  11. At the moment, it looks at all the individual files contained within any folders that you've downloaded or created. I may adjust that behavior, since it's not quite how I'd personally want it to behave either, but I'd like to get the UTF-8 issues straightened out first.
  12. @jkdram: The forum breaks every time I try to quote your post for some reason, but I keep trying to say that we should be able to solve this without listing all your downloads. Could you check the workflow folder for any .log files and either post their content here (they shouldn't contain anything sensitive) or e-mail them to me at d-at-daniel-dot-sh?
  13. Thanks for going to the trouble of looking up an article about it. That would work great if I just needed to print or manipulate the content, but there's a Python module called ctypes that complicates things a bit. I'm in the middle of finals right now, but I should be able to try something in a day or two. Sorry for the delay and the ajada!
  14. After pushing the last update, I got a lovely e-mail from raguay.customct with a great improvement to this workflow that adds PathFinder support to the "subl" keyword and the hotkey. You can download it via Alleyoop or at http://alfred.daniel.sh/Workflows/OpenInSublime.alfredworkflow . Thanks Richard!
  15. Jaysus, I can never seem to get this Unicode stuff right. I've just uploaded a new version to http://alfred.daniel.sh/Workflows/Downer.alfredworkflow that MAY fix the problem, but it's sort of a shot in the dark—ctypes confuse me to begin with, and the encoding stuff just makes it worse.
  16. Hah, sorry about that—I switched hosts and kept having to reconfigure from scratch. As God is my witness, never another custom mail server again ever. Should be consistently back up now. I thought about that, but I think there may be a fine line between killing an afternoon avoiding finals and totally rewriting Hazel.
  17. Hey all! I've just made some small changes to the workflow so that it can take advantage of alp's fuzzy searching functions, making it a bit faster and smoother. Otherwise things are mostly unchanged. Download the update through Alleyoop or at http://alfred.daniel.sh/Workflows/OpenInSublime.alfredworkflow The keywords are "subl" to list and open recent projects or the current Finder selection and "sub*" to do a Spotlight search for any file and pass it to Sublime. There's also an optional hotkey to open the Finder selection in Sublime immediately (mine's set to "⌥+⌘+↓").
  18. Now available here and via Alleyoop, a small upgrade that will hopefully provide some speed improvements. If it looks like it starts missing tags on your system after this update, let me know so that I can revert.
  19. Hello, fellow workers of flow! I've just thrown together a new workflow for managing your Downloads folder. Right now, it lists recent downloads, allowing you to open them (press Return), delete them (press Ctrl+Return), set their OpenMeta tags (press ⌥+Return, enter a list separated by spaces), and set their Finder label colors (press ⌘+Return). You can download it here. Be sure to let me know if anything breaks!
  20. I'm having the same trouble; devondb! returns 0 databases, but setup shows the expected output. My log reports that the databases file doesn't exist, which is indeed true; the folder isn't even in "Workflow Data." ./search: line 9: /Users/danielsh/Library/Application Support/Alfred 2/Workflow Data/com.markokaestner.devonthinksearch/databases: No such file or directory ./search: line 12: /Users/danielsh/Library/Application Support/Alfred 2/Workflow Data/com.markokaestner.devonthinksearch/databases: No such file or directory <?xml version='1.0'?><items> <item uid='13686176981' arg='all' valid='yes' autocomplete=''><title>All databases</title><subtitle></subtitle><icon>icon.png</icon></item> </items> user.workflow.29738129-4604-40FB-90DF-595F0EE93F50 danielsh$ ./setup C87C2F4E-376D-4834-87E1-B357835D91E4|Academy 8CE9316C-21C0-43FD-9DDC-7ECA91E8EA23|Inbox
  21. The documentation explains it in more detail, but with alp you wind up giving it a list—which you have—and a key function—which accesses a search string for each element in the list. If you wanted to fuzzily search names and descriptions, for example, you'd do this: alp.fuzzy_search(query, cache, key=lambda x: "{0} - {1}".format(x['name'], x['description'])) I should also note that your original code has the potential to generate unreliable results. There's no guarantee, in Python, that the for…in loop is moving through things sequentially, so iterating i within it could break it under certain circumstances. I think you could replace it with something like this, if that's the JSON form of the objects you're getting: for list in cache: name= list['name'] id = list['id'] # etc.
  22. Thanks so much for this workflow! (Also, your Alfred site is lovely.) I worked around this problem with my Things workflow by copying the database to a temporary directory, extracting what I needed, then deleting it; it's a hack, but it did the trick with Things.
  23. Sorry to be the bearer of bad news, but while the workflow triggered my iPhone's sync beautifully, the "Completed syncing" notification appeared almost immediately after the process had started. It was syncing over WiFi, so maybe it was moving slower than expected?
  24. Neat, great work! DEVONthink is so scriptable, I'm surprised I haven't seen more workflows for it; really just this and my own DEVONthink Note workflow.
  25. Although I don't know Alfred-Python, and so I'm not quite sure what the data you get from cache looks like, I think you just need to do something like this: name = cache[i]['name'] desc = cache[i]['description'] if query in name or query in desc: # do your string manipulation feedback.addItem(title=name, subtitle=desc, uid='bc' + str(id), valid=True, icon='basecamp.png', arg=url) feedback.output() My own Alfred module, alp, contains a fuzzy searching method contributed by Github user jlegewie that makes the searching a bit smoother, but it's hard to see how it would be implemented here without knowing more about the data you get back from cache—the iterator is throwing me for, as it were, a loop.
×
×
  • Create New...