Jump to content

OliverJAsh

Member
  • Posts

    40
  • Joined

  • Last visited

Reputation Activity

  1. Like
    OliverJAsh reacted to scottfwalter in Connecting to remove server(s)   
    I have this script
     
    on alfred_script(argv) set myList to splitString(argv, " ") set numItems to count myList if numItems is less than 3 then display dialog "You need to pass at least 3 arguments" return end if set theServer to item 1 of myList set theUsername to item 2 of myList set thePassword to item 3 of myList set theVolume to item 4 of myList set theUrl to "afp://" & theUsername & ":" & thePassword & "@" & theServer if numItems is 4 then set theUrl to theUrl & "/" & theVolume end if --display dialog theUrl tell application "Finder" mount volume theUrl end tell end alfred_script to splitString(aString, delimiter) set retVal to {} set prevDelimiter to AppleScript's text item delimiters log delimiter set AppleScript's text item delimiters to {delimiter} set retVal to every text item of aString set AppleScript's text item delimiters to prevDelimiter return retVal end splitString  
      The only problem is that it won't work if the volume has a space in it.  I can't figure out how to escape a space when entering the query in Alfred
  2. Like
    OliverJAsh reacted to DavidK in Next Audio Output Device + request for help!   
    I rewrote the functionality you are looking for using some bash trickery instead of Ruby. Seems to work fine in my setup, but feel free to test it out and let me know if there are any issues!
     
    http://d.pr/f/fB3c
  3. Like
    OliverJAsh got a reaction from Florian in Next Audio Output Device + request for help!   
    I have an AirPlay device which I am constantly switching to and from, so I created this workflow that lets you quickly switch to the next available audio output device.
     
    http://cl.ly/3f3R383w002z
     
    Is there any way in which I can have the workflow show the current audio output device before you action the item, in this view: http://cl.ly/image/212K2H1R0e3C
  4. Like
    OliverJAsh reacted to DavidK in Next Audio Output Device + request for help!   
    I don't know Ruby at all, but it shouldn't be too difficult.
     
    Looking at the documentation:
     
    "SwitchAudioSource -c" shows the current device
    "SwitchAudioSource -a" shows all devices
     
    Assuming the -n flag just chooses the next device in that list, you could easily just load the names generated by "-a" into an array. Then it's just a simple compare to find which array index matches the current device, say "n", and then print "n+1" as the next device.
  5. Like
    OliverJAsh reacted to DavidK in Next Audio Output Device + request for help!   
    Seems to work well for me, nice job. My only suggestion would be to maybe list the "next device" in the subtitle output, so the user knows what it's going to switch to.
     
    Something like:
     
    "Current Device: Built-In Output, Next Device: Music Streamer II"
  6. Like
    OliverJAsh reacted to DavidK in Next Audio Output Device + request for help!   
    This is absolutely possible - You'll just need to use a Script Filter as your first item instead of Keyword, and then write a script to grab which is the active output and print the appropriate XML to display the info in the subtitle.
     
    See the following thread for details on passing feedback back to Alfred:
    http://www.alfredforum.com/index.php?/topic/5-generating-feedback-in-workflows/
     
    Also, take a look at Mikegrb's Audio Device Selection workflow, which will likely do what you want already.
    http://mikegrb.com/2013/01/18/alfred2-audio-device/
  7. Like
    OliverJAsh got a reaction from Weaselboy in Creating a basic workflow   
    I have created a basic workflow with a keyword input, bash script action, and post notification output. However I can't seem to get this to work. Where am I going wrong?
     
    Here's the workflow: http://cl.ly/0x392N0r0Y1J
     
    Any help appreciated!
  8. Like
    OliverJAsh reacted to Weaselboy in Creating a basic workflow   
    I checked the "with space" box in the keyword section and that makes it work.
  9. Like
    OliverJAsh reacted to CarlosNZ in /bin/zsh for shell language   
    I don't know if it's the same for zsh, but for bash I discovered (thank you Google) that aliases aren't loaded by default when running scripts.
     
    I had to add this to the top of my scripts:
     
     
    #Enable aliases for this script shopt -s expand_aliases  
     
     
    which did the trick.
     
    Hope that helps.
  10. Like
    OliverJAsh reacted to CarlosNZ in /bin/zsh for shell language   
    I believe Andrew has said that none of the user-specific environment settings are loaded when shell scripts run. This is to make them able to be transferred freely to other users without compatibility issues. You just have to make sure you call the full path rather than any aliases you have set up. For example, in my own (bash) scripts, I can't just use "growlnotify" like I normally would, I have to put the whole "/usr/local/bin/growlnotify" into my scripts. Personally, if it's a command I'm going to be using a lot, I just manually add an alias at the top of the script. Or just do a find-replace when you're done. )
  11. Like
    OliverJAsh reacted to ClintonStrong in Search Safari and Chrome Tabs [Updated Feb 8, 2014]   
    I plan to add support for Canary, Chromium, and Webkit (I've already coded most of it). Unfortunately I'm having some issues with my system right now, but I'll try to get it updated as soon as I can.
     
    Edit: Done.
  12. Like
    OliverJAsh reacted to ClintonStrong in Debugging your workflows   
    Just wanted to share a few quick tips for debugging. If you're using /bin/bash to run a script, you can add "2> error.log" to output errors to a file. Example:
    ruby script.rb "{query}" 2> error.log  
    All errors will then be logged to error.log in your workflow's folder.
     
    Or if you want all output logged (perhaps so you can view the xml from a script filter), you could use tee:
     
    ruby script.rb "{query}" 2>&1 | tee output.log  
    That'll log errors from stderr in addition to standard output. Note that PHP doesn't output to stderr, so if you're using PHP you'll have to check PHP's error log instead.
     
    Also, if you have any formatting errors in a script filters' XML, Alfred will log it to Console.app.
     
    Hope this helps, and feel free to share your own tips.
     
  13. Like
    OliverJAsh reacted to ClintonStrong in Get keyword in AppleScript   
    As far as I know it's not possible to read the keyword. However, you could have each keyword run a bash script that sends a keyword to an applescript:
     
    osascript scriptname.applescript keyword  
    You'd then just open the workflow folder and create the applescript file there. To get it to read the keyword, you'd use something like this:
     
     
    on run argv set theKeyword to item 1 of argv -- your script here end run  
    It's not as elegant as I'd like, but hopefully it'll work for you.
  14. Like
    OliverJAsh reacted to jdfwarrior in Default Instant Web Search   
    Alfred has the ability to do such this but Andrew has tried to make features that REQUIRE an internet connection a default feature. I know most of the time now days people will have an internet connection, but there are always special cases. You can set your own fallback search but workflows currently aren't available as fallback searches. Andrew and I have discussed the possibility of adding that feature but it isn't a definite as Andrew says there could be some serious implications with adding this functionality. I'm not sure what they are myself but I'm sure if Andrew left it out there is definitely a reason.
     
    I hope this clears things up.
  15. Like
    OliverJAsh reacted to OliverJAsh in /bin/zsh for shell language   
    I see /bin/bash as a language for shell scripts, but I don't see /bin/zsh. Is there any reason for this? zsh is quite popular…
  16. Like
    OliverJAsh reacted to jdfwarrior in Help getting first workflow working: basic shell script   
    you could add an output item of "Copy to Clipboard" and attach that to the back end of your script item and I think that will push the errors to your clipboard
  17. Like
    OliverJAsh got a reaction from twinpeaks in Workflow Repository?   
    It would be useful if more workflows were available on a service like GitHub, and if there was a single page listing all the available workflows. The latter could be done in the form of a wiki page on GitHub.
     
    What do people think? I'm seeing lots of cool workflows pop up, but having to browse through threads to find them and the latest versions.
  18. Like
    OliverJAsh reacted to jdfwarrior in Workflow Repository?   
    This is just a temporary solution while Alfred is still in beta. 
×
×
  • Create New...