Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Elusive VBS execution. Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
RichardL
Senior Member
Senior Member


Joined: December 29 2008
Location: United States
Online Status: Offline
Posts: 165
Posted: March 23 2009 at 16:23 | IP Logged Quote RichardL

I have gone forth and purchased Powerhome. I have added my appx 150 devices, setup a bunch of links and am moving on.

My next step is to call VBS scripts to perform various functions. I will use timed events and triggers.

I have started with the basics - a one line vbs to turn on a light.

I have tried every combination to try and figure out how to have the vbs called from timed events. Triggers are next.

The particualar switch (XBR-HALL) works flawlessly from the direct control under devices, so I know that is good. I used the macro editor to confirm that the script was OK, the command worked when I clicked "play".


Timed Event Setup:
ID: HT1
Not disabled
Start Time: (set 2 minutes ahead of current time for each test)
Timing: Exact
Frequency: Daily
Offset: None
Offset Amount: 0
Reference Time: (set 2 minutes ahead of current time for each test) Here is where I set the time.
Type: Raw Formula
     I also tried Send Keys and Device Control.
ID/Keys/Formula:
PH_RUNSCRIPT_0(0, "C:\PHScripts\Halltest-0.vbs","")
Boolean: 0


HALLTEST-0.VBS:

Sub Main()
     
X = PH.INSTEON("XBR-HALL", 17, 255)

End Sub


Any ideas?

Thanks in advance for your time and help.

Richard.
Back to Top View RichardL's Profile Search for other posts by RichardL
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: March 23 2009 at 16:30 | IP Logged Quote BeachBum

Boolean needs to be 1 to trigger.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
RichardL
Senior Member
Senior Member


Joined: December 29 2008
Location: United States
Online Status: Offline
Posts: 165
Posted: March 23 2009 at 17:18 | IP Logged Quote RichardL

That sounded too good. I made "boolean" a "1", still no luck.

I also now considered permissions - I confirmed that the local account I am logged in under had "full cntrol" permissions on C:\PHScripts. That local account is also in the PC's administrator group. So that should be OK.

In the event log I get a green HT1 executed entry.

Still no light comes on.

I attached a snapshot of the entry and the VBS, since a picture can reveal more. (you can see the green event log entry on the bottom).

Running: Powerhome v2.1b

Thanks for all,

Richard

Back to Top View RichardL's Profile Search for other posts by RichardL
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: March 23 2009 at 17:28 | IP Logged Quote BeachBum

It sounded good. It looks like the trigger is firing. Have you tried a Macro instead of Raw Formula. If that works than, as you know, we are down to the script which I have no expertise in.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
RichardL
Senior Member
Senior Member


Joined: December 29 2008
Location: United States
Online Status: Offline
Posts: 165
Posted: March 23 2009 at 17:51 | IP Logged Quote RichardL

Sounds like an idea, I looked into the macros and there are many choices.

Some questions would remain:
1. What is the proper way to execute an VBS from Powerhome under a trigger of timed event?
2. How can one execute a VBS from within a macro?

Thanks,

Richard
Back to Top View RichardL's Profile Search for other posts by RichardL
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: March 23 2009 at 19:21 | IP Logged Quote TonyNo

I think he meant to just use a macro for testing and not any VBS.

Set up a macro as below and call it from the trigger.

Create a new macro, select Device Control in the Command column, then paste in "INSTEON+XBR-HALL+ON" (no quotes) into the Send Keys/TTS/Dim/Formula column.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
RichardL
Senior Member
Senior Member


Joined: December 29 2008
Location: United States
Online Status: Offline
Posts: 165
Posted: March 23 2009 at 20:38 | IP Logged Quote RichardL

Yep the macro works!

One interesting thing I noticed:
* when working with the timed events, if you change the time, you must click on the ID for the "start time" to pick up the modified "refence time". I was doing this all day. However, that is not enough, if you do just that, the macro will not run. You must exit the "timed event" Powerhome Explorer screen - I clicked on the "triggers" which is below in the left menu, then click back to the "timed events" ONLY THEN will the macros run. Looks like the database is only updated when you leave the screen.

With that I anxiously setup an additional timed event (HT2) and tried (including exiting and re-entering) everyting to run a VBS via ph_runscript_0(0, "C:\PHScripts\Halltest-0.vbs", "") using a "Raw Formula", "Send keys" and "Device Control", with Boolean = 1. Powerhome reacts, and in the Raw Formula setting, indicates that it runs the script OK, but no light comes on. The script is about as basic as it gets.

Any ideas??? Is there any documentation/help file that shows the steps for running a VBS at a specific time?

Thank you!

Richard
Back to Top View RichardL's Profile Search for other posts by RichardL
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: March 24 2009 at 15:48 | IP Logged Quote BeachBum

I’ve been playing…. Do you have Load Script Server checked under Setup-Preferences? Don’t forget to Reinit.

Edited by BeachBum - March 24 2009 at 15:49


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: March 24 2009 at 16:10 | IP Logged Quote BeachBum

The other thing I found was this:

PH_RUNSCRIPT_0(0, "C:\PHScripts\Halltest-0.vbs","")

Needs to be this:

PH_RUNSCRIPT_0(0, "C:\PHScripts\Halltest-0.vbs","MAIN")


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
RichardL
Senior Member
Senior Member


Joined: December 29 2008
Location: United States
Online Status: Offline
Posts: 165
Posted: March 25 2009 at 00:28 | IP Logged Quote RichardL

EUREKA!   

The Script Server was not checked, checked it, reinit, re-ran script - all OK!

Into late last night I continued testing, including that 3rd parameter, and editing differing VBS subs. I eventually determined that Powerhome was calling the script OK. To confirm the integrity of the scripts I ran tests, which included running the script with a CMD file shell around it. This was accomplished by substituting the VBS path/file with "CMD /K C:\PHScripts\HallTest-0.CMD".

The HallTest-0.CMD file was 2 lines:
CScript C:\PHScript\Halltest-0.vbs
PAUSE

The PAUSE statement allowed me to stop the action and see the command prompt window with the script errors in it. I noticed that all the "PH." commands indicated that the object library was not present. My inclination was that upon Powerhome install, I needed to install the object library as a post task.

I looked to post that finding and question on how to do that tonight, but that one teeny checkbox was the answer!

THANK YOU!

A possible Powerhome enhancement is that if one tries to execute external scripts, like VBS and that checkbox is not enabled, that an error message appears in the event log.

Now we are on to bigger better things, and possibly more questions...

Thanks again!

Richard
Back to Top View RichardL's Profile Search for other posts by RichardL
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: March 25 2009 at 08:57 | IP Logged Quote BeachBum

Mind you I know nothing about VBS. Having said that, I ran what you posted and I got no errors on my system. It came to the pause with no error box and my ph.* commands executed correctly. If I ran the original script from the Command line, outside of PH, then I got an error box with 800A0400 which I interpreted being caused by the way I called the script outside of PH. When I installed PH I took all the defaults and made no modifications to the instructions.

Maybe Dave or someone else can chime in.


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum