Please login or register.

Login with username, password and session length
Advanced search  

News:

The Buster PiX10Hub is here! Created by the Community, for the Community.:)% #:)

Author Topic: Converting the x10 VB code to perl  (Read 4920 times)

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Converting the x10 VB code to perl
« on: March 24, 2008, 07:54:21 PM »

Come to find out from one of my perl books, translating VB to perl is not that difficult (for some that is) :)

I was wondering if any of you VB guru's would be willing to help me figure this out.
What I want to do is add the capabilitily to my perl program to monitor x10 traffic.
The perl examples in the sdk only show how to turn items on and off and do queries.
I can do all that no problem, I just need to monitor x10 traffic and get the module traffic info - eq - recvplc f2 off

I am looking at the VBActiveHome.vb file in the VBActiveHome folder. I only need to translate the bits that monitor the x10 traffic from this file.

VB has access to OLE and perl uses the perl module Win32::OLE

Here is what my perl book says about translating VB to perl.

Visual basic also uses a CreateObject call to create automated objects.

VB uses a set statement - eg
Code: [Select]
set Message = *****perl just uses a normal assignement  - eg
Code: [Select]
$Message = ******
VB references properties and methods using the dot operator - eg
Code: [Select]
Mesage.Subject = "Subject"perl uses the pointer arrow for methods and the pointer arrow and a hash for properties - eg
Code: [Select]
$Message->{Subject} = "Subject";
Looks to me like this line in the x10 VB file

Code: [Select]
ActiveHomeObj = CreateObject("X10.ActiveHome")
translates to this in perl

Code: [Select]
use Win32::OLE;
$ActiveHomeObj = new Win32::OLE('X10.ActiveHome');

Can anyone edit the VbActiveHome.vb file down so that it is only an x10 monitor program and get rid of the send x10 commands section.
I don't need the VB monitor to be a subroutine, just the basic code.
I'll try my best to do the translation and see what I can come up with.

Thanks so much for any help.
Doug
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.