Announcement

Collapse
No announcement yet.

Calling Scripts and Events with ASP

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

    Calling Scripts and Events with ASP

    I have been dilagently working on creating a complete .asp front-end for HS. I have lighting, weather, motion, and calling variables and status from HS down pat.

    I do not know however, how to launch an event in HS by using asp.

    I would like to have a graphical button (not just a standard form button) launch a HS event. If anyone could help out with the line of code needed it would be greatly appreceiated!

    As an example I have an event called moviemode. The event when triggered sets the lights and everything in motion for movie viewing.

    The Event name is:moviemode
    the graphical button I want to use in on the ASP page is movie.gif

    From there, I am lost

    Thanks in advance!
    Visit My Home Seer Site at:
    www.JohnWPB.com
    Created with LCARS

    #2
    John,
    Using an image as an input type acts as a submit button. It also sends back the X and Y position of the click event. So you could simply add an image that's name is image1 and then when the form loads check to see if the image returned an X > 0 and you know that button was selected. Try this small test page as an example. You'll need to change the image source to your image.
    <pre class="ip-ubbcode-code-pre">
    &lt;%@ Language=VBScript %&gt;
    &lt;html&gt;
    &lt;head&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;%
    'response.Write " This is button one: " & request.Form("image1.x")
    if request.Form("image1.X") &gt; 0 then
    response.Write "image1 hit"
    'This is where you would run your event like:
    'hs.TriggerEvent "turn all lights on"
    end if
    %&gt;
    &lt;form name="first" action="test.asp" method=post&gt;
    &lt;input type=image name="image1" src="mmc.gif"&gt;
    &lt;/form&gt;
    &lt;/body&gt;
    &lt;/html&gt;
    </pre>
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      Rupp, Thanks for the info! I just tried the code, and no luck. What information is supposed to be in the test.asp page refrenced in the script? Obviousally that is what does the actual execution, but not sure how.

      If this is the case, would an individual .asp page bee needed for every button? Ea: test1.asp, test2.asp, test3.asp ect depending on what button was pushed?
      Visit My Home Seer Site at:
      www.JohnWPB.com
      Created with LCARS

      Comment


        #4
        Update:

        Thanks for the help Rupp! I got it working!!! Thanks for the help! And to boot, I was able to FINALLY figgure out the same type of code to control the lights and appliaces!

        The .asp page now shows an icon for each item, and when touched, changes the state of the image to on/off accordingly without refreshing the page, and of course sends the command. I am just touching up a few things, and will post a screen cap of the interface shortly. I had a rough time getting the .asp to work correctly for quite some time. When all is said and done I will gladly share the main page for others to learn from, if anyone is interested.

        I remember posting a long time ago asking how people were creating these .asp interfaces, and asking if someone would be willing to share just one of the pages. I asked many people over the course of a few weeks, with no luck. The reply was always something like "it is too specific to my system", or some other similar reply... I really just needed to see how it was done to figgure it out for myself. So hopefully others that are having problems can benefit from the sample pages I will upload in a few days if anyone wants to see them.

        I have found Macromedia Dream Weaver essential to doing this all successfully. It lets you create the page in a normal WYSIWYG enviorment, and drop in the asp code where needed. I originally started out with a text editor, but man that can be a REAL pain when lining up images and creating nested tables!!
        Visit My Home Seer Site at:
        www.JohnWPB.com
        Created with LCARS

        Comment


          #5
          I would like to see it. I too have a heck of a time with asp
          Thanx
          Tim
          FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

          HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

          Comment


            #6
            fungun, I know what you mean! It took me forever to get this figgured out! Now that I have, it is pretty simple! I remember you were asking for help around the time I was as well. Seemed like the .asp code was like gold or something at the time

            Anyhow, I have uploaded a sample .zip file to the script library that makes it as easy as possible to get results. Take about 2 minutes to change the device codes to ones you want to control, and you will have it up and working!

            Good Luck!

            The link to the .zip is &lt;HERE&gt;
            Visit My Home Seer Site at:
            www.JohnWPB.com
            Created with LCARS

            Comment


              #7
              Excellent work John!

              This is awesome. I can now change my thermostat ASP page for the RCS X10 Thermostat plugin so that it does not have to refresh the page.

              I appreciate you sharing this
              Cheers,
              Bob
              Web site | Help Desk | Feature Requests | Message Board

              Comment


                #8
                John,

                I tried it in my own code and it worked great!

                The only thing I have to figure out now is how to stop it from adding extra lines because of wrapping each device in the FORM tags.

                It adds an extra line under each device now that I have each one surrounded by a FORM tag.
                Cheers,
                Bob
                Web site | Help Desk | Feature Requests | Message Board

                Comment


                  #9
                  Blade, I know what you mean! That one has puzzled me, and so far I havent been able to get around it. I had to design my pages with that thought in mind in the first place.

                  If it;s ok, lets move this discussion to the script library discussion thread, so if others are having the same problems, they will see the ongoing dissussion.
                  That thread is located &lt;HERE&gt;.
                  Visit My Home Seer Site at:
                  www.JohnWPB.com
                  Created with LCARS

                  Comment


                    #10
                    Blade and JohnWPB,

                    Try adding this to your form tag:

                    <pre class="ip-ubbcode-code-pre">style="margin:0"</pre>

                    Rupp's example form tag from above would look like this:

                    <pre class="ip-ubbcode-code-pre">&lt;form name="first" action="test.asp" method=post style="margin:0"&gt;</pre>

                    Does that do the trick?

                    Phil

                    Comment


                      #11
                      Thanks matrix,

                      That worked great!
                      Cheers,
                      Bob
                      Web site | Help Desk | Feature Requests | Message Board

                      Comment


                        #12
                        Blade You The Man! That did it! Thank you very much. I have a few tables that have graphics based on the sizes of the tables ect, and it was throwing the alignment off.

                        I am waiting on a few optomizations to the code from Rupp, and I will add the " style='margin:0'" to it as well and update the post in the script library.
                        Visit My Home Seer Site at:
                        www.JohnWPB.com
                        Created with LCARS

                        Comment


                          #13
                          Ok Blade it's been uploaded. Check the scripts library. I have also added dimming code to the code to have dimming control, again, with NO page refreshes!
                          Visit My Home Seer Site at:
                          www.JohnWPB.com
                          Created with LCARS

                          Comment

                          Working...
                          X