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 esac94 }96 plumb1()97 {98 case `uname` in99 Darwin)100 plumbapple "$@"101 ;;102 *)103 plumbunix "$@"104 ;;105 esac106 }109 if [ $# = 0 ]110 then111 plumb1 about:blank112 else113 for i in "$@"114 do115 if [ -f "$i" ]116 then117 p=`pwd | sed 's/ /%20/g'`118 i=`echo $i | sed 's/ /%20/g'`119 i=`cleanname -d "$p" "$i"`120 i=file://$i121 else122 i=`echo $i | tr -d ' '`123 fi124 echo p "$i"125 plumb1 $i126 done127 fi129 case $BROWSER in130 *opera*)131 $BROWSER -remote 'raise()'132 esac