Jump to content

Sending commands from au3 script to one on another computer.


Recommended Posts

This is kinda long and drawn out but, here goes...

I have one of the Radio Shack X10 controllers that runs from a serial port to control modules around the house. The software that works with it will only work in Win 3.1 or Win95. I have an old laptop that I can switch to by KVM that is used only for this purpose. I would like to set up a "listener" on the Win95 machine that will replicate mouse movements and clicks. I would write a small GUI on my Win7 machine with a couple of buttons that would tell the listener what to do. I have been all through the example script looking for something to give me a hint on how to do this, but have come up with nothing. (Edit: I have found a few things, but the writers are not posting scripts, only exe files..)

Anyone have any ideas? I am fairly proficient with AutoIt, so I don't need the whole thing written out for me... but any help would be greatly appreciated.

Thanks in advance.

Edited by Mordanthanus

˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן

Link to comment
Share on other sites

I forgot to mention in my previous post... I am already using Autoit on the Win95 machine. I have set up recorded mouse movements and keystrokes to turn certain lights on and off. I have a small GUI that I just click a button and it runs the recorded "macro". I just can't get the GUI on my other machine to pass the commands to the Win95 machine.

˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן

Link to comment
Share on other sites

The things that the software on the laptop does something you can code as well?

If so you can write your own software to take input from the controller and do what you want with it. I did something like this for a senior design project in computer engineering a little over a year ago. I ended up using some serial port au3. I think it might be this one http://www.autoitscript.com/forum/index.php?showtopic=45842&hl=communication%20port&st=0

Basically just write a test script to take the data on the serial port and send it to console. Loop this continuously and just press the different buttons on the controller to see in the console what numerical value your script will see. Use these in some kind of looping switch and execute the necessary functions required when the buttons are pressed.

This is all assuming you can replicate the functions of the old software once it knows what buttons were pressed. If not, look at the TCP commands and examples and just communicate that way.

Link to comment
Share on other sites

The old software is a CRAPPY, buggy GUI that is just not intuitive at all. I have tried everything to get it to run on my new machine... it was written for Win3.1/95 by a bunch of semi-intelligent programmers. In order to not really have to deal with their GUI, I created a button strip in Autoit that sits across the bottom of the screen right on top of the taskbar that runs recorded mouse movements and keystrokes for me. I'll switch to the machine, click the button I want, then switch back without waiting for the script to finish (ie. watching the mouse move around the screen and such). My new machine is Win 7 x64... I've created an newer looking button bar that has the same buttons as the Win95 machine does. I just don't know how to send commands from my "controller" on Win7 to the "listener" on Win95. I know it will involve adding some code to reference TCP and such. I am not interested in security to be honest... just being able to send the info over my network to the other machine. (someone else sending commands to my old machine to turn off my living room light? hehehe)

˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן

Link to comment
Share on other sites

I misunderstood and thought the X10 was an input controller device but instead I think you are saying the software is the input and controls the X10 which receives the input.

Well again I would say why even use their software? You can eliminate the need for your old laptop. The device just responds to signals sent over the serial port. Now I've never done it this way but it might be possible with the UDF I listed or perhaps in another manner to intercept or read the data sent over the serial port by the software. It's just numbers, the size of which depends on the number of bits it sends at a time. All you need to do is write your own GUI with the same buttons and send the same data over the serial port using the UDF when the buttons are pressed.

Then just plug the thing into your new computer and voila, you can use the old win 95 junk for target practice!

Link to comment
Share on other sites

It would take a lot of work, but in the end be worth it, I guess. I'll probably be the only person to use it, as the little box from Radio Shack is pretty rare by this point. I would have to click each function in the Win95 software, intercept it, then write individual functions for each of them. I could then send these "strings" one after another from my script to the serial port... man, that's a lot of work. Is there no way to get my script running on the Win95 machine to respond to clicks on my Win7 machine? At least this way, I know what MY program is doing... not troubleshooting both my AutoIt code as well as the intercepted strings going to the serial port?

˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן

Link to comment
Share on other sites

There is another reason I am doing all of this...

When we are going to watch a movie in the living room from my computer, I have to switch over to the Win95 machine to dim the lights in the living room (I know there is a switch in there... that is beside the point for my future uses as you will see...).

I am writing another AutoIt script to do the following in order:

open Media Player

move it to the correct "screen" (VGA output)

Dim the lights to 80%

play Pixar short or "preview"

Dim the lights to 40%

start playing the movie

dim the lights down by 10% every 3-5 seconds until they are off

When the movie is complete, it brings brightness back up to 50% in 10% increments, then after 1 minute, back to full brightness.

Oh, and in addition to controlling the living room lights, it will turn off any other lights in the house that could cause a shadow or something viewable in the living room.

I can do all of this from the other room if I'm sitting in front of my computer... I can do the choreography manually. But I'd rather be in the living room to watch the movie with everyone else without running back and forth.

I am basically just automating my home theater... a little bit at a time.

˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן

Link to comment
Share on other sites

Messaging.

You can either implement a canned messaging system (even email has been used like this) or do a real quick and dirty thing like drop a file in a shared folder (VM's make this pretty easy) and watch for said file on the other computer with a process.

Link to comment
Share on other sites

If your win7 machine is connected to your laptop only by a KVM then as far as either computer can tell, the other doesn't exist. Right? I think you might need another way to connect the two machines together, over a network I guess. Then you can use the tcp/ip functions.

Link to comment
Share on other sites

Yeah, I guess I forgot to say that just about everything in my house is networked... And yeah, I meant some kind of TCP/IP communication between the two scripts.

I have since made a big change... I set up a virtual machine under Virtualbox running WinXP Home that I am running the radioshack software on to control the X10 modules. This software will not run on my Win7 machine because of the 64 bit OS, but runs fine in XP Home (after some tweaking). I have the VM and the host talking to each other via TCP/IP... Also, The X10 controller from Radio Shack doesn't seem to work with any other X10 software I've found.

Again, Thanks for the attention and help all...

Edited by Mordanthanus

˙˙˙ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...