Announcement

Collapse
No announcement yet.

Basic VBS Script problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Basic VBS Script problem

    I'm trying to write my first 'real' scripts at the moment. I'm starting with the basic example from the help file 'Controlling Homeseer from Windows Scripting Host' (since I'm doing VBS).

    Set hsi = createobject("HomeSeer2.application")

    If I execute this on the machine where HS is installed, it works fine. However, I want to execute this from a different machine, and when I try, I am getting an error

    ActiveX component can't create object: 'HomeSeer2.application'

    My impression from reading thru the messages and from the Scripting Webinar, was that I just needed to have the speaker application installed on the remote machine (which I have). Machine is running Windows 7 x64.


    G

    #2
    Ah, cardboard superman......

    The issue is with the 64 bit scripting - you can't access homeseer from 64bits, you need to do it from 32bits (via SYSWoW64). There are 2 solutions

    Run %windir%\SysWoW64\cmd.exe and then run cscript from there - that will run the script using the 32 bit version of cscript.

    Directly run %windir%\SysWoW64\cscript.exe if you're calling it from a batch file or from a shortcut.


    Hope this helps someone from beating their head in the future.


    G

    Comment


      #3
      Originally posted by gmitch64 View Post
      Ah, cardboard superman......

      The issue is with the 64 bit scripting - you can't access homeseer from 64bits, you need to do it from 32bits (via SYSWoW64). There are 2 solutions

      Run %windir%\SysWoW64\cmd.exe and then run cscript from there - that will run the script using the 32 bit version of cscript.

      Directly run %windir%\SysWoW64\cscript.exe if you're calling it from a batch file or from a shortcut.


      Hope this helps someone from beating their head in the future.


      G


      gmitch64 Many Thanks!

      I did not get it it why it got the error.

      This helped me to implement starting and stopping one of my servers by just clicking a button in HSTouch.

      Comment


        #4
        Hi

        Sorry to hijack an old thread but my issue is very related to the original issue!

        I'm also having an issue with running a vbs script on Windows 7 64bit when it tries to access a remote HSPro installation (on XP). I can access my remote HS PC via vbs from XP and Vista clients ok, the issue I have is only on one new Win7 64 box. I've installed the HS speaker client 2.5.0.49 that I downloaded from HS yesterday on the Win7 PC which works ok. All the PCs are on the same subnet and no firewalls are running anywhere.

        The start of my vbs code that works on other PCs is:

        Set hsi = CreateObject("HomeSeer2.application")
        hsi.SetHost("192.168.2.83")
        rval = hsi.Connect("default", "XXXXXXX")
        If rval = "" Then

        If I run the code using syswow64\wscript I receive an error pointing at the line "Set hsi = CreateObject("HomeSeer2.application")" that says the system can't find the file specified. I've tried to register the homeseer2.dll with the syswow64 version of regsvr32 but I receive a message saying that the entry point DllRegisterServer was not found. I'm missing something obvious?

        Thanks

        Comment


          #5
          Ty
          Cscript instead of wscript.See the reply in my response

          Comment


            #6
            Originally posted by Hammy View Post
            Ty
            Cscript instead of wscript.See the reply in my response
            Thanks for your response. I should of said above, wscript and cscript give the same problem on my Win7 64 system, I get the file not found message if I try either syswow64 command.

            Comment


              #7
              Interesting! I've found another Windows 7 64bit PC and my HS scripts run fine on that when using cscript from syswow64. Both systems are Dell standard builds on Dell laptops and are running Win7 Pro, though they are on different models. I can't see anything obvious on the differences in the setups of both systems yet but I'll keep looking! The scripts on both systems are identical:

              Set hsi = CreateObject("HomeSeer2.application") <-fails here
              hsi.SetHost("192.168.2.83")
              rval = hsi.Connect("default", "XXXXXXX")
              If rval = "" Then

              Edit: I can't see much different between the two Win7 64 bit system but one system can use vbscript to access HS but the other can't. I've re-installed HS-Speaker, disabled UAC and compared other settings but so far I'm stuck! Any ideas what else I could check?
              Last edited by Bert.Twildge; October 5, 2013, 10:04 AM.

              Comment


                #8
                Hi, just a thought here.
                Have you tried to run the script as Administrator or/and switched them to compatibility mode as XP? (It can be done under properties) Just to rule out secuity issues and/or compatibility issues
                - Bram

                Send from my Commodore VIC-20

                Ashai_Rey____________________________________________________________ ________________
                HS3 Pro 3.0.0.534
                PIugins: ZMC audio | ZMC VR | ZMC IR | ZMC NDS | RFXcom | AZ scripts | Jon00 Scripts | BLBackup | FritzBox | Z-Wave | mcsMQTT | AK Ikea

                Comment


                  #9
                  Originally posted by AshaiRey View Post
                  Hi, just a thought here.
                  Have you tried to run the script as Administrator or/and switched them to compatibility mode as XP? (It can be done under properties) Just to rule out secuity issues and/or compatibility issues
                  Hi

                  Thanks for your help and your suggestions. I have the same problem if I try and run as you suggest I'm afraid. The weird thing is that I have two similar Dell Win7 pro 64bit builds, one has the issue and one does not when running the same script. If I run the script on the problematic screen I see this:

                  C:\Windows\SysWOW64>cscript.exe hslog.vbs
                  Microsoft (R) Windows Script Host Version 5.8
                  Copyright (C) Microsoft Corporation. All rights reserved.
                  C:\Windows\SysWOW64\hslog.vbs(5, 1) (null): The system cannot find the file specified.

                  The line the failure occurs on is Set hsi = CreateObject("HomeSeer2.application"). It is as if the Homeseer2 dll hasn't been registered or the registration is incorrect on the faulty machine.

                  Thanks

                  Comment


                    #10
                    This is what comes into my mind.

                    - C:\Windows\SysWOW64 is not in your path
                    - The HomeSeer dll's are not in the above folder
                    - The DLL isn't registered correctly.
                    You might give this url a look http://social.msdn.microsoft.com/For...rum=netfx64bit
                    - Bram

                    Send from my Commodore VIC-20

                    Ashai_Rey____________________________________________________________ ________________
                    HS3 Pro 3.0.0.534
                    PIugins: ZMC audio | ZMC VR | ZMC IR | ZMC NDS | RFXcom | AZ scripts | Jon00 Scripts | BLBackup | FritzBox | Z-Wave | mcsMQTT | AK Ikea

                    Comment


                      #11
                      Originally posted by AshaiRey View Post
                      This is what comes into my mind.

                      - C:\Windows\SysWOW64 is not in your path
                      - The HomeSeer dll's are not in the above folder
                      - The DLL isn't registered correctly.
                      You might give this url a look http://social.msdn.microsoft.com/For...rum=netfx64bit
                      Hi

                      Many thanks for your help! I copied DLLs around, rebooted the PC many times and nothing would encourage the Win7 64bit PC to talk to HS. I checked through registry entries to ensure Homeseer2 was registered the same on both 64bit PCs, which it was. I went for a cup of tea (I am British after all) and it suddenly started working! I can't say what fixed it exactly as I tried so much, it might of been my threat of violence towards the PC, it could of been tea spilled on the keyboard, but it is working now!

                      Thanks

                      Comment

                      Working...
                      X