The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniWeb > OmniWeb General
FAQ Members List Calendar Today's Posts

 
Is it possible to 'pipe' something into OmniWeb Thread Tools Search this Thread Display Modes
Is it possible to 'pipe' something into omniweb from the command line?
 
Quote:
Originally Posted by jem
Is it possible to 'pipe' something into omniweb from the command line?
Hmmm. I have no idea if this will work, but if omniweb is your default browser and the input that you wish to pipe is to be opened with the default browser, then you can simply pipe the output to the "open" command.

grep http://www.somesite.com index.html | open

Alternately, you should be able to pipe it to the actual Omniweb binary file. The path to this is (assuming you have it in Applications)
/Applications/OmniWeb.app/Contents/MacOS/OmniWeb

You can do this with any app. I used to do it with Firefox (when I wanted Bluefish, a superb gnome html editor, to launch the html preview in a non-x11 browser), but the problem with Firefox was that calling the binary directly from the command line would launch an entirely new instance of the app, instead of opening a new window or tab. I'm ASSUMING that OW will behave the same way, but it may not.

HTW.

P
 
Thanks for the suggestions,
Quote:
Originally Posted by philonous
grep http://www.somesite.com index.html | open
I tried
Code:
cat index.html | open
which doesn't work, the open command doesn't know which program to launch (I guess). I then tried
Code:
cat index.html | open -a OmniWeb
Which works in the sense that OmniWeb becomes the frontmost app but it seems like OW doesn't read anything from stdin. I could of course make a temporary file but I would like to avoid that ... but it's a fallback alternative.

Quote:
Originally Posted by philonous
Alternately, you should be able to pipe it to the actual Omniweb binary file. The path to this is (assuming you have it in Applications)
/Applications/OmniWeb.app/Contents/MacOS/OmniWeb
This seems to behave like Firefox, OW tries to launch a second time.
 
Because we ship our own copy of WebKit and we need it to load instead of the system one, you can't directly run OmniWeb as you showed--if you do you will end up with an OmniWeb window but no Menu (the previous app's menu will still be there).

This is because the executable specified in the Info.plist is actually OmniWeb-Launcher. I haven't had much luck launching that directly either.
 
Quote:
Originally Posted by jem
Code:
cat index.html | open
which doesn't work, the open command doesn't know which program to launch (I guess). I then tried
Code:
cat index.html | open -a OmniWeb
Which works in the sense that OmniWeb becomes the frontmost app but it seems like OW doesn't read anything from stdin. I could of course make a temporary file but I would like to avoid that ... but it's a fallback alternative.
Ok. The problem, I would venture, is that the output is somehow not formatted correctly for open.

For example, if you simply try
open http://www.omniweb.com
you get the desired outcome.

I tried the following:
echo http://www.omniweb.com | open
and then I got the error that you got.

Open seems to be an OS X thing, and not a standard Unix command. The man pages say that it "first appeared in Nextstep". I defer to the OG people on this one.

Now, what x11 apps (like Bluefish) do is that they echo something like "open %s", where %s is, of course, the string value of the s variable, which contains the name of the html file. So, if you know any shell scripting, maybe you can try storing the value of the URI into a string variable, and then piping the string value to the open command.

This should work, damnit, even though it's a bit of work! Hopefully open will become more Unix-like in the future. Perhaps something to bother Apple with? :)

P
 
I think that are two reasons

+ When I pipe something the 'open' command can't determine what kind of data is sent to it ... should it for example open BBEdit, Mail or OmniWeb ... so unless I specify the app, open doesn't know what to do. If I use a file the it can use the file extension to figure out what to do (the same if I use an url)

+ OmniWeb doesn't understand that it should read data from stdin

The man page for open seems to support my first guess, as for the second I have no idea if it's correct or not
 
Quote:
Originally Posted by jem
+When I pipe something the 'open' command can't determine what kind of data is sent to it ... should it for example open BBEdit, Mail or OmniWeb ... so unless I specify the app, open doesn't know what to do. If I use a file the it can use the file extension to figure out what to do (the same if I use an url)

+ OmniWeb doesn't understand that it should read data from stdin

The man page for open seems to support my first guess, as for the second I have no idea if it's correct or not
Len explained the problem with OmniWeb, and you are correct about the problem with pipe. I thought the problem was with open, but when I try
echo http://www.yahoo.com | lynx
the command fails, even though
lynx http://www.yahoo.com
works.

In the former case (the failure), what happens is that the letters are executed as lynx commands after lynx has launched.

So, the problem does seem to be how commands like lynx and open handle parameters that are piped to them.

I think that the workaround is to use some scripting to construct the correct expression using open, and executing that single expression.

P
 
It sounds like 'jem' wants to open arbitrary html without writing it to a file first--this isn't supported. You can do
Code:
cat index.html | open -f
but that will only open it in a text editor, not a web browser. To open arbitrary html in a web browser you will need to write it to a file.
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Thank you for OmniWeb Cady OmniWeb General 1 2011-04-23 04:47 AM
OmniWeb 5.5.3 now available. Forrest OmniWeb General 0 2007-01-09 06:26 PM


All times are GMT -8. The time now is 08:15 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.