Announcement

Collapse
No announcement yet.

MsgBox() on our web page

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

    MsgBox() on our web page

    Using MsgBox() in a script provides the popup on the Homeseer computer. How do we get the message or input from the user triggering an event from the hs web page? Thanks for any help. Eric

    #2
    Not sure I'm following your question. Are you wondering how to allow a user to key in a value on a web page to trigger an event?

    -Rupp
    Why don't they just make mouse-flavored cat food?
    -Rupp
    sigpic

    Comment


      #3
      Rupp,

      Using msgbox or inputbox in a script triggered by an event from the hs web page does not display the box on the computer that triggered the event. The box only shows up on the hs computer.

      My son is working on a script where he'd like the user to be able to input or select open or close within the script. I'm no help.

      Eric

      Comment


        #4
        The only way a user is going to be able to enter information would be to prompt the user via a script in a web page or an app that is running on the users machine. Then this information could be sent to HS for processing. Is this what he is desiring to do?

        -Rupp
        Why don't they just make mouse-flavored cat food?
        -Rupp
        sigpic

        Comment


          #5
          You need to use client-side scripting as opposed to server-side. Typically, VBScript and JavaScript are languages available. Since many HS users are familar with VBScript, I will use it as an example:

          <pre class="ip-ubbcode-code-pre">
          &lt;html&gt;
          &lt;head&gt;
          &lt;title&gt;Get and Show Info Example&lt;/title&gt;
          &lt;/head&gt;

          &lt;body&gt;

          &lt;script language="VBScript"&gt;
          Dim info

          Function GetInfo()
          info = InputBox("Enter info: ")
          End Function

          Sub ShowInfo()
          MsgBox "Info is: " & info
          End Sub

          &lt;/script&gt;

          &lt;form name="form1"&gt;
          &lt;input type="button" value="Get Info" OnClick="GetInfo"&gt;
          &lt;input type="button" value="Show Info" OnClick="ShowInfo"&gt;
          &lt;/form&gt;

          &lt;/body&gt;

          &lt;/html&gt;
          </pre>

          Jim Doolittle
          Jim Doolittle

          My Twitter
          My Hardware & Software

          Comment


            #6
            or if you want it to timeout (automatically go away) after a preset time of display, then use DHTML or Windows Scripting Host (WSH) method wscript.popup
            MsgBox requires an answer, these methods have ways of providing a default answer and just dissapearing.

            --
            Aaron

            Comment


              #7
              If I want to allow the user to enter a house/unit code and then a value, and then send these to HS - how would you send them to HS?

              I can change the html for the entry of the two variables, but don't know how to pass to HS.

              Comment


                #8
                The easiest way would be to use an asp page. Like the one here:
                <pre class="ip-ubbcode-code-pre">
                &lt;%@ Language=VBScript %&gt;
                &lt;HTML&gt;
                &lt;HEAD&gt;
                &lt;/HEAD&gt;
                &lt;BODY&gt;
                &lt;%
                value = Request.Form("value")
                if value &lt;&gt; "" then
                hs.SetDeviceValue "E3",value
                end if
                %&gt;
                &lt;form name="frmFirst" method="post" action="SetDevice.asp"&gt;
                &lt;input type="text" size="12" name="value"&gt;
                &lt;input type="submit"&gt;
                &lt;form&gt;
                &lt;br&gt;
                &lt;%Response.Write "Device Value of E3 = " & hs.DeviceValue ("E3")%&gt;
                &lt;/BODY&gt;
                &lt;/HTML&gt;


                </pre>

                Simply change the hs.DeviceVaule to any other HS call.

                -Rupp
                Why don't they just make mouse-flavored cat food?
                -Rupp
                sigpic

                Comment


                  #9
                  Rupp, thanks for the code....I ran it and received the following error.

                  "Script error: The operation could not be completed because the script engine has not been initialized to a valid language.Response.Send "Device Value of E3 = " & hs.DeviceValue ("E3")"

                  Also, when I enter a value and "click" on the submit, I get a "page not found" referencing "SetDevice.asp". Do I need another asp page?

                  Comment


                    #10
                    This will only run if its in the HS/html directory. The page also needs to be named SetDevice.asp. Then call it in IE using http://LOCALHOST:88/SetDevice.asp

                    the 88 is the port that HS is running on. It also needs a valid device. Let me know if this helps.

                    -Rupp
                    Why don't they just make mouse-flavored cat food?
                    -Rupp
                    sigpic

                    Comment


                      #11
                      I renamed it to SetDevice.asp and when I run it I get the box and can enter, however when the asp page first loads, I get the message "Script error: The operation could not be completed because the script engine has not been initialized to a valid language.Response.Send "Device Value of E3 = " & hs.DeviceValue ("E3")"

                      I setup a device E3 for testing and the value doesn't change.

                      Ideas?

                      Comment


                        #12
                        Remove the first line of the file
                        &lt;%@ Language=VBScript %&gt;

                        and see if it will work.

                        -Rupp
                        Why don't they just make mouse-flavored cat food?
                        -Rupp
                        sigpic

                        Comment


                          #13
                          Did you ever get this working?

                          -Rupp

                          -Rupp
                          sigpic

                          Comment


                            #14
                            I had a chance to briefly try this last night. The script ran better - without the error, but it didn't change the value of the device. I may not have that portion of the code correctly changed. I will have to spend some more time on it to fully test.

                            What I ultimately want to do, is offer a way to first enter a housecode/unit code, and then enter the value I want to change it to. For example, "E3", "1" (or "ON").

                            Thanks - I'll post when I have a chance to do some more work on it.

                            Comment


                              #15
                              Changing the device value will not change the device to on or off or dim it. It just sets the value. If you actually want to turn it on the you need to use hs.execx10 instead of hs.setDeviceValue.

                              -Rupp

                              -Rupp
                              sigpic

                              Comment

                              Working...
                              X