Jump to content

phallstrom

Member
  • Posts

    15
  • Joined

  • Last visited

Posts posted by phallstrom

  1. In Alfred, create a run script action, and be sure to uncheck "escape spaces".  Then use this to get {query} into arguments you can use.

     

    #!/bin/bash
    
    read a1 a2 a3 <<< "{query}"
    
    if [ $a3 ]
    	then
    		wget http://lorempixel.com/$a1/$a2/$a3'>http://lorempixel.com/$a1/$a2/$a3 -O $a1x$a2-$a3.jpg
    	else
    		wget http://lorempixel.com/$a1/$a2/ -O $a1x$a2.jpg
    fi
    

     

     

    I'm not sure how you'd then get Alfred to prompt you for where to save it.

  2. @David - Do you know what happens in a script filter when typing quickly?  Does alfred kill the currently running script before starting the next one?  Or?  I'll see if I can figure out by watching for traps, but if you know, please share. Thx!

     

    EDIT: Looks like each script gets run in it's own thread (or similar) and isn't killed.

  3. Yeah, that won't really work since "dig david" might be perfectly valid and resolve.  I could make you put a '.' on the end.  I think what I'm going to do is wait for a space at the end since that will never show up for a hostname.  Then I'll do an A lookup (common case) as well as provide filters for the other DNS types (mx, cname, txt, etc.).  So then I can either run my app with a space at the end or if the last argument is one of the dns types.

     

    Should work okay.  

     

    Then I suppose I should go update my earlier extensions :)  Not financially rewarding, but it sure is fun :)

  4. Sleeping within my script won't work because by then it's too late.  The issue is that with a script filter the script is executed after every keystroke.  I want alfred to delay script execution for 100ms (or so) after the last keystroke has been pressed.

     

    Normally this isn't an issue.  The script filter is just there to help narrow your options which will then run the actual script.  However, I'm abusing it a bit (like the weather workflow) to show actual results.  If you have the weather workflow installed you can see what I mean by typing "weather 9" and then waiting for it to load results.  Now hit "8" and it refreshes again.  Every keystroke triggers the script execution which in my case (dns lookups) can sometimes take a little while.  I'd prefer to delay it until the user has clearly paused.

     

    I'll figure out a work around for now, good to know people have asked about this already.

  5. I'm playing around with workflows and while working on one happened to need to look up an IP address.  So started working on a workflow that would let me type things like "dig alfredapp.com" and "dig alfredapp.com mx" and get the results back.

     

    It's easy to do if I use notifications or large text.  But I wanted to cheat and keep it inline.  Like the below.  Which works, but it fires off the script at "xxx a" and "xxx al" and "xxx alf", etc.  What I'd love is a checkbox that said "don't run script until user hasn't typed for 100 milliseconds".  I know I could do it by not executing the long part of the script until the last character was say a '.' or something, but I was hoping we could get a delay-for feature?

     

    And I know I'm already abusing the script filter stuff, but it looks cool and I noticed some other workflows (weather) do it as well.

     

    Any advice?

     

    Screen%20Shot%202013-03-15%20at%208.03.4

×
×
  • Create New...