Jump to content

ctwise

Member
  • Posts

    307
  • Joined

  • Last visited

  • Days Won

    23

Posts posted by ctwise

  1. I like the terminal support in Alfred (prefacing commands with '>') but it always opens a new terminal window. I would prefer that the commands execute in the current terminal window. Luckily there's a new 'Custom' option for handling terminal commands. The following was taken almost verbatim from the iTerm site (http://code.google.com/p/iterm2/wiki/AppleScript) and will execute terminal commands in the active iTerm2 shell. It will launch iTerm2 if it isn't currently running.

     

     

    on alfred_script(q)
        tell application "iTerm"
            activate
            
            try -- We don't need error messages
                set miniaturized of windows to false
            end try
            
            try
                set _session to current session of current terminal
            on error
                set _term to (make new terminal)
                tell _term
                    launch session "Default"
                    set _session to current session
                end tell
            end try
            
            tell _session
                write text q
            end tell
        end tell
        tell application "System Events"
            set visible of process "iTerm" to true
        end tell
    end alfred_script
  2. Ted, good job on the caching. I'm currently using your workflow instead of my own :)

     

    I am still exploring AppleScript to see if I can produce better results directly from it. Disabled entries should not be listed for one. Also the cache is sometimes out of date when using a toggle (Show/hide) menu option.

     

    I've been looking into Objective-C through the Scripting Bridge to pull down menus, both for speed and the possibility of getting shortcut keys as well to display. But my lack of knowledge of Objective-C and Cocoa are greatly hampering my efforts.

  3. I'm still having issues kicking off a background update that doesn't cause Alfred to hang waiting on the initial script. I've temporarily commented out the line that does the background update. In the meantime, my use of it caused me to change how the workflow searches for menu items.

     

    Instead of searching just the menu item name, it searches the whole path, e.g., 'm insert', 'm break' and 'm section' will all find 'Insert > Break > Section Break (Next Page)'. It uses case-insensitive grep, so you can do things like '^insert' to find everything belonging to the Insert top-level menu.

     

    Re-download the workflow to get the latest.

  4. Cool. I was hoping someone else would pick up where I left. I'm planning on making the script a bit more useful, but that will probably involve me actually having to learn AppleScript to a decent level... Did you make the changes using some more grep / sed commands or using some actual form of scripting?

     

    I am a programmer by trade, but unfortunately I don't know any AppleScript, Python, Ruby or PHP, but I guess I'll have to learn in order to make this thing a little more useful. 

     

    Ruby. I'm no guru but I use it to hack together support scripts during development, e.g., data transformation, etc.

     

    The new workflow version is here - http://tedwi.se/u/db

     
    I added caching but, given the circumstances, it's very coarse. If we've never seen the app before we dump the menu contents into a file in /tmp/. Subsequent invocations, if we find the menu contents in /tmp/, we use them but kick off a background process to regenerate them. That way, we get immediate response but, by the time we get to the end of what we're typing it's current to the given app. It's pretty wasteful, but, oh well.
     
    Seriously, this was a flat-out fantastic idea.
  5. I would be perfectly happy implementing a cache. This would be a whole lot easier if Alfred gave me something to work with though. If it could pass a "instance identifier" that would change every time the workflow was entered (or Alfred was displayed/hidden even) that would be perfect.

     

    With respect to having a bunch of things listed in Alfreds initial search: I did not mean to list the entries retrieved by the workflow, but the workflow itself. In my case this would be "Menu bar search", not the actual menu bar items. This is something I could live without, but would probably make having many workflows easier to work with.

     

    It's early days yet. I expect a lot more script support will come out in the 2.x series. But everything's getting locked down for 2.0.

     

    A bunch of people (myself included) have asked for timeouts, so script execution only happens when a key hasn't been pressed for x ms. An instance id would also be very useful, you should make that request in the request forum.

  6. Hi,

     

    I've created a basic workflow that searches the system's menu bar. After having used Sublime Text's command palette I wanted to have a similar system-wide functionality.

     

    http://dl.dropbox.com/u/6259900/Menu%20bar%20search.alfredworkflow

     

    The current workflow does not do any fuzzy searching and every keystroke executes the entire script again. My preferred fix to this would be to have a script input that is only executed once, and have Alfred do the subsequent fuzzy matching based on the initial result.

     

    Jeroen van der Neut

    @jvdneut

     

    That is awesome. I created a variant that:

     

    1. Displays the menu path as the subtitle, e.g., Apple > Recent Items or Project > Recent Projects.

    2. Displays the icon of the application next to the application's menu items but displays an OS/X icon next to the Apple menu items.

     

    But, as discussed, this is slow for applications with many menu items so I won't be publishing the variant until I add menu caching.

  7. You're a gentleman and a scholar. Seems to work beautifully, but for a tiny SQL error that appears at the top of the list:

    sqlerror.png

     

    I can't recreate that error, even with an empty database. But, I threw in an error check anyway which hopefully will head it off. Just re-download it.

  8. It's worth also adding to this that in the not too distant future, I am going to look at adding hotkey and keyword migration to the workflow updating, which means that if you setup a workflow to your liking, the keywords and hotkeys will remain through an upgrade.

     

    Could it be possible to just add the capability to disable hotkeys instead? So instead of blanking them on import, just disable them. Then the user can decide to enable them or change them at their discretion. Otherwise the user has to go through the readme or other documentation to figure out what the workflow writer thought would work best.

  9. Thanks - that wasn't clear to me. Now I've opened Doc's from Alfred Dave's script is working fine

     

     

    Would love to try this but having an issue with the gem installation. Get the following under 10.8.2

     

    $ sudo gem install sqlite3
    Building native extensions.  This could take a while...
    ERROR:  Error installing sqlite3:
    	ERROR: Failed to build gem native extension.
    
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
    mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
    
    
    Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.7 for inspection.
    Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.7/ext/sqlite3/gem_make.out
    
    

     

    Any advice greatly appreciated as I know nothing about Ruby

     

    You need to have the command-line tools installed to build gems with native extensions (that's the compiler toolchain, headers, etc.). It's available in Xcode which is free on the App Store but is an enormous download. If you go that route, after you install it, go to Preferences -> Downloads and install the Command Line Tools from inside Xcode.

     

    You can also go to https://developer.apple.com/downloads and download the Command Line Tools .dmg and install from there - it's much smaller and doesn't install Xcode. You have to register at developer.apple.com to download anything but it's free.

  10. This is something that is not likely to happen as Andrew usually tries to keep items like this to a minimal set that are included on everyones system. Zsh is something that is installed by the end user and shouldn't be presented as an option to everyone to prevent confusion.

     

    zsh is part of the base os/x install. Here's the list of all of the built-in shells: /bin/bash, /bin/csh, /bin/ksh, /bin/sh, /bin/tcsh, /bin/zsh. The list of all "known" shells is in /etc/shells. It would be awesome if any one of them could be used in place of bash.

  11. Very nice. I like the multi-layer actioning approach but it doesn't work well when some of the commands take options or keywords. Nevertheless, I really liked the OS-specific icons and stole them for the latest version of the VMWare Fusion controller. Thanks for the great work!

×
×
  • Create New...