Announcement

Collapse
No announcement yet.

ASPX, VB .NET, JavaScript...all play nice?

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

    ASPX, VB .NET, JavaScript...all play nice?

    So, to better integrate Google Voice with my wife's new phone, I am creating a webpage to allow her to kick off text messages. I have all the "grunt" stuff working.

    I wanted to make a text box that had a charactor counter. I found some examples online. The one I chose was from http://www.obout.com/

    Really awsome and most of their modules are free.

    Anyway, to use their stuff, they provide a LOT of Java Script examples. after modifying my web.config file, placing their .dll into the \html\bin directory everything works with their examples.

    So, now I have a button that makes a call to a Java Script function, which calls "alert". I get the popup message on BOTH my phone and any other web browser I have used.

    I want to change that alert to call a Homeseer script. I have done this when running VB script in .asp pages.

    As I see it, I have 2 issues:
    1) I can't seem to figure out how to call any homeseer objects using Java Script

    2) I tried to setup the Java Script to call a VB script...this does not seem to do anything, but also does not throw any errors. This script was supposed to just call hs.writelog.

    I am not sure if the aspx page is goofing me up, or what. I wanted to go with ASPX so the page loads faster for us, as well as being .NET.

    If it would help, I can post the webpage...it's a bit lengthy so I'd prefer not to...but if we end up needing it, I will post it.

    Any help or ideas is appreciated. Thanks!

    --Dan
    Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

    #2
    Originally posted by drozwood90 View Post
    I want to change that alert to call a Homeseer script. I have done this when running VB script in .asp pages.

    As I see it, I have 2 issues:
    1) I can't seem to figure out how to call any homeseer objects using Java Script
    I know how to do it in VBScript, but not JavaScript, but the principles should be the same. If you can do a FORM POST from JS using the HTTP server object, then everything you need is there. Here's a VBScript example to run a HS event:

    PHP Code:
    Set objHTTP CreateObject("Microsoft.XMLHTTP"
    objHTTP.open "POST""http://localhost:8000"False  
    objHTTP
    .setRequestHeader "Content-Type""application/x-www-form-urlencoded" 
    objHTTP.send "run_event=My+Event" 
    I know JS can talk HTTP since that's the underlying AJAX technology. It's just a matter of instantiating the HTTP object, then packaging the FORM fields up.

    I might try and play with some JS later today too...
    HS4Pro on a Raspberry Pi4
    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

    HSTouch Clients: 1 Android

    Comment


      #3
      Originally posted by drozwood90 View Post
      I wanted to make a text box that had a charactor counter. I found some examples online. The one I chose was from http://www.obout.com/

      Really awsome and most of their modules are free.

      --Dan
      I had also read somewhere else that they have a lot of free components. I am interested in their treeview but I don't see anything that is free. It seems like everything is at least $99. How do you get a free version?
      James

      Running HS 3 on Win10 .

      Comment


        #4
        You just download the software.

        http://www.obout.com/t2/index.aspx

        There really are not that many of the components that are NOT free. If you get the suite, it'll have both the free stuff and NON-free stuff.

        What I did, after I checked out the suite, was navigate DIRECTLY to what I wanted...for instance:
        http://www.obout.com/show/

        That STATES it is free. Just download and go. If what you want is not free...it'll be a bit harder to get anything but the demo (for instance the image manipulation stuff costs $).

        --Dan
        Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

        Comment


          #5
          Almost done rebuilding my server.

          Man...LOTS of files...

          Then I hope to get back to this. I hate being SO close, but without a working solution.

          --Dan
          Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

          Comment


            #6
            Originally posted by rmasonjr View Post
            I know how to do it in VBScript, but not JavaScript, but the principles should be the same. If you can do a FORM POST from JS using the HTTP server object, then everything you need is there. Here's a VBScript example to run a HS event:

            PHP Code:
            Set objHTTP CreateObject("Microsoft.XMLHTTP"
            objHTTP.open "POST""http://localhost:8000"False  
            objHTTP
            .setRequestHeader "Content-Type""application/x-www-form-urlencoded" 
            objHTTP.send "run_event=My+Event" 
            I know JS can talk HTTP since that's the underlying AJAX technology. It's just a matter of instantiating the HTTP object, then packaging the FORM fields up.

            I might try and play with some JS later today too...

            Rmason,

            how would you pass in a variable? That's why I wanted to execute a script...I see how you can run an event...

            I suppose, if there is a post for running a script, this will work, otherwise I need to try to figure out how to get a Java object of the HS server object...so I can use a runex command...

            Thoughts?

            Rupp, is there any examples of getting the hs object and using it in Java?

            Thanks!

            --Dan
            Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

            Comment


              #7
              I don't think I saw the original post until now. I may be wrong, but I thought that normally JavaScript runs on the client. I.e., if you have a web page running on the phone that connects to the HS web server, whatever you run in JavaScript is actually running on the client browser, not on HS. As a result, you can't invoke an HS object, or at least not very easily.

              Steve

              Comment


                #8
                Originally posted by drozwood90 View Post
                Rmason,

                how would you pass in a variable? That's why I wanted to execute a script...I see how you can run an event...

                I suppose, if there is a post for running a script, this will work, otherwise I need to try to figure out how to get a Java object of the HS server object...so I can use a runex command...

                Thoughts?

                Rupp, is there any examples of getting the hs object and using it in Java?

                Thanks!

                --Dan

                If it were me and I needed to pass a variable, I would write a simple asp page on the HS server and pass the variables as name/value pairs on the URL. So, your client call would do something like:

                http://myhomeseer/rcvr.asp?variable1...=somethingelse

                Then, rcvr.asp, which lives on the HS server, would look something like:


                PHP Code:
                <%@ Language=VBScript %>
                <%
                  
                hs.writeLog("rcvr.asp","variable1=" Request.QueryString("variable1"))
                hs.writeLog("rcvr.asp","variable2=" Request.QueryString("variable2"))

                %> 
                That would be the quickest way to have a client pass some variable into HS. Once in rcvr.asp, you are running inside HS and have access to all of the HS scripting functions.
                HS4Pro on a Raspberry Pi4
                54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
                Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

                HSTouch Clients: 1 Android

                Comment


                  #9
                  Originally posted by stevea View Post
                  I don't think I saw the original post until now. I may be wrong, but I thought that normally JavaScript runs on the client. I.e., if you have a web page running on the phone that connects to the HS web server, whatever you run in JavaScript is actually running on the client browser, not on HS. As a result, you can't invoke an HS object, or at least not very easily.

                  Steve
                  Correct - JavaScript != Java
                  If you are set on using JavaScript, then you would need to use the HTTP request object. You wouldnt be grabbing a reference to the HS object at all. I think it might be possible, but like you said, it would be difficult at best.
                  HS4Pro on a Raspberry Pi4
                  54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
                  Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

                  HSTouch Clients: 1 Android

                  Comment


                    #10
                    Thank you both!

                    Now that I understand java script is CLIENT only, I'm using an asp page (as the example was given) to pass values INTO HS. Looks like that was the missing link!!

                    Thanks again!!

                    --Dan
                    Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

                    Comment

                    Working...
                    X