Please login or register.

Login with username, password and session length

Author Topic: new version of ahcmd  (Read 7401 times)

dbemowsk

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 428
    • PHP Web Scripting
new version of ahcmd
« on: June 19, 2010, 04:55:22 AM »

It has been said that the ahcmd.exe file can be a bit flaky at times.  People in here have noted that if at all possible you should find a way to use the ahscript.dll file.  I had written a vbscript file that utilized the ahscript.dll, but running that through CScript proved to be kind of slow.  I decided tonight to download visual basic express and build the script into an executable console application.  I have named it x10cmd.exe.

When run in a DOS window, you use it like the ahcmd.exe program, but the returned information is slightly different.  When you run "ahcmd queryplc D7 on", you don't see anythng returned on the command line.  With x10cmd, you see the queried output.  So if you run the same command "x10cmd queryplc D7 on", you will see -1, 0, or 1 for UNKNOWN, OFF, or ON respectively.

After testing, x10cmd.exe was slower than ahcmd.exe by only a fraction of a second whereas the vbscript version took close to twice as long to run.  I am suspecting though that I will not have the occasional crashes like I was getting with ahcmd.exe.

Anyone interested in this file can download it from here.  It is 12kb in size vs ahcmd.exe which is 60kb, but it does require the ahscript.dll to be registered which shouldn't be an issue for those that have the SDK installed.

Hope it helps some of you.
« Last Edit: June 07, 2011, 01:01:37 AM by dbemowsk »
Logged
Dan Bemowski
Owner of PHP Web Scripting LLC
Programmer of RemoteWatch X10
User of any X10 products I can get my hands on.

bb32

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 1
Re: new version of ahcmd
« Reply #1 on: June 23, 2010, 10:52:11 PM »

Thanks, I have downloaded and and will see if works better. would you be will to share the source file?
Logged

dbemowsk

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 428
    • PHP Web Scripting
Re: new version of ahcmd
« Reply #2 on: June 24, 2010, 12:44:18 AM »

Thanks, I have downloaded and and will see if works better. would you be will to share the source file?
The source for this is extremely basic.  I don't guarantee that this is coded correctly, but it worked.  I have been out of the loop on VB coding for some time now and am quite rusty.  Most all of my coding that I do now is in PHP. 

Anyway, here is the code.

----------------------------------------------------------------------------------------------------------------------------------------

Module x10cmd
    Dim ActiveHomeObj
    Dim arrArgs
() As String Command.Split(" ")

    
Sub Main()
        
Dim intOutput As Integer
        ActiveHomeObj 
CreateObject("X10.ActiveHome")

        
intOutput = -2

        
If (arrArgs.Count 3Then
            Console
.Write("Incorrect number of arguments passed")
        Else
            
intOutput ActiveHomeObj.SendAction(arrArgs(0), arrArgs(1) & " " arrArgs(2))

            While 
intOutput = -2
            End 
While

            
Console.WriteLine(intOutput)
        
End If
    
End Sub
End Module

----------------------------------------------------------------------------------------------------------------------------------------
Logged
Dan Bemowski
Owner of PHP Web Scripting LLC
Programmer of RemoteWatch X10
User of any X10 products I can get my hands on.
 

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