NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » Latest cheat Code project

April 08, 2011
by missle3944
missle3944's Avatar

Hey guys, I just finished my latest project that makes my life a little easier (and lazier). Usually when i play one of my favorite games ,Mercinaries, I have to look up the cheat codes from my computer. and it gets veryyy annoying fasttt. So using my nerdkit to my advantage I made a detector that detects when I grab my controller. It is described more in detail in my video.

April 10, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Awesome.

Humberto

April 10, 2011
by Singlecoilx3
Singlecoilx3's Avatar

@missle3944

I really like your idea and I thought you explained it very well in your YT video. One thing I thought of while I was watching it was that you set the browser's home page to the cheat code link so that (I assume) when the browser was loaded it would go straight to that page. I personally would not like to set my homepage to something else (I really like my home page!) and I thought if it were me I would like to get the python program to load the cheat page regardless of what my chosen home page was. I did a search online and found this page with some good information about the WEBBROWSER module. http://docs.python.org/library/webbrowser.html I didn't read it all the way though, but it looked like there would be a way to have it function this way (if you would even want it to...). Anyways, just thought I would share... I like your way of thinking- I have a problem, how can I make my life easier with the tools I've got? Keep it up!

Singlecoilx3

April 11, 2011
by missle3944
missle3944's Avatar

Hi singlecoilx3,

I have done some research on the python webmodule and I tried to use it but it brings up the page with HTML from and I don't know how to extract a part out of it

-missle3944

April 11, 2011
by Singlecoilx3
Singlecoilx3's Avatar

@missle3944 can you post your source here (using code tags) so I can play around with it? I will try and get it to work that way.

Singlecoilx3

April 11, 2011
by Singlecoilx3
Singlecoilx3's Avatar

re: code tags... I forgot there are no code tags on this forum

"Code Block - to put a code block into your post simply precede every line in the code block with at least four spaces."

April 11, 2011
by Ralphxyz
Ralphxyz's Avatar

Or use the "Indent Selection as Code Block" button!!

Ralph

April 11, 2011
by missle3944
missle3944's Avatar

Hi singlecoilx3,

Here is my original python code:

#Python serial port program
#Author: DW
import serial
import sys
import os

serial = serial.Serial("COM3", 115200)
    #uses the serial port

data = serial.read()

#center
if data == "1": os.startfile("C:\Program Files\Internet Explorer\iexplore.exe")
April 25, 2011
by Singlecoilx3
Singlecoilx3's Avatar

try using this instead of os.startfile:

import webbrowser

url = 'http://www.python.org/'
webbrowser.open_new(url)
April 25, 2011
by Hexorg
Hexorg's Avatar

Hey guys, I did that kind of programming in Delphi a long time ago. In it there was a shellexec() function that would allow you to start any file on the harddrive. So I assume, it's really close to python's os.startfile() function. Try calling os.startfile("http://www.blablabla.com") instead.

If that doesnt work, try starting iexplore.exe with the web address as a parameter - e.x.

    os.startfile("C:\Program Files\Internet Explorer\iexplore.exe http://www.blablabla.com")
April 25, 2011
by Singlecoilx3
Singlecoilx3's Avatar

That is what I originally tried but apparently os.startfile will not take parameters like that. My code example has been tested.

April 25, 2011
by missle3944
missle3944's Avatar

Hi Singlecoilx3, Thank you sooo much. I can't believe I didn't stumble upon this on the web. This will help me A LOT for my future projects. Is there any way to have the python script enter anything into the webpage? Or would that involve finding the right HTML code?

Much Appreciated,

missle3944

April 25, 2011
by Singlecoilx3
Singlecoilx3's Avatar

you are welcome. can you give me an example?

April 25, 2011
by missle3944
missle3944's Avatar

Well lets say I wanted to send a facebook message to my friend when I execute the script.

April 25, 2011
by Singlecoilx3
Singlecoilx3's Avatar

I will look into it more but I did some searches and found 'pyfacebook'. I didn't look into how to use it (or if it is really what it sounds like it would be) but just throwing it out there in case you have time to look into it more before I do.

Singlecoilx3

Post a Reply

Please log in to post a reply.

Did you know that interrupts can cause problems if you're not careful about timing and memory access? Learn more...