Open URLs from the command line in OmniWeb

Jun 04, '02 09:29:06AM

Contributed by: Anonymous

The command line program "open" is weak in that it doesn't work on URLs, even if they are put in proper form (i.e. with a preceding http://). To provide this missing function, I built a quick shell script that takes any number of URLs as an argument and then opens them concurrently in Omniweb. An added bonus is that the URLs are sent as if they were typed in the Omniweb address bar, so any completion options work. The script follows:

#!/bin/sh
# sends a string to be parsed by the Omniweb browser

if [ -z "$1" ]
then
echo "usage: ow URL ..."
exit 65
fi

until [ -z "$1" ]

do
osascript -l AppleScript -e "Tell application \"Omniweb\" to getURL \"$1\""
shift
done &
exit 0
So now, "ow google hats" opens a browser window in the background with a google search for the word hats.

[Editor's note: To make the script executable, make sure you issue a "chmod 755 ow" and then "rehash" (or close and open the terminal). Enter the text using vi or pico or any other text editor that will not add Mac line breaks.]

Comments (9)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020604092906316