Announcement

Collapse
No announcement yet.

NEW Script Connector Plugin V1.10.2.2

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

    Cant get your examples to work, don't know if I do something wrong.
    However if I do an AutoIT3 script this works:
    ProcessClose("streampoint.exe")

    $PID = ProcessExists("streampoint.exe") ; Will return the PID or 0 if the process isn't found.
    If $PID Then ProcessClose($PID)

    Comment


      I just found the GetProcessesByName() API doesn't want the .exe suffix.

      Doesn't work --> Process[] processArray = Process.GetProcessesByName( "streampoint.exe" );

      Works --> Process[] processArray = Process.GetProcessesByName( "streampoint" );
      --
      stipus

      Comment


        void Main( object param )
        {
        System.Diagnostics.Process.Start("D:\Program\Logitech\Stream Point\StreamPoint.exe", "");
        }
        Get this log message (partly in Swedish)

        Comment


          I know what the problem is

          I forgot to tell you that with the C-sharp language, you have to escape the \ with \\ or escape the whole string with an @

          Try this

          System.Diagnostics.Process.Start("D:\\Program\\Logitech\\Str eamPoint\\StreamPoint.exe", "");

          or this

          System.Diagnostics.Process.Start(@"D:\Program\Logitech\Strea mPoint\StreamPoint.exe", "");
          --
          stipus

          Comment


            Yes!
            Works
            This was really good, now I can do many things on remote computers. Starting apps and other scripts and maybe bat files.

            Comment


              You can also control apps by sending any key sequence... in the script gallery there is a sample script to send key sequences to remote computers.

              To run batch files, you need to run CMD.EXE as the process name, and "/C batch_file.bat" as the parameter.
              --
              stipus

              Comment


                I have just added a new Script to the Script Gallery, to control master volume on remote computers. I'll add mute in a next version. Should be easy but I forgot.


                Script Gallery:
                http://board.homeseer.com/showthread.php?t=123250


                You can send volume commands from any HomeSeer event or script, such as:

                &hs.Plugin("Script Connector").ExecRemoteSub "target computer", "remote_volume.cs", "VOLSET 60"

                &hs.Plugin("Script Connector").ExecRemoteSub "target computer", "remote_volume.cs", "VOLUP"

                &hs.Plugin("Script Connector").ExecRemoteSub "target computer", "remote_volume.cs", "VOLDOWN"
                --
                stipus

                Comment


                  Is there a way to send x10 and or zwave from one location to another?

                  Thanks

                  Thom

                  Comment


                    What do you mean exactly ?

                    Can you explain a little more what you need ?
                    You want a CM11a plugged into a remote computer, and send remote X10 commands from the main HomeSeer computer ?
                    --
                    stipus

                    Comment


                      Yes or preferibly a zwave Hometroller in a remote location to send data back to homeseer and maybe even a W800 or RFCOM receiver.

                      Thanks

                      Thom

                      Originally posted by stipus View Post
                      What do you mean exactly ?

                      Can you explain a little more what you need ?
                      You want a CM11a plugged into a remote computer, and send remote X10 commands from the main HomeSeer computer ?

                      Comment


                        Yes it's possible, but the scripts might be difficult to create, unless you find a .Net library to control these interfaces.

                        For example, with a remote CM11a it's very easy because you can find a .Net 2.0 library.

                        With the CM11a lib available here:
                        http://brian.vallelunga.com/code/x10/

                        You can create a simple script such as the following to control a remote CM11a:

                        remote_cm11a.cs
                        Code:
                        #IMPORT Vallelunga.HomeAutomation,Vallelunga.HomeAutomation.dll
                         
                        void Main( object param )
                        {
                          using ( CM11A controller = CM11A.Instance("COM1") )
                          {
                           controller.SendCommand( X10HouseCode.A, 1, X10Command.Brighten, 50 );
                          }
                        }
                        --
                        stipus

                        Comment


                          I think you and misunderstanding me. I need to have it act as the device is apart of homeseer. So if a device gets a on command from either building it will act like it would if it was all in the same building. Does this make sence?

                          Thanks

                          Thom

                          Originally posted by stipus View Post
                          Yes it's possible, but the scripts might be difficult to create, unless you find a .Net library to control these interfaces.

                          For example, with a remote CM11a it's very easy because you can find a .Net 2.0 library.

                          With the CM11a lib available here:
                          http://brian.vallelunga.com/code/x10/

                          You can create a simple script such as the following to control a remote CM11a:

                          remote_cm11a.cs
                          Code:
                          #IMPORT Vallelunga.HomeAutomation,Vallelunga.HomeAutomation.dll
                           
                          void Main( object param )
                          {
                            using ( CM11A controller = CM11A.Instance("COM1") )
                            {
                             controller.SendCommand( X10HouseCode.A, 1, X10Command.Brighten, 50 );
                            }
                          }

                          Comment


                            Yes, this makes sense and this is possible.

                            The sample script I have shown here is just a sample of what can be done.
                            - The Script Connector allows HomeSeer to control a remote CM11a
                            - The remote script has access to the whole HomeSeer API
                            - So what you want is possible

                            However, doing what you want requires a more complex script than my sample:

                            - You need to interface each HS device action to the remote CM11a
                            - You need to interface what the remote CM11a hears back to HomeSeer.

                            So: Yes this is possible, but there are no sample script available that can do it right now, and creating these scripts won't be a piece of cake.
                            --
                            stipus

                            Comment


                              Need CLOSE script

                              I have a script from forever ago that opens a Window with a particilar program in it. It actually checks to see if the window already exisits so I don't end up with a gazillion of the same thing...

                              (This version looks for a window called "rtsp://192.168.1.128:554/ch0_0.h264 - VLC media player")

                              But I lost the CLOSE version....

                              Could you repost that please ?

                              here is the original (Many times modified) script

                              #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,"rtsp://192.168.1.128:554/ch0_0.h264 - VLC media player");
                              if( hWnd == IntPtr.Zero )
                              {
                              ProcessStartInfo processStartInfo = new ProcessStartInfo();
                              processStartInfo.FileName = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe";
                              processStartInfo.Arguments = param.ToString();
                              processStartInfo.WindowStyle = ProcessWindowStyle.Maximized;
                              Process.Start( processStartInfo );
                              }
                              else
                              {
                              SetForegroundWindow( hWnd );
                              }
                              }

                              Comment

                              Working...
                              X