Jump to content

enanogrande

Member
  • Posts

    2
  • Joined

  • Last visited

Posts posted by enanogrande

  1. Need some help figuring out a workflow I'm working on.
     
    In Alfred 1, and now in Alfred 2, I've always had a series of workflows whereby pressing a hotkey or entering a keyword the currently selected file (in the finder) is moved to a predetermined location. I have always used Applescript for this, as it is the only language I'm familiar with (if it can even be said I'm familiar with it…). For example:
     
    tell application "Finder"
            move selection to "insert folder here"
    end tell
    
     
    This is great for most cases, as I just need a quick way to move a file from one place to another (don't want to search through  filter to choose the folder)
     
    However, there is a case where I want to choose the folder to move the item to from a list: I have a Folder in my NAS with many subfolders, and I want to be able to invoke a keyword in alfred, see the list of folders, and choose one.
     
    Right now, I do this all inside applescript using a  (choose from list) dialog:
     

     

    on alfred_script(q)
    tell application "Finder"
        set destfolder to "examplefolder" as alias
        
        set thelist to name of every folder of destfolder
        set selectedseries to (choose from list thelist) as text
        
        move selection to "examplefolder:" & selectedseries as alias
    end tell
    end run
    

     

     
    but it would obviously be much more elegant doing it through alfred.
     
    I guess the best way is to use a script filter, but I have no idea how to write it.
     
    I've been trying to get it done by using a File Filter, but I can't seem to get applescript to action on the output of this filter.
    I fgured something like this would work:
     

     

    on alfred_script(q)
    set movefolder to q
    tell application "Finder"
         move selection to movefolder as alias
    end tell
    end run
     
    But no cigar. I don't know if maybe I should use something besides {q}, or what else is going on...
     
    Any ideas?
×
×
  • Create New...