Jump to content

vitor

Community Hero
  • Content Count

    3,147
  • Joined

  • Last visited

  • Days Won

    221

vitor last won the day on November 13

vitor had the most liked content!

About vitor

  • Rank
    Workflow Expert / Moderator

Contact Methods

  • Twitter
    https://twitter.com/vhgalvao
  • Website URL
    http://vitorgalvao.com/

Recent Profile Visitors

15,447 profile views
  1. And you’re only picking the first one ([0]), so there’s no need to use querySelectorAll. Documentation for querySelector: I find that unlikely, as I’ve been using those methods for a long time and they’ve always worked like that. Did you remove the [0]? No, thank you. I’ve already mentioned I’m not going to make another account. I was trying to improve your code.
  2. Disadvantage is that those are way more likely to change when they make updates to the page, as companies like to do. If you’re going to use [0], there’s no reason to use querySelectorAll, use querySelector instead: document.querySelector('button[class="control-button spoticon-skip-back-16"]').click().
  3. I’ve updated the Workflow to use it. Thank you for the help in detecting that.
  4. Does /usr/local/bin/xattr work, or does it give one of the errors? In line 68 of the downvid script (starting with xattr -w com.apple.metadata:kMDItemWhereFroms), if you replace xattr with /usr/bin/xattr, does that fix the Workflow for you?
  5. Nice debugging. Yes. You likely have a broken xattr. Run export PATH='/usr/bin:/bin:/usr/sbin:/sbin' (to mimic Alfred’s PATH). Run /usr/bin/xattr. If you got, ImportError: No module named pkg_resources, carry on with these steps. Other errors are harder to fix. Do /usr/bin/python --version. If you got a 2.7 version, your python installation has a broken version of setuptools. To fix, try sudo /usr/bin/python -m pip install -I setuptools. Done. Retry the Workflow. If you got a different version, the system python version is wrong. To fix, try 'defaults write com.apple.versioner.python Version 2.7'. Done. Retry the Workflow. Thank you. That was old code I never revisited.
  6. Welcome @wyldphyre, See the LabelColor Workflow (disclaimer: I’m the author) for a simple example on how to accomplish this. Replace the List Filter with a Keyword to give it text input. pbpaste is the tool you’re looking for (comes with macOS).
  7. I’d find it hard to believe that any Pinboard Workflow wouldn’t use a cache. Not doing so would be a fast way to be blocked from the service.
  8. In Ruby, you’d do this: require 'json' require 'pathname' script_filter_items = [] Pathname.new(ENV['HOME']) .join('Notes') .children .select(&:directory?) .each { |path| script_filter_items.push(title: path.basename, arg: path) } puts({ items: script_filter_items }.to_json) You can use that code as-is in a Script Filter (with Language set to /usr/bin/ruby) between your other steps in Alfred.
  9. The fact that you’re using AppleScript makes the task significantly harder. AppleScript is an awful language: it’s too different from other languages, lacks several features, and is badly documented. That in turn makes it that few people want to use it, meaning there’s less people to help you and less people making resources for you to learn from. AppleScript falls flat on its goal of being a language for people who don’t know how to program. It’s sole redeeming quality is that it can talk to GUI apps in a programatic way built into the system. But I advise you to use it for that alone, and get out and use something else as soon as possible. If you want to learn to program, do not start with AppleScript. It’s weighing you down. At the very least, as @deanishe mentioned in the thread you linked to, use JXA (JavaScript for Automation), which gives you the only good part of AppleScript in a better (yet still not good) language. AppleScript doesn’t understand JSON, you have to build it by hand and that’s not a good situation to be in. You want to use a language that can build the JSON for you from a simple list you give it. JavaScript (works with Alfred’s /usr/bin/osascript (JS)): const my_list = ['Red', 'Green', 'Blue'] // Your example list let script_filter_items = [] // We will build this array with the elements for the Script Filter my_list.forEach(element => { // For each item in your list script_filter_items.push({ 'title': element, 'subtitle': element, 'arg': element }) // Add them to the empty array }); JSON.stringify({ 'items': script_filter_items }) // Transform it into JSON Alfred understands Ruby require 'json' # We need the JSON gem, to be able to use JSON functions my_list = ['Red', 'Green', 'Blue'] # Your example list script_filter_items = [] # We will build this array with the elements for the Script Filter my_list.each do |element| # For each item in your list script_filter_items.push(title: element, subtitle: element, arg: element) # Add them to the empty array end puts({ items: script_filter_items }.to_json) # Transform it into JSON Alfred understands
  10. You may also connect a Hotkey Trigger (with Action set to Pass through to Workflow and Argument to Selection in macOS) to an Open File Action (leave the left side blank).
  11. We’re back to square one, then. Unless we get someone else with the issue, we’ll have to assume the problem is on your side.
  12. You’re in the Workflow Data directory for the shared resources. I mean the Workflow’s directory, as in right-click the Workflow in Alfred and pick Open in Terminal. Likely a remnant of how the script that deals with it used to work. You can delete it.
  13. Correct. I doubt this is the issue but let’s check anyway, one step at a time: open the Workflow’s directory in a Terminal and run ./Notificator.app/Contents/Resources/Scripts/notificator --message 'testing'. What’s the result?
  14. What are your versions of: macOS. ffmpeg. If ffmpeg -version doesn’t work, try ~/Library/Application\ Support/Alfred/Workflow\ Data/com.vitorgalvao.alfred._sharedresources/bin/ffmpeg -version. Alfred. DownVid.
  15. Welcome @aosaigh, Do you want step 2 to show a predefined set of directories (fixed), or all directories inside of ~/Notes (dynamic, changes depending on what exists)? Both are doable, but the former is simpler and doesn’t require programming. We can help you with either.
×
×
  • Create New...