Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Send http command via java or vb

    Hello every1. I am using a bluetooth remote control program on my phone. it connects to my computer and allows me to do things. i can add new features either via a .bat file or javascript or vb script.

    I already can control my xbox from my computer via its http server. So say i want to restart it i click on this link

    http://MYXBOXIPADRESS/xbmcCmds/xbmcForm?command=restart
    (which is a blank page)

    is there an easy way either via a short .bat , javascript , or vb code i can use to hit that address without ie opening or anything continuing to run. thank for you help

    \SemiShady

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,302
    Thanks
    10
    Thanked 586 Times in 567 Posts
    Quote Originally Posted by SemiShady View Post
    Hello every1. I am using a bluetooth remote


    is there an easy way either via a short .bat , javascript , or vb code i can use to hit that address without ie opening or anything continuing to run. thank for you help

    \SemiShady
    a simple html application should do you nice.

    http://msdn2.microsoft.com/en-us/library/ms536496.aspx

    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html><head> <HTA:APPLICATION
           ID="IEServer"
           APPLICATIONNAME="IEServer2"
           BORDER="thick"
           BORDERSTYLE="sunken"
           CAPTION="no"
          
           MAXIMIZEBUTTON="no"
           MINIMIZEBUTTON="no"
           SHOWINTASKBAR="no"
           SINGLEINSTANCE="no"
           SYSMENU="no"
           VERSION="1.0"
           WINDOWSTATE="minimize" />
    	   
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
    <script>
    
    
    i= new Image();
    i.src="http://myxboxipadress/xbmcCmds/xbmcForm?command=restart";
    setTimeout("window.close()", 5000)
    
    
    
    </script>
    
    </body>
    </html>
    paste the text into a blank file, save as ex server.hta
    when you double-click it, it should run in th background, ping the url, and close 5 seconds later.

    the opening and closing part i know works, let me know if you need more advanced http requests to trigger your server.
    Last edited by rnd me; 09-09-2007 at 07:48 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    you could get wget for windows and run it from a batch file or use Msxml2.XMLHTTP to do it from vbscript or javascript. (note that javascript is different from Java and VBScript is different to VB)

    Here's some example VBScript (untested as I am not on windows right now, I'm going on memory.)
    Just put it in a file called something like "restart xbox.vbs" and double click on it.
    Code:
    Set xmlhttp = CreateObject("msxml2.xmlhttp")
    
    xmlhttp.Open "GET", "http://myxboxipadress/xbmcCmds/xbmcForm?command=restart", False
    xmlhttp.Send
    
    ' Uncomment this to display what the page returned (there is also ResponseXML if you
    ' need XML instead). You could check that the status is 200 (OK) etc too or just leave
    ' this commented so that nothing appears on the computer even if it fails
    
    'MsgBox(xmlhttp.ResponseText)
    
    Set xmlhttp = Nothing
    As you can see it is only 4 lines long and pretty simple but does the job and is flexible to whatever you may need it to do in the future.
    Last edited by ghell; 09-09-2007 at 08:56 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •