Uncategorized

Reloading Sproutcore Apps

Working on some Sproutcore. Here’s an applescript I wrote that will allow BBEdit (specifically) to reload a tab in safari that is ostensibly the one you’re viewing your application in (locally) when you hit a key sequence. Remember in order to assign a key sequence to a script in BBEdit you have to open the Scripts Palette (instead of the preferences for the menu.) Copy this into ~/Library/Application Support/BBEdit/Scripts and assign it. Should work for building on single-install MAMP’s as well for you Drupal folks.

(*
Applescript to cause bbedit to reload a currently local tab (or the current document) in safari so you can work in bbedit like a regular build environment such as XCode.
*)

    set bbDoc to ""

    tell application "BBEdit"
        set bbDoc to name of document of window 1
    end tell

    log bbDoc

    tell application "Safari"
        set windowList to every window whose name does not contain "Web Inspector"
        set browserWindow to item 1 of windowList
        set tabList to every tab of browserWindow

        repeat with aTab in tabList

            if (URL of aTab as string) contains "0.0." or ¬
                (URL of aTab as string) contains "127.0." or ¬
                (URL of aTab as string) contains bbDoc then

                set current tab of browserWindow to aTab
                set URL of current tab of browserWindow to URL of aTab

            end if

        end repeat

    end tell

Leave a Reply

Powered by: Wordpress