Jump to content

ClintonStrong

Member
  • Posts

    115
  • Joined

  • Last visited

  • Days Won

    7

Posts posted by ClintonStrong

  1. This is great. If it's ok to ask, how would I go about modifying it to copy the file and send it to a specific folder (of my choosing). If that's threadjacking, ignore the request and just know I appreciate this!

     

    You should just be able to use the built in "Copy To…" action to do this, if I understand your question correctly.

  2. This is amazing. You win the internets.

     

    Oh, and adding to the color picker code ctwise posted, you could just add a bit of AppleScript to show the color in Alfred:

     

    OUTPUT=$(osascript -e 'tell application "Finder"' -e 'activate' -e 'choose color' -e 'end tell' | ruby -e 'puts "#" + STDIN.read.split(",").map{|y| "%.2x" % [y.to_i>>8]}.join'); printf $OUTPUT | pbcopy; osascript -e 'tell application "Alfred 2"' -e "search \"$OUTPUT\"" -e 'end tell'

    You can paste that code in to Terminal if you want to see it in action.

  3. Updated. You can download it here or in my original post.

    • Fixed an issue with tabs not showing up for Safari.
    • Improved performance. You may still get some slowdown if you're running multiple browsers at the same time, but that'll be fixed in the next update.

    I'm working on a rewrite to further improve performance and add a few new features. It's not quite ready yet, but I'll try to get it out soon.

  4. I've actually written a shell script that does something similar: it keeps track of which document you last opened in a particular folder, and tries to open the next one with a command. Pretty basic, but I've been meaning to work on it some more.

     

    Can't guarantee anything, but I'll play around with this idea.

  5. Thanks for this :)

     

    Is there any way to automatically leave out "untitled folder" from the results?

     

    When I type "recent", I see the results from new folders I made, before I renamed them (and they no longer exist of course).

     

    Thanks for letting me know about that. Looks like Finder was storing the wrong path in its plist (with "untitled folder" at the end), yet it's still showing the updated folder name in the title.

     

    Updated the workflow so it'll try to show the correct folder instead. It also checks to see if each folder exists, so it won't show any folders you recently deleted. (Download -- AlfPT appears to be down right now, so the update isn't available there yet)

  6. I forgot to mention that AXRaise only works if "Enable access for assistive devices" is checked in the Accessibility preference pane. Otherwise you'll just get the same behavior as before (the window will be moved to the front, but won't be fully focused). Not sure how to get around that (other than prompting the user to enable that setting).

  7. Noticed a bug: if there are double quotes in a tab's title, the workflow returns no results. I think you can just use `quoted form of (title of theTab)` within the JSON string, and it should add double quotes around it and escape any double quotes within.

     

    Also, you might have noticed that if you try to focus a tab that's in a background window, it won't fully bring that window to the foreground (the titlebar is grayed out, and it doesn't respond to keyboard events). You can use AXRaise to fix that. Here's the code I used in my "Search Browser Tabs" workflow:

     

    tell application "System Events" to tell process "Google Chrome"
        perform action "AXRaise" of window 1
    end tell

     

    Just add that code to the end of the AppleScript, and it should properly focus the window.

  8. Great job on the Alfred Repo workflow. I just had one problem. When I ran it, following error occurred:

     

    ./lib.rb:91:in `installed_workflows': undefined method `[]' for nil:NilClass (NoMethodError)
    	from ./lib.rb:90:in `each'
    	from ./lib.rb:90:in `installed_workflows'
    	from ./lib.rb:127
    	from repo.rb:3:in `require'
    	from repo.rb:3
    

     

    Turns out one of my installed workflows' info.plist files was empty (0 KB). No idea how that happened (I doubt it's typical), just thought I'd let you know.

  9. The launchd prompt never showed up for me. Looks like you're using a hard coded path in the osascript call ("/Users/Carl/Library"). Also, I think the workflow directory name is randomized, since mine's different from the one that's coded in first_install.sh. You can get Alfred's directory through AppleScript (POSIX path of (path to application support) & "/Alfred 2"), but you may have to set a variable to the current directory in your bash script and pass that to osascript to get it working consistently. Or you could just show an iconless prompt (I'm lazy, so that's what I'd probably do ;)).

  10. I am also experiencing the same problems as CarlosNZ and Hollowm4n but my problems seem to be intermittent. Sometimes there will be no text under the AlfPT icon, other times I get a successful update notification underneath AlfPT with the workflow bundle id (if i remember correctly) listed with a message of success in front. 

     

    A problem I am experiencing that I have not seen listed here is a very strange message in growl, screenshot attached, but notice the success response at the bottom... Probably an error on my end but just in case otherwise...

     

    I think that problem's happening when it tries to copy over directories in workflows. I think it's because it's using a simple copy function rather than a recursive copy (examples in the comments of the PHP manual).

     

    Here's a suggestion for downloading icons: maybe try running the downloader script in the background, and display results without icons if they aren't all downloaded yet. You may lose out on a bit of functionality your first time searching, but it's better than sitting there waiting until they're all downloaded. (You'll probably want to make it check if the script is already running in the background, and run it if it isn't.)

  11. I'm not sure if this feature will come to Alfred, but in the meanwhile here's some AppleScript that could do it:

     

    Safari:

    on alfred_script(q)
        set windowIndex to 1
    
        tell application "Safari"
            repeat with theWindow in windows
                set tabIndex to 1
                repeat with theTab in tabs of theWindow
                    if url of theTab is q then
                        activate
                        tell theWindow
                            set current tab to tab tabIndex
                            set index to 1
                        end tell
                        tell application "System Events" to tell process "Safari"
                            perform action "AXRaise" of window 1
                        end tell
                        return
                    end
                    set tabIndex to tabIndex + 1
                end repeat
                set windowIndex to windowIndex + 1
            end repeat
        end tell
    
        open location q
    end alfred_script

     

    Chrome:

    on alfred_script(q)
        set windowIndex to 1
    
        tell application "Google Chrome"
            repeat with theWindow in windows
                set tabIndex to 1
                repeat with theTab in tabs of theWindow
                    if url of theTab is q then
                        activate
                        tell window windowIndex
                            set active tab index to tabIndex
                            set index to 1
                        end tell
                        tell application "System Events" to tell process "Google Chrome"
                            perform action "AXRaise" of window 1
                        end tell
                        return
                    end
                    set tabIndex to tabIndex + 1
                end repeat
                set windowIndex to windowIndex + 1
            end repeat
        end tell
    
        open location q
    end alfred_script

     

    You might have to make some modifications to make it work how you want, as it only matches exact URLs.

  12. I wonder if something like this could be created temporarily with the "Recent Folders" workflow that has been created. Create a second action for it that would allow you to open those paths in the file nav...

     

    I'm not sure if this is possible to do with a workflow, but I haven't poked around much in Alfred 2's preference files.

     

    Also, is it possible to bring up Alfred's file browser from a workflow (using script filters)? I I haven't found any actions that would make that possible, but maybe I'm not looking hard enough. It'd be especially cool if we could use the right arrow to bring it up, like Alfred does by default.

×
×
  • Create New...