new version of ahcmd

Started by dbemowsk, June 19, 2010, 04:55:22 AM

Previous topic - Next topic

dbemowsk

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.
Dan Bemowski
Owner of PHP Web Scripting LLC
Programmer of RemoteWatch X10
User of any X10 products I can get my hands on.

bb32

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

dbemowsk

Quote from: bb32 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?
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 < 3) Then
           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

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

SMF spam blocked by CleanTalk