open a url in game engine

hi!!

is it possible to make a actuator or easy python script that open a url on in the IE or netscape???

Sure, although not directly.
Search around the forum’s for info on doing socket communication.
Next, you’ll need to write a small program that runs outside of the GE and handles whatever protocol you’ve worked out and does the right thing, whatever you define it as.

I assume you mean from a normal blender game not a game running in the web plugin right?

You’d first have to put the python modules for I/O access into the blenderpublisher.exe directory. You can get them from the zip file that my FMV-ed util comes in (see link to resources page at bottom of post). Put all the .py files in that zip file into the blenderpublisher.exe directory.

Next put the following into a python script:


import os

os.system("IExplore.exe http://www.yourwebsite.com")

Then you just link a sensor to a python controller that runs that script. And hey presto - it should work. :slight_smile:

Keith. 8)

import webbrowser
webbrowser.open(URL)

Ben

Webbrowser??? Okay so wheres this webbrowser.py module? You’d need to put that in the blender exe directory.

Keith.

-You may need it in the blender exe directory,but this only if you have not correctly python installed and in the exe game directory if it’s saved as exe.

The idea is to make games that don’t require a full python installation if at all possible. But how does this webbrowser module display the web page? Does it use tcl/tk? cause that won’t work with blender games. Besides glown said he wanted to open the URL in IE or netscape, not in some python implemented web browser.

Keith. 8)

-It use the default browser.

The idea is to make games that don’t require a full python installation if at all possible.

-I’m sorry but with only GameEngine and its’s poor features cannot be done so much in game programing.

He was just saying to put the py in the same folder so it will work when you try and distribute it:)

HI!!!

Thanks for the answers :smiley: :smiley:

I finally use these code with the python os modules

import os 

os.system("explorer.exe http://www.yourwebsite.com")

it works in my system winxp

the problen now :-? is that tese script open two windows!!

There are any thing to do fot these problem?

That’s a problem with your logic bricks running the script twice. I can’t tell you exactly how to correct it without knowing how you’ve got your logic bricks set up, but try setting up the logic bricks differently so that it can’t run the script twice.

If you’re using a mouse sensor detecting either left-click or right-click then you can’t stop it from running the script twice, its a little known bug I noticed. The way to get around that is to set the script up to call the web browser only every other time the script is run. Let me know if you need help doing that.

Keith. 8)