Frequently Asked Questions

Q:

How can I access OmniWeb from my app? Is there any kind of API?

A:

We export a service for opening a URL. It's very easy to invoke a service from another program.

Also, we provide the command-line program "openURL" in our app-wrapper. You can run it from the shell or call system() on it from a program.

Attached is the source code to a program which will open the URL passed on the command line.

There's a small problem in OmniWeb 1.0 having to do with this process which we hope to fix in the next release. If OmniWeb isn't running, it will launch when asked to perform the service (as you'd hope), but it doesn't actually open the URL. If it's already running, it works just fine. (A good workaround for this problem is to programmatically launch OmniWeb through the Workspace API before calling the Open URL service.)

#import 

int main(int argc, char *argv[])

    Pasteboard                 *pasteboard;
    const char                 *urlString;
    const char                 *pasteboardName = "OmniWebPasteboard";
    const char                 *serviceName = "OmniWeb/Open URL";
    
    [Application new];

    if (NXArgc != 2) 
        fprintf(stderr, "usage: %s url", NXArgv[0]);
        return -1;
    

    urlString = NXArgv[1];
    pasteboard = [Pasteboard newName:pasteboardName];
    [pasteboard declareTypes:&NXAsciiPboardType num:1 owner:nil];
    [pasteboard writeType:NXAsciiPboardType
     data:urlString length:strlen(urlString)+1];
    NXPerformService(serviceName, pasteboard);
    return 0;

Valid for 1.0



Product literature and demonstration software are available. For more information about this or any other Lighthouse Design product, send e-mail to info@lighthouse.com.


Copyright 1995 Lighthouse Design, Ltd. 2929 Campus Drive, San Mateo, CA 94403 USA. All rights reserved.