Need urgent help - mouse over plus mouse right click plus os.startfile

Hello BA guys,

I am NooB in Blender world and fascinated by python plus BGE.

I have read a lot of thread in which you can open external file from BGE using os.startfile and/or os.system open

I have a requirement in which when I take the cursor over an object and then right mouse click on it then web page or html file should be opened.

This should happen only when I right click on the desired object.

I am able to open the web page using the following script

from bge import logic as l
from bge import render as r
import os

cont = l.getCurrentController()

own = cont.owner


over = cont.sensors["over"]

rclick = cont.sensors["rclick"]

if over.positive and rclick.positive:

with sensors “over” (mouse over and not mouse over any) and “rclick” added on the Cube object.

But my problem is that once the web page or file is opened and I come back to the game window and take the mouse over the Cube - the webpage is opened again evenif I have not right clicked on the cube.

Is there any way in which I can open webpage if I do right mouse click on a specific object?

I want different web pages to open when I click different objects present in a scene.

Your help is needed urgently. I have a deadline to catch.
I have attached the 2.63 rc1 version of file.
I want to achieve this in 2.49a and 2.62 both.


openUrl.blend (73.5 KB)

Strange, I downloaded your file and it was working as expected. The webpage only opened when I right clicked the cube.

Also, I think using“”) is a better way to open a url.

I have tried and also simple “rclick” sensor without mouse over.
I think the issue is with logic bricks and not with python script.

It might be related to pulse for rclick.postive.

My personal observation is if I do right click twice the results are as expected.

With rclick alone the observation is that when I right click anywhere in the Game Window web page is opened.

My OS is windows 7 64bit, do you think it is related to operating system.

Can anyone help?