Announcement

Collapse
No announcement yet.

Remote Script Requests and Help

Collapse
This topic is closed.
X
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #76
    I just checked the code, and all files are set to the "Any CPU" Platform.

    However, the file HsScript.exe is linked to homeseer.dll and scheduler.dll

    Are these 2 files from the latest HomeSeer version ?
    --
    stipus

    Comment


      #77
      Try this new build. I have forced the Platform to "X86" for all files.

      It "should" solve the problem.... fingers crossed !
      Last edited by stipus; December 4, 2009, 06:41 PM.
      --
      stipus

      Comment


        #78
        I never believed in this thing with the fingers - until now;-)

        It works like a charm!

        The two DLL's you ask for, are from the last HS2 release 2.2.0.66

        Thanks you very much for your effort today, Stipus.

        Best regards,

        Mav

        Comment


          #79
          Thank you too !

          I did learn something : behavior of 32-bit dlls on 64 bit systems...

          All my plugins are compiled to work for any platform. That's easy as they are all pure .Net programs. This means HsScript.exe initializes as a 64-bit program on a 64 bit system. However HsScript.exe needs to access to a 32-bit only HomeSeer dll.

          Now if I force HsScript.exe to 32-bit only, Windows-64 runs the program in 32-bit compatibility mode... and can access any 32-bit DLL.

          ... with Microsoft you need to learn all days.
          --
          stipus

          Comment


            #80
            RGB Rope Light Rotating values?

            NEVERMIND - I got it while working...

            The script at the end SEEMS to be working.

            I added two more events (B16 on and off) that enable/disable the recurring event that triggers every 10 seconds)


            Ok, I know what I want to do...and I can probably do it in long form...but painfully.

            I have 3 colored rope lights...Red, Blue & Green that are in a sofit.

            The IDEA is to have a randomly changing color wash the room based on the RGB rope lights.

            Problem: they are on the dumb wired-in modules which don't have soft-start or other smart dimming capabilities.

            What I would love is a script that will vary 3 channels from low to high once called and will continue until a Stop is received.

            The "brute force" method I had in mind was to have a script with a int(Rnd(3)+1) to pick a channel and then Int(Rnd(1)) to determine dim/bright. I will have to check the current value for the channel, and do nothing if it is either 0 or 100...

            However... getting that IDEA into a working script is another matter...

            Bob

            Here is my first pass

            Sub Main
            Dim R, G, B, Channel,updown, step,statmsg

            'Get the current RGB Values from the system

            R = hs.DeviceValue ("B10")
            G = hs.DeviceValue ("B11")
            B = hs.DeviceValue ("B12")
            Step = 10

            ' randomize to the pastern doesn't repeat

            Randomize()

            ' Pick a channel 1-3

            Channel = int((rnd(1)* 3)+1)

            updown = int(rnd(1)+ .5 )

            select case Channel
            case 1
            if updown=0 then
            hs.ExecX10 "B10","DDim" ,R + step
            else
            hs.ExecX10 "B10","DDim" ,R - step
            end if
            case 2
            if updown=0 then
            hs.ExecX10 "B11","DDim" ,G + step
            else
            hs.ExecX10 "B11","DDim" ,G - step
            end if
            case 3
            if updown=0 then
            hs.ExecX10 "B12","DDim" ,B + step
            else
            hs.ExecX10 "B12","DDim" ,B - step
            end if

            end select

            Statmsg = "RGB Values " + Cstr(R)+ " " + Cstr(G)+ " " + Cstr(B)+ " "+ Cstr(Channel)+ " "+ Cstr(Updown)

            hs.writelog "Info",Statmsg

            End Sub
            Last edited by rsisson; July 4, 2008, 04:20 PM. Reason: Corrected the script...

            Comment


              #81
              Replacement variable for Remote Computer Name?

              I am trying to develop and run a single script that is common to several remote computers. Rather than having to create 4 events to run the same script on four remote computers, I would like to know if it is possible to launch a remote script using a "replacement variable" to pick up the remote computer name at runtime?

              I would create a single HS Device as a placeholder for a virtual status, and then set that Device status equal to the "computer name" of one of the remote computers based upon certain conditions...

              I would like to define an Single HS Event to launch a remote script, and use a "replacement variable" concept to pass the current HS device Status for the "Remote Computer" to the input parameter definition of the event.

              Is this possible ... is there an easier way to do something like this... or should I just stick to my day job??

              Suggestions/help would be greatly appreciated!!

              - Bob

              Comment


                #82
                This is possible:

                Use the following to get the Script Client Name as a string:
                sh.ClientName

                You can also get the real computer name by using the appropriate .Net API such as
                Environment.MachineName

                The plugin has a set of API to run scripts and pass parameters.

                Code:
                - From any HomeSeer script, use the plugin ExecRemoteSub() API
                
                Example from HS Immediate Command Window:
                &hs.plugin("Script Connector").ExecRemoteSub "remote_client_name", "remote_messagebox.vb", "hello from HomeSeer"
                
                - From any HomeSeer script, use the plugin ExecRemoteFunc() API to return a result from the script Main Function
                
                Example from a HomeSeer VB script:
                hs.WriteLog( "Result", hs.Plugin("Script Connector").ExecRemoteFunc( "remote_client", "remote_test_func.vb", Nothing ) )
                Last edited by stipus; August 21, 2008, 08:16 AM.
                --
                stipus

                Comment


                  #83
                  Stipus:

                  Thanks for the quick and detailed response... very helpful for a relative rookie like me. I'm having a great time with HS and your remote scripting plugin ...endless possibilities!

                  now...if only I could get my typical call center representative to provide your level of service!

                  - Bob

                  Comment


                    #84
                    Automatically pop-up camera view when motion detected

                    I've been struggling with this issue for months, and I think ScriptConnector will do what I want but I don't have any experience with VB.NET (or any other form of VB.) though I'm willing to learn.

                    I have video cameras at my front door, as well as a motion sensor. I view my cameras on any PC by running an application called "NetVu ObserVer." What I want to happen is, when HomeSeer sees that my security system's "front door motion" zone is tripped, run a remote script on all client computers that will do the following:
                    1. Determine if NetVu ObserVer (exe) is running already
                    2. If not running, load it
                    3. Bring the application to the foreground (even if it was minimized)

                    I already send a Speaker command to say "Motion detected at front door." So, when I hear any of the machines on my LAN say there is motion at the front door (even if the visitor hasn't pressed the doorbell), all I need to do is glance at the screen and it will automatically display the image at the front door camera.

                    I've found a very simple .vbs script that will change the focus if the application is already running, but it won't put the image on screen if the application has been minimized (it will bring the focus to the button along the bottom of the screen.) Also it won't load the application if it isn't already running, and I don't think it's supported by Script Connector because it's a .vbs and not .vb:

                    Option Explicit
                    Const Title = "NetVu ObserVer"
                    Dim Wsh
                    Set Wsh = WScript.CreateObject("WScript.Shell")
                    Wsh.AppActivate Title

                    I don't suppose I could impose on someone to write this script for me? Or if not, at least point me in the right direction - I'll be glad to buy VB.NET and Script Connector and whatever other tools I need, as necessary. Then all of my worldly problems would be solved ;-)

                    This seems like a useful script to have as a generic tool where you passed the application name as a parameter -- could be used to automatically present the user with whatever application is desired in a given situation.

                    If I can't do this with a simple .vbs file, could I use the free VB 2008 Express Edition?

                    Thanks in advance for any help or suggestions!

                    Randy

                    Comment


                      #85
                      All you want can be done quite easily. You just need the script connector plugin. No need to buy VB.NET.

                      There is also a 30-day trial period, so you can be sure the script works fine before buying the plugin.

                      I don't have enough time right now to create the script for you, but I can point you in the right direction.

                      You can start by looking at the sample scripts here:
                      http://board.homeseer.com/showthread.php?t=123250

                      There is a sample to check if an application is already running (the script to restart HomeSeer does this), an other to start any application (push any ie page maximized)... By combining lines from these scripts properly, you should be able to do it.
                      --
                      stipus

                      Comment


                        #86
                        Okay, I'll buy it and try it.

                        I am confused on one thing -- don't I need a compiler to create a .vb script? Or can I execute a .vbs text file using Script Connector? Sorry I'm still trying to understand what's what (and I also don't know what a HomeSeer .NET script is, but I'll try to figure it out.)

                        Thanks.

                        Randy

                        Comment


                          #87
                          HomeSeer .Net scripts and script connector scripts are the same. The script connector has been designed to be compatible with any HomeSeer VB.NET script.

                          To create a script you just need a text editor such as notepad.exe. There is no need for a compiler as scripts are compiled just before they are executed by HomeSeer or by the Script Connector Client.

                          There are very small differences:

                          - HomeSeer VB.NET scripts are compiled in memory whereas Script Connector scripts are compiled as a DLL with the same name as the script and .dll appended

                          - The Script Connector supports C-Sharp scripts (that's one of the main reason why I created this plugin... VB is not my cup of tea...)

                          - Script Connector scripts also have access to a specific API to manage remote computers...

                          - And of course script connector scripts can run on remote computers.

                          You can execute a slightly modified .vbs script with the script connector. There are a few syntax changes between .vbs scripts and VB.NET scripts such as parenthesis after all procedure calls.
                          Last edited by stipus; December 5, 2008, 03:52 PM.
                          --
                          stipus

                          Comment


                            #88
                            Here is the script (attached)

                            The script parameter is the full application path eg c:\program files\whatever\netvuobserver.exe

                            If the application is already running, the application main window is brought to foreground and maximized.

                            If the application is not running, the process is started maximized.

                            --

                            - Unzip and save remote_activateapp.cs to the HomeSeer 2\Scripts directory on your remote computer(s).
                            - From any HomeSeer event, add a "Exec Remote Script" action
                            - Type the name of the remote script client or * to execute the script on all remote computers.
                            - Enter the remote script name remote_activateapp.cs
                            - Enter the full path to the .EXE to activate as the script parameter

                            [EDIT] Attachement removed as a new version is available post #96
                            Last edited by stipus; December 7, 2008, 09:15 AM.
                            --
                            stipus

                            Comment


                              #89
                              How does this deal with IE and sending it a particular page to open (Ie a IP camera) I call my current remote script with:

                              Exec remote script Remote_ie2.cs on computer * Param: http://192.168.0.5/user/cgi-bin/view_S_t_uF.thtml

                              It opens 192.168... in veiw mode etc...

                              The following script is what I use... It obviously has been "optimized" to look for the Toshiba named process...

                              #USING System.Diagnostics
                              #USING System.Runtime.InteropServices
                              [DllImport("user32.dll", SetLastError = true)]
                              static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
                              [DllImport("user32.dll")]
                              [return: MarshalAs(UnmanagedType.Bool)]
                              static extern bool SetForegroundWindow(IntPtr hWnd);
                              void Main( object param )
                              {
                              IntPtr hWnd = FindWindow(null,"Bellwoods1 (VGA) TOSHIBA Network Camera - IK-WB15A. - Windows Internet Explorer");
                              if( hWnd == IntPtr.Zero )
                              {
                              ProcessStartInfo processStartInfo = new ProcessStartInfo();
                              processStartInfo.FileName = "IEXPLORE.EXE";
                              processStartInfo.Arguments = param.ToString();
                              processStartInfo.WindowStyle = ProcessWindowStyle.Maximized;
                              Process.Start( processStartInfo );
                              }
                              else
                              {
                              SetForegroundWindow( hWnd );
                              }
                              }


                              It does occasionally "Bounce" and I will get TWO processes trying to run... haven't figured out why...

                              Comment


                                #90
                                Your script may try to show two pages if it's called a second time before the ieprocess process had enough time to start and show the page.

                                There is a way to deal with this... I'll try to fix your script ...
                                --
                                stipus

                                Comment

                                Working...
                                X