Jump to content

deanishe

Member
  • Posts

    8,759
  • Joined

  • Last visited

  • Days Won

    522

Everything posted by deanishe

  1. Anything the script outputs on STDOUT is the {query} for the following action. So echo or print depending on language.
  2. If you want to pass some data other than a file or URL to an application, you have to do it a different way. Remove your Open in App action and replace it with a Run Script action. Set language to /usr/bin/osascript (AS) and paste this in the Script box: tell application "HoudahSpot" search "{query}" activate end tell Connect it to your keyword and you should be good to go.
  3. There's little point using environmental variables, as Alfred doesn't use your (shell) environment. Apps use launchd's environment, which is pretty much empty. Your best bet is to store user-specific settings in the place Alfred expects you to: ~/Library/Application Support/Alfred 2/Workflow Data/YOUR.BUNDLE.ID Anything you put in the workflow directory gets deleted when the user updates the workflow. If you're using Python, this library will help. It can even store the API key in Keychain for you. To do it "ghetto" style, set up your workflow to run bash scripts and then call Python scripts from the Script box like in a shell (this is a good practice anyway). You can then set the envvar in the wrapper: [[ -f "$HOME/.workflow_api_key" ]] && { export API_KEY=$(cat "$HOME/.workflow_api_key") } /usr/bin/python myscript.py --option "{query}"
  4. You bundle the dependency with your workflow. End of discussion, basically. cd to your workflow in a shell and run: pip install --target . requests Asking users to install libraries is a PITA, and is very likely to cause problems down the line as Python doesn't support versioned libraries. Anything that can't be bundled probably has C extensions that need compiling, which is a world of hurt for the person supporting that.
  5. Alfred Preferences > Features > Terminal / Shell What have you got set in there? That determines how Alfred runs commands in Terminal/iTerm/whatever, including via Terminal Command actions.
  6. AppleScript is your friend. Unfortunately, Terminal's scripting support sucks, so you have to simulate keyboard shortcuts instead: tell application "System Events" tell application process "Terminal" set frontmost to true keystroke "t" using command down end tell end tell On my machine, that opens a new Terminal window if none is open, and creates a new tab in the front window otherwise.
  7. Do you have any other Python-based workflows? Do they work? If all your Python workflows have stopped working, reboot.
  8. By default, Alfred should open a new Terminal window and run the command there. Are you using a custom script?
  9. I've updated the workflow according to your wish. Download and reinstall.
  10. It's far simpler than that. Spotlight's extended info window is basically just a WebView and Flashlight's Google Search plugin basically just spits out the URL for a Google search. What you're looking at in Spotlight is google.com loading just like it would in Safari. Alfred doesn't work that way. In particular, it won't load any remote data for you and it won't run your script again until the user changes the query. I reckon about the best you can do with Alfred is the way I did it in Searchio!: Alfred's results are search suggestions, and you hit SHIFT on a result to Quick Look the URL:
  11. You said "tags", so the workflow searches tags (and only tags). What do you actually want? To search by track title? Album name? Filename is tricky because your filenames don't actually start with "Ola", they start with numbers.
  12. Regarding window focus, I think you can usually just tell the window object to activate. I'm not sure using an existing tab is sensible default behaviour. If you have multiple Inbox tabs open, unwanted things could happen. Using a new tab/window ensures you don't muck up a user's window.
  13. You could create a workflow with a very short keyword, say :, and pass the rest of the query to an Open URL Action https://{query}. IMO, for any site where HTTPS is relevant, it's up to the operator to automatically redirect any HTTP traffic to HTTPS. It's so simple to do. Literally one line in your .htaccess or nginx configuration. Admittedly, certificates are a bit of a pain.
  14. I'm afraid I didn't really understand post #12 and I don't understand this one. In any case, could you download the workflow again and re-install it? I've just fixed a bug in it.
  15. Are you perhaps thinking of Fuzzy Folders? That's no good here: it works on filepaths only. Smart Folders does something related, but can't do what OP wants. You could implement this as a Script Filter using mdfind. The trick would be defining/determining which parts of the query apply to the filename and which to the contents. This command would match the "milk receipt" example: mdfind -onlyin ~/Documents 'kMDItemDisplayName=2015 && kMDItemDisplayName=receipt && kMDItemTextContent=milk'
  16. What you could do is assign a keyword or a hotkey to run a script that calls Alfred to open the correct directory. For example, you create a Hotkey, say ⌘⌥⇧+/, and connect it to a Run Script Action. Set language to /usr/bin/osascript (AS) and enter the following: tell application "Alfred 2" to search "/Volumes"Now when you hit ⌘⌥⇧+/, Alfred will open in file browse mode at the /Volumes/ directory.
  17. Here you are. It's probably not exactly what you wanted because you didn't answer my questions. It should get you started, though.
  18. Open the Dash application. Go into Preferences > Integration and click the Alfred icon.
  19. ObjC.import('stdlib'); var dataDir = $.getenv('alfred_workflow_data');
  20. What does that mean? Which kinds of files?
  21. You'll need to be more precise regarding how you want the workflow to work if you want me to write it for you. It's easy enough to do, but I don't want to have to change it five times. For example, which directories should it search in? Which file types should be searched? Just music? Videos, too? All files? What if multiple tags are specified? Do you only want results that include both/all tags or results that include any of the tags?
  22. Regarding MySQL: If Google uses a standard MySQL installation, the workflow can be modified relatively easily to pull data directly from the database. You could query the database live (i.e. on every query) or periodically cache the dataset you're interested in. Alfred-Workflow makes the latter very simple to do. I recommend you read the Alfred-Workflow docs linked in my signature if you want to know more.
  23. You can keep the Excel file anywhere you want, you just need to change line 29 in the search.py script. (As you've figured out, that means search.py inside the installed workflow.)
  24. I think you'll need to write a workflow based on your own Script Filter for that. You can search tags using mdfind, e.g. mdfind -onlyin $HOME/Music "tag:pop", but you'll need to sort the results yourself.
  25. No idea regarding the hotkey. I guess it doesn't really matter, as Alfred strips any hotkeys defined in the workflow on installation (it tries to preserve user-set hotkeys across updates).
×
×
  • Create New...