BS2 controls Windows programs. How?
IceFirePro
Posts: 86
Hi everyone,
I am just starting off with my new BS2 and I have this question:
Is there a way to control programs/things within Windows thru the Basic Stamp? Like, play/rew/stop songs in winamp, or run a certain program, or open web page? I am guessing this might be possible with a third party application that takes data from the DEBUG window and inteprets it as commands to the computer. Thanks for any advice!
I am just starting off with my new BS2 and I have this question:
Is there a way to control programs/things within Windows thru the Basic Stamp? Like, play/rew/stop songs in winamp, or run a certain program, or open web page? I am guessing this might be possible with a third party application that takes data from the DEBUG window and inteprets it as commands to the computer. Thanks for any advice!
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
There are two ways.
1.The harder and better method - to "make" BS2 control the computer through the serial port and write a program on the "receiving end" (one that runs on the pc itself and interprets the signals sent by BS2)
2.To use the debug window, which already receives data and is an easier way to communicate between the stamp and the PC.
Any help on case 2 will be much appreciated for the time being. Let's say we focus on controlling WinAmp, for which there are interesting plugins, if any could help.Or if there is a way through a third-party software to capture text that appears in the debug window and send it as commands to a certain window (for the example - "ctrl+p to winamp window").
Thanks!
How to monitor the Debug Window and based on what appears in it, send commands to another window in windows?
This will let us control winamp, mediaplayer, even send e-mails or perform various actions based on data send to the computer by the BS2 module. How cool is that? Please, someone help!
Porbably what I'm asking for is "childish" and "stupid".
I mean, who wants to control the whole COMPUTER with the basic stamp, have Winamp play a cool tune when the sun goes away and so much more?
Well, well! I've been riding the internet for hours now, not finding anything! And no one is replying, too!
It simply looks like that:
A TERMINAL program that monitors the data being send by the stamp as the program runs, and performs commands associated with the data coming.
But HOW TO FIND SUCH?
Write one. Perl, Python, and Visual Basic all have methods for reading data from the serial port and interacting with other Windows programs. But you have to do the coding to tell it what to do.
-Phil
With a little bit of Visual Basic programming from within an Excel Macro you could potentially launch whatever windows application you want by looking at a particular CELL condition that the BS1, BS2, or Propeller is doing to Excel via the PLX-DAQ conduit.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
"StampDock" graphical/storage/GUI STAMP software for Windows/Mac/Linux
http://forums.parallax.com/showthread.php?p=913157
-Stephanie
If you know basic and a little c. You can also try "JUSTBASICv1.01". Its a free BASIC compiler for windows and I find it a little easer to use than Visual basic. The best thing is it has a demo serial Terminal program that works just like the debug window.Its and easy start for beginners who want to communicate back and forth between a BS2xx and a PC. If you know how to write the code in basic, it will do it.
www.justbasic.com
www.libertybasic.com
For those that want it all try POWER BASIC www.powerbasic.com look for the console compiler
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
I'll check[noparse]:)[/noparse]
Its here that the people that do start reading and the rest ask more questions and post more mindless posts with out learning anything other than how to ask
more questions.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.
want speed!__RIDE THE LIGHTIN__ with PropBaisc___www.propbasic.com__
copy from here and paste in a new justbasic window.
'····· Walts_Serial_Terminal.bas
'
started 8/7/09
REV.__6/12/10__---$WMc%
·'Theirs nothing fancy here. This is just to show how easy it is to communicate between a Stamp and a PC.
·'This program will send info to a Stamp,SX/B,Prop and will read in info from a Stamp,SX/B,Prop.
·'I have tested this code to 230.4K Baud. It works great. I really don't have anything that runs faster to test with here at home!
'
··· nomainwin· 'Not a main window, Just a pop-up window
··· WindowWidth = 600···· 'size of pop-up window
··· WindowHeight = 600
'
··· texteditor #window.te, 0, 0, 596, 458···· 'The handle for our texteditor is #window.te
··· graphicbox #window.gb, 800, 1, 10, 10· 'notice that 800 is out side the limits of the screen,that hides this box
'··· open "Walts Serial Terminal COM1" for window as #window·········· 'The handle for our window is #window
··· print #window.gb, "when characterInput [noparse][[/noparse]getChar]"·· 'When the user presses a key go to [noparse][[/noparse]getChar]
'
' Pay carefull attention here.
'
··· print #window, "trapclose [noparse][[/noparse]quit]"··· 'When the user closes our terminal window, go to [noparse][[/noparse]quit]
'
'··· "trapclose" is·a click on the·RED X box to the right in the upper right hand corner of window thats open
'··· The "trapclose" is very important. If you don't close the com port on exit, Nothing, I mean notta, Bill Gates him self will not
'····be able to access this port with out rebooting the computer.· Make sure you close the com port before you exit a program or a pop-up!!!!
'··· see [noparse][[/noparse]quit] at the bottom of this code.
'
··· Com = 8192 * 2· 'this is a 16K FiFo buffer for #comm
··· open "COM1:9600,n,8,1,ds0,cs0,rs" for random as #comm·· 'Port to open = COM1, Baud = 9600, Parity = n (none), Data bits = 8, Stop bit =·1,ds=0, cs=0, rs=?····
'
··· ' " random " is because we arn't looking for a certain set of inputs, rather some random info from the com port,
··· ' and not in any specific order. This lets the compiler now what we'er after.
··· 'with the Propeller I use 115200 Baud
'
[noparse][[/noparse]loop] 'this is the active pop-up window.We need to tell the compiler to focus in on the targets described below
'
··· print #window.gb, "setfocus"
··· WMc$ = input$(#comm, lof(#comm)) 'check on com port. this is really looking at the FiFO buffer,The input$ and lof( )lets us do that.
··· if WMc$ <> "" then print #window.te, WMc$;··· 'send the data to our pop-up window
··· scan··· 'this looks for key strokes,since we used Inkey$, But it could be a mouse button or a joy-stick
··· goto [noparse][[/noparse]loop]
'
[noparse][[/noparse]getChar]
··· key$ = Inkey$· 'read in a valid key press. NOTE!!! the compiler has a limited ASCII code.it will not read all the keys on the key board
·················· 'with out some added info.these are like F keys,HOME,PAGE-UP,etc.
··· if len(key$) = 1 then print #comm, key$;· 'This sends the key(s) pressed to the to the FiFO buffer and then to the COM port when the
············································· 'port is ready
··· goto [noparse][[/noparse]loop]
'
[noparse][[/noparse]quit]·· 'make sure you use this in all of Your codes that open a COM port and a window!!!
··· close #window
··· close #comm
··· end
This should get you started with justbasic.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA
want speed?·want·to use the Propeller?·want to stay with BASIC___www.propbasic.com___
You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.
Post Edited ($WMc%) : 7/3/2010 2:09:54 AM GMT