Jump to content

deanishe

Member
  • Posts

    8,759
  • Joined

  • Last visited

  • Days Won

    522

Everything posted by deanishe

  1. I believe most of Alfred's icons are vectors created in code using Paintcode or the like.
  2. That's really an Excel question, and I think you'll have more luck asking on an Excel-related forum. I suppose it's possible there are some Excel scripting gurus kicking around on this forum, but I wouldn't hold my breathe.
  3. IIRC, I tried this ('cos I thought it would be an awesome feature to add to Searchio!) and "site:example.com" doesn't work (any longer) with Google auto-suggestions.
  4. No, you really can't. Indentation is semantic, so you have to indent your code properly. There are no anonymous functions or cryptic, Perl-/Ruby-like shorthand. The language itself lets you do crazy things if you really must, but it makes hard-to-read code more difficult to write than easy-to-read code. There are plenty of linters that show warnings if your code isn't PEP-8 compliant. They just don't rewrite the code for you, like gofmt does. The benefit of gofmt isn't to help write code, it's to help read other people's. If you don't even format your code properly, you should stop coding because you are definitely doing far worse things.
  5. I wasn't saying you should use the library. I was saying you could rip the GitHub JSON & semantic version parsing code out of it to build a OneUpdater-like updater (i.e. a single node that can be copied into any workflow) that uses GitHub releases. My Go library has the same feature. You can't use Go to build a OneUpdater replacement, though. My library hasn't been released. It's a prototype that I'm rewriting as I get more familiar with idiomatic Go. I don't think I've released a workflow written with it, either. Go isn't aimed at beginners. Most code/docs assume quite a lot of knowledge.
  6. Alfred 3 installs alongside Alfred 2. It won't delete any of your Alfred 2 data. IIRC (it's been a long time since I upgraded), it imports all your Alfred 2 data.
  7. You know Niki never reads the docs. He spends 20 minutes writing a post instead of 2 reading the docs/other posts in the thread. You haven't thought that through at all. It's a hardcoded URL. It's never going to change. If you want to download updates from GitHub releases, it's a more complicated process. You need code that can parse the JSON response from the GitHub API and that understands semantic version numbers (or whatever scheme you're using). That strikes me as an exaggeration, but if you find it such a chore, why don't you rip the update code out of Alfred-Workflow (which uses GitHub releases), and build an alternative to OneUpdater that pulls its updates from GitHub releases?
  8. I'll close this bug report, as it's not an Alfred issue.
  9. It's not unfixable: I had the same issue with OmegaT (another Java app) for years, but after a recent update to the app, snippets work as they should. I've no idea what exactly they changed, but I'm 90% certain it's something app developers can fix themselves. As best I can tell, the root problem is that NetBeans only checks whether the system clipboard has changed when the app is activated. It incorrectly assumes that another application can't change the clipboard while it's active.
  10. That is the most likely cause: Java apps have caused a lot of issues with snippet expansion apps. Java has its own clipboard and doesn't do a good job of keeping it in sync with the system clipboard. Do snippets start working again once you switch to a different application and then back again?
  11. Those are all issues with the applications themselves and the system, I'm afraid. Nothing Alfred can do to help there.
  12. Again, that's not Alfred JSON. It should be "icon": {"type": "fileicon", "path": "icon.png"}. That said, you are creating the correct JSON in your AppleScript. The problem is you're adding it to the list of items, not to an actual item: -- Create list to add items to set theItems to {} -- Create an item set theItem to json's createDictWith({{"title", "foo"}}) -- Set a UID theItem's setkv("uid", "this-is-a-uid") -- Add icon set theIcon to json's createDictWith({{"type", "fileicon"}, {"path", "icon.png"}}) theItem's setkv("icon", theIcon) -- Finally, add the finished item to the list set end of theItems to theItem
  13. Use a Launch Apps / Files Action. Drag OpenOffice and your folder into the list, and connect it to a Hotkey trigger.
  14. That isn't valid Alfred JSON. It should be: {"items": [ {"title":"foo", "uid":1}, {"title":"bar", "uid":2} ] } (uid is a sibling of title.) The corresponding AppleScript is: -- import JSON library tell application "Finder" set json_path to file "json.scpt" of folder of (path to me) end tell set json to load script (json_path as alias) -- Create and add items set theItems to {} set end of theItems to json's createDictWith({{"title", "foo"}, {"uid", 1}}) set end of theItems to json's createDictWith({{"title", "bar"}, {"uid", 2}}) -- Create root items object and encode to JSON set itemDict to json's createDict() itemDict's setkv("items", theItems) return json's encode(itemDict)
  15. JSON is that better solution. There is literally no easier-to-use data format for programs to communicate with each other. That's why JSON is so damn popular (even where it's not really appropriate). Especially in beginner-friendly scripting languages like Python and Ruby, turning a native dictionary to JSON isn't even a single line of code. In JavaScript, well, JSON is JavaScript. XML, by contrast, practically requires the use of a library to generate workflow feedback because XML is so awful to work with. That is to say, the problem isn't JSON or Alfred or Script Filters, it's that you aren't doing it properly. The reason for the difficulty is that you aren't writing a Script Filter, you're trying to write a JSON-generation library. Don't do that. Like I said, use a proper library for generating JSON instead of trying to mash strings together. Problem solved.
  16. @Andrew will correct me if I'm wrong, but I'm certain the XML support isn't going away (at least not in Alfred 3). There are too many very useful, but no longer updated, workflows that use it. What the deprecation means is that going forward, the XML format is frozen, and new feedback features will only be available if you use JSON (starting with the new variables objects in item and mod, and the ability to specify a different icon via a mod). Still, it wouldn't be a bad idea to use a JSON library with any new workflows you start. Personally, my approach has always been to write the absolute minimum AppleScript and write the rest of the workflow in a sensible language, calling the AppleScript as needed.
  17. Everything is a pain in AppleScript. But actually talking to apps is more difficult in JavaScript, imo. The API is awful and mostly undocumented.
  18. Or better yet, use JavaScript instead of AppleScript.
  19. Really, you should be using a proper JSON library. But "manually" generating it is fine for simple cases. What you want to do here is create a list of your lines of JSON, and when you're done, join them: on joinWithCommas(theList) set oldDelims to AppleScript's text item delimiters set AppleScript's text item delimiters to "," set theString to theList as string set AppleScript's text item delimiters to oldDelims return theString end joinWithCommas set theItems to {"first string", "second string"} set theJSON to my joinWithCommas(theItems)
  20. From my reading of your code, I think the issue is that you jump straight to the end date, figure out which days should have been excluded, and then adjust the end date accordingly (which you then need to repeat ad infinitum on the new range). Rather, I think the right way to handle excludes would be to increment/decrement the date one day at a time, ignore that date if it's excluded, and keep going until your count matches the requested delta: delta = 10 # wanted difference in days exclude = 'weekends' count = 0 # current difference in days current = start_date while True: if is_excluded(current, exclude): # some magic goes here continue if count == delta: # got result break # increment counter and current date for next loop current += timedelta(days=1) count += 1 print(current) # the requested end date
  21. @Empyreal: A File Action is just a trigger: it doesn't do anything on its own. You can add a Hotkey trigger and connect it to the same action the File Action is connected to. Set the Hotkey's argument to "Selection in macOS" and it should work.
  22. Put it in the workflow configuration sheet. If you call it, say, API_KEY, you can get it from a Python script with api_key = os.getenv('API_KEY'). This is described in the stickied thread on workflow variables. i don't have a final workflow. As I said, I just wrote that script without testing it. I'm happy to answer any questions, but I'm not going to repeat what's clearly described in the library's documentation. So, the answer is literally on the same page. And, the tutorial describes a workflow very similar to what you're trying to do. With the script I posted above and the rest of the library docs, you should be able to get very close to what you're trying to achieve. I'd be happy to look over what you come up with if there are any problems.
  23. By setting the autocomplete value on feedback items. TABbing on a result adds the full email address plus a trailing comma to the input. The workflow script treats everything after the last comma as a search query.
  24. As I said, "Python" and "Script Filter". You have a Run Script action with language set to Ruby. You also haven't installed the library. You should probably have a look at the tutorial.
×
×
  • Create New...