Blob
1 #!/bin/sh3 plumbfirefox()4 {5 echo '6 tell application "Firefox"7 activate8 tell application "System Events"9 tell process "firefox"10 keystroke "t" using {command down}11 end tell12 end tell13 Get URL "'$1'"14 end tell15 ' | osascript16 }18 plumbsafari()19 {20 echo '21 tell application "Safari"22 activate23 tell application "System Events"24 tell process "safari"25 keystroke "t" using {command down}26 end tell27 end tell28 open location "'$1'"29 end tell30 ' | osascript31 }33 plumbcamino()34 {35 echo '36 tell application "Camino"37 activate38 tell application "System Events"39 tell process "camino"40 keystroke "t" using {command down}41 end tell42 end tell43 Get URL "'$1'"44 end tell45 ' | osascript46 }48 plumbapple()49 {50 case ${BROWSER:-none} in51 firefox)52 plumbfirefox "$@"53 ;;54 safari)55 plumbsafari "$@"56 ;;57 camino)58 plumbcamino "$@"59 ;;60 none)61 if [ -d /Applications/Camino.app ]62 then63 plumbcamino "$@"64 elif [ -d /Applications/Firefox.app ]65 then66 plumbfirefox "$@"67 else68 plumbsafari "$@"69 fi70 ;;71 esac72 }74 plumbunix()75 {76 case "${BROWSER:=firefox}" in77 # Other browsers here78 # ...79 *opera*)80 $BROWSER -remote 'openURL('"$@"',new-page)'81 ;;82 *firebird*)83 $BROWSER -remote 'openURL('"$@"',new-window)'84 ;;85 *firefox*)86 $BROWSER -remote 'openURL('"$@"',new-tab)' ||87 $BROWSER "$@"88 ;;89 *mozilla*)90 $BROWSER -remote 'openURL('"$@"',new-tab)' ||91 $BROWSER "$@"92 ;;93 *google-chrome*)94 $BROWSER "$@"95 ;;96 esac97 }99 plumb1()100 {101 case `uname` in102 Darwin)103 plumbapple "$@"104 ;;105 *)106 plumbunix "$@"107 ;;108 esac109 }112 if [ $# = 0 ]113 then114 plumb1 about:blank115 else116 for i in "$@"117 do118 if [ -f "$i" ]119 then120 p=`pwd | sed 's/ /%20/g'`121 i=`echo $i | sed 's/ /%20/g'`122 i=`cleanname -d "$p" "$i"`123 i=file://$i124 else125 i=`echo $i | tr -d ' '`126 fi127 echo p "$i"128 plumb1 $i129 done130 fi132 case $BROWSER in133 *opera*)134 $BROWSER -remote 'raise()'135 esac