Announcement

Collapse
No announcement yet.

MsgBox() on our web page

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

  • JeffCharger
    replied
    thanks Greg, that did it for me. Now I understand it - now that I see the code.

    I have a good html book and have crawled my way through it - guess I have to do the same with asp.!

    Leave a comment:


  • Rupp
    replied
    <pre class="ip-ubbcode-code-pre">
    &lt;%@ Language=VBScript %&gt;
    &lt;HTML&gt;
    &lt;HEAD&gt;
    &lt;/HEAD&gt;
    &lt;BODY&gt;
    &lt;%
    strValue = Request.Form("Value")
    strHouseCode = Request.Form("HouseCode")
    strUnitCode = Request.Form("UnitCode")

    if strValue &lt;&gt; "" and strHouseCode &lt;&gt; "" and strUnitCode &lt;&gt;"" then
    hs.SetDeviceValue strHouseCode&strUnitCode,strValue
    Response.Write "Device Value of " & strHouseCode&strUnitCode & " = " & hs.DeviceValue (strHouseCode&strUnitCode)
    else
    Response.Write "Need valid input" & "&lt;br&gt;"
    end if
    %&gt;
    &lt;form name="frmFirst" method="post" action="SetDevice.asp"&gt;
    HouseCode:&lt;input type="text" size="12" name="HouseCode"&gt;&lt;br&gt;
    UnitCode: &lt;input type="text" size="12" name="UnitCode"&gt;&lt;br&gt;
    Value: &lt;input type="text" size="12" name="Value"&gt;&lt;br&gt;
    &lt;input type="submit"&gt;
    &lt;form&gt;
    &lt;br&gt;

    &lt;/BODY&gt;
    &lt;/HTML&gt;

    </pre>

    -Rupp



    {{{{{{{{{{ Remember the reason for the season }}}}}}}}}}

    Leave a comment:


  • JeffCharger
    replied
    I realize that I don't yet know asp at all...so I would appreciate some help.

    Rupp, I tried to get your asp code going and it works great - enabling me to change the status of a device.

    How can I get it to take 2 inputs? I want to enter both the House/Unit code and the new value?

    I have tried to monkey around with the code but can't get it.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Jeff,

    Here is what I am doing currently, although it will need to be modified for your purpose, I think it does what you want.

    I have a form on my website that allows the entry of this data. I then pass the data via a URL get to the HS server with the proper URL parameters. In my case I am speaking the values, but you should be able to change the hs.speak to hs.whatever command you want with the values.

    ' This script will take a URL parameter called "speak" and "visitor"
    ' the text over the house speakers. It can be called from anywhere.
    ' URL format: http://#homeip#:8000/speak.asp?speak=#value to speak#&visitor=#visitor name#
    ' Written 9/22/03 by Jay


    &lt;%@ Language=VBScript %&gt;


    &lt;%

    if hs.isonbyname ("House Remote Speakers") then 'Virtual Setting so I can disable remote speakers
    if hs.isoffbyname ("Living Room Speakers") then 'Dont do it if Virtual setting is not enabled
    hs.Writelog "Remote Speakers", "Turning on Remote Speakers" 'Log it
    hs.execx10byname "Living Room Speakers","on",0 'Turn on Remote Speakers
    end if
    end if
    hs.waitsecs 2 'Wait secs before speaking to give time for speakers to turn on
    ' hs.speak "f:\winnt\media\notify.wav", true 'Play sound before speaking to make it pretty
    hs.speak " website visitor ", TRUE
    hs.speak Request.QueryString("visitor"), TRUE 'speak the visitor field value
    hs.speak " has entered the following message on our website.", TRUE
    hs.speak Request.QueryString("speak"), TRUE 'Speak the needed text that was passed in the speak field
    hs.Writelog "Remote Speakers","Turning off Remote Speakers"
    hs.execx10byname "Living Room Speakers","off",0 'Turn off the speakers

    %&gt;

    Jay Fro

    (Current Setup in Profile)

    Leave a comment:


  • JeffCharger
    replied
    I know - I fooled around with the statements. I know I'll be able to get it working - just needs some time

    Leave a comment:


  • Rupp
    replied
    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

    Leave a comment:


  • JeffCharger
    replied
    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.

    Leave a comment:


  • Rupp
    replied
    Did you ever get this working?

    -Rupp

    Leave a comment:


  • Rupp
    replied
    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?

    Leave a comment:


  • JeffCharger
    replied
    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?

    Leave a comment:


  • Rupp
    replied
    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?

    Leave a comment:


  • JeffCharger
    replied
    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?

    Leave a comment:


  • Rupp
    replied
    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?

    Leave a comment:


  • JeffCharger
    replied
    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.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    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

    Leave a comment:

Working...
X