From: Don C. <don...@em...> - 2001-06-13 17:57:38
|
There is a good example of how to launch a URL in a browser from a Java application using the DEFAULT browser. http://www.stanford.edu/~ejalbert/software/BrowserLauncher/ > -----Original Message----- > From: Glen Starchman [mailto:gl...@en...] > Sent: Wednesday, June 13, 2001 12:32 PM > To: jyt...@li... > Subject: Re: [Jython-users] running IE from within jython > > > (sorry, have had little sleep with a newborn and sent before > checking... should look like:) > > > > webbrowser.py > > from java.lang import * > class webbrowser: > def __init__(self, browser_path): > self.browser=browser_path > > def setURL(self,url): > self.url = url > > def open_new(self): > p = Runtime.getRuntime().exec("%s %s" % (self.browser, > self.url)) > p.waitFor() #if you wish to wait until the browser > is closed > > > moduleA.py > > from webbrowser import webbrowser > > if __name__=="__main__": > wb = webbrowser("C:/Program Files/Internet Explorer/iexplore.exe") > wb.setURL("www.jython.org") > wb.open_new() > > > > > > ================================================ > > C:\>jython > > Jython 2.0 on java1.3.0_01 (JIT: null) > > Type "copyright", "credits" or "license" for more information. > > >>> from java.lang import Runtime > > >>> rt=Runtime.getRuntime() > > >>> browser="C:/Program Files/Internet Explorer/iexplore.exe" > > >>> url="www.jython.org" > > >>> cmd="%s %s" % (browser, url) > > >>> rt.exec(cmd) > > java.lang.Win32Process@407527 > > >>> > > ================================================ > > > > I would prefer "a la Python": > > > > ================================================ > > ActivePython 2.1, build 210 ActiveState) > > based on Python 2.1 (#15, Apr 23 2001, 18:00:35) [MSC 32 > bit (Intel)] on > > win32 > > Type "help", "copyright", "credits" or "license" for more > information. > > >>> import webbrowser > > >>> webbrowser.open_new("www.python.com") > > ================================================ > > > > Regards, > > > > Andre > > > > > > ----- Original Message ----- > > From: "Mark Ackerman" <ack...@go...> > > To: "Jython Users (E-mail)" <jyt...@li...> > > Cc: <ack...@go...> > > Sent: Tuesday, June 12, 2001 5:50 PM > > Subject: [Jython-users] running IE from within jython > > > > > > > Anyone have experience running IE or netscape from within > jython? I just > > > need to start it with a url. > > > > > > Mark > > > > > > _______________________________________________ > > > Jython-users mailing list > > > Jyt...@li... > > > http://lists.sourceforge.net/lists/listinfo/jython-users > > > > > > > > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > http://lists.sourceforge.net/lists/listinfo/jython-users > -- > Glen Starchman > Enabled Ventures/Enabled Technology Group > gl...@en... > 206.234.7330 > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users > > |