|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Fri Jul 16, 2010 3:50 pm
#URL - open in tabs or auto-close after open |
I haven't used CMUD for a couple of years now, but I've come across a use for it at work. We control an entertainment facility via AMX, which has crapped out, so until we get can get it fixed we're operating manually - a combination of web interfaces, telnet and VNC.
I fired up CMUD tonight and wrote a script and GUI that will open/close doors, run video files in our various players, and a range of other tasks. Everything is working and tomorrow I'll tell the boss to buy a CMUDPro/TeSSH license - BUT...
There is one part I am unhappy with. I'm sure it will be easily fixed, and is probably due more to my lack of html knowledge than any problem with CMUD.
#URL "http://10.1.1.66/set_521.htm?CHANNEL_NO=0&DO_STATUS_ENABLE=1&Submit=Submit"
^Calls a web interface that opens a door. I put it in a button, and clicking on the button does indeed open said door. Win.
Problem: it also opens the web browser. They're going to click the open/close door buttons I wrote approximately 400 times tomorrow. I want it to open the door without opening the web browser, or to at least close it straight away automatically, and preferably to open/close it in the background somewhere.
In case it is useful, here is the source of the page that opens up:
Code: |
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK href="io2k.css" rel=stylesheet type=text/css>
<TITLE>DO Channel Settings Result</TITLE>
</HEAD>
<BODY>
<center><h2>DO Channel Settings OK!</h2></center>
<SCRIPT language="JavaScript">opener.location.reload();</SCRIPT>
<FORM method="GET" action="">
<P align="center">
<INPUT type="button" value="Close" onClick="javascript:self.close()">
</P>
</FORM>
</BODY>
</HTML>
|
And here is the source for a little web interface that one of the other guys wrote this morning to get us through the day. I pulled the links from this one, which when clicked do not open a new browser page, but do when I run them with #url
Code: |
<html>
<head>
<title>
Act 2 Hackery Dack Door Controller
</title>
</head>
<body style="font-family:arial">
<p>Act 2 Hackery Dack Door Controller huzzah!</p>
<table>
<tr>
<td align=center> Door 1 </td align=center>
<td align=center> Door 2 </td align=center>
<td align=center> Dis.Door </td align=center>
<td align=center> Door 3 </td align=center>
</tr>
<tr>
<td align=center><a href="http://10.1.1.66/set_521.htm?CHANNEL_NO=0&DO_STATUS_ENABLE=1&Submit=Submit">Open</a></td align=center>
<td align=center><a href="http://10.1.1.67/set_521.htm?CHANNEL_NO=0&DO_STATUS_ENABLE=1&Submit=Submit">Open</a></td align=center>
<td align=center><a href="http://10.1.1.68/set_521.htm?CHANNEL_NO=0&DO_STATUS_ENABLE=1&Submit=Submit">Open</a></td align=center>
<td align=center><a href="http://10.1.1.69/set_521.htm?CHANNEL_NO=0&DO_STATUS_ENABLE=1&Submit=Submit">Open</a></td align=center>
</tr>
<tr>
<td align=center><a href="http://10.1.1.66/set_521.htm?CHANNEL_NO=0&DO_STATUS_ENABLE=0&Submit=Submit">Close</a></td align=center>
<td align=center><a href="http://10.1.1.67/set_521.htm?CHANNEL_NO=0&DO_STATUS_ENABLE=0&Submit=Submit">Close</a></td align=center>
<td align=center><a href="http://10.1.1.68/set_521.htm?CHANNEL_NO=0&DO_STATUS_ENABLE=0&Submit=Submit">Close</a></td align=center>
<td align=center><a href="http://10.1.1.69/set_521.htm?CHANNEL_NO=0&DO_STATUS_ENABLE=0&Submit=Submit">Close</a></td align=center>
</tr>
</table>
<p>Press 'z' to return to this page after each click!</p>
</body>
</html>
|
Help? |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Jul 16, 2010 4:19 pm |
I think it's far more simpler to do it this way:
1. Follow the instructions located here.
2. Change your button language to Lua.
3. Change the script in the button to read:
Code: |
if not http then http = require("socket.http") end
http.request("http://10.1.1.66/set_521.htm?CHANNEL_NO=0&DO_STATUS_ENABLE=1&Submit=Submit") |
What that does is access/pull the information from the webpage without actually opening the page.
Hope this helps for this and future projects!
Charneus |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Jul 18, 2010 1:23 pm |
When they are thinking about purchasing you should probably point them to TeSSH. It has all the scripting and telnet powers of CMud, but is designed more for bussiness applications.
If your work is concerned about the additional dll's for the Lua sockets; you can use a COM method to keep the pages quiet. The Finished Scripts forum contains a throrough script for doing it. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jul 19, 2010 4:32 pm |
I should also mention that I plan to add some URL and HTTP functions to CMUD and TeSSH within the next few months that will also make this kind of stuff really easy to do (and without the Lua libraries or COM).
|
|
|
|
|
|