找回密码
 加入
搜索
查看: 5748|回复: 12

[网络通信] [测试][无源码]au3中提供网页的交互方式,是否可取?

  [复制链接]
发表于 2010-11-7 18:54:30 | 显示全部楼层 |阅读模式
本帖最后由 republican 于 2011-1-20 09:56 编辑

发此区是因为不想浪费大家的金钱,请斑竹暂时不要删。若大家觉得不合适的话我自行删除。

程序是自己写的一个工具,主要功能只适合内网,所以就不提供源码了。

前几天搜TCP的时候,看到有HTTP Server的例子,遂整合至自己的程序中,不知道大家认为这种方式是否可取?

使用方法:
[1] 下载并运行附件:
[2] 在IE中输入自己电脑的IP地址(@ipadress1)
[3] 使用user, pass登录。
[4] 在【程序设置】的更改会实时响应。



参考资料: http://www.autoitscript.com/foru ... ge__hl__tcp+timeout

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2010-11-7 19:35:27 | 显示全部楼层
楼主怎么做的,很不错,英文网页看不懂。。
发表于 2010-11-7 19:41:13 | 显示全部楼层
很好,是对路由操作吧。很好啊,可以多做几个品牌的,哈哈。
发表于 2010-11-7 19:45:26 | 显示全部楼层
好像我理解错了, 不好意思。感觉很不错啊
发表于 2010-11-7 19:57:37 | 显示全部楼层
希望开源。
 楼主| 发表于 2010-11-7 20:09:22 | 显示全部楼层
回复 2# itljl

其实就是根据英文原帖的Session_Server文件改成的,只不过网页代码都是内置生成。
 楼主| 发表于 2010-11-7 20:13:17 | 显示全部楼层
本帖最后由 republican 于 2010-11-7 20:15 编辑

回复 5# pusofalse

P大想要开源哪些内容?

整个程序有95%的代码与本主题无关,主文件代码也达到了6000行,编译需要用的文件超过25个,所以不太现实。

如果单单要本贴功能,可以直接使用参考链接的代码,其实代码没什么就改,基本原封不动的copy来,只是把网页的指向改为程序生成。

附网页生成需要用到的过程(当然不能直接运行!):

Func _GetPage($Name,$Extr = "")
        Local $PageContext
        Switch $Name
                Case $RT_err_auth
                        $PageContext = $Rt_MainPage[1] & $Rt_MainPage[8] & $Rt_MainPage[2] & $Rt_MainPage[3]
                Case "index.html"
                        $PageContext = $Rt_MainPage[1] & $Rt_MainPage[5] & $Rt_MainPage[2] & _Rt_GetNow_User() &'</p>' & $Rt_MainPage[3]
                Case "User.html"
                        Local $MoreText = ""
                        If IsArray($Extr) Then $MoreText ='已用流量: '&Round(Int($Extr[0]/(1024*1024)),1) & " MB"&' / 日总流量: '&Round(Int($Extr[1]/(1024*1024)),1) & " MB"
                        _WriteCMD($MoreText)
                        _INIPageVar()
                        $PageContext = $Rt_MainPage[1] & $Rt_MainPage[7] & $Rt_MainPage[2] & _Rt_GetNow_User() &'</p>'& $MoreText & $Rt_MainPage[3]
                Case "Program.html"
                        _INIPageVar()
                        $PageContext = $Rt_MainPage[1] & $Rt_MainPage[6] & $Rt_MainPage[2] & _Rt_GetNow_User() &'</p>'& $Rt_MainPage[3]
                Case $RT_err_404,$RT_err_dirlist
                        $PageContext = $Rt_MainPage[1] & $Rt_MainPage[9] & $Rt_MainPage[2] & $Rt_MainPage[3]
        EndSwitch
        Return $PageContext
EndFunc

Func _Rt_GetNow_User()
        Switch $GlobalTemp[11]
                Case 0
                        Return '<p>当前未有登录用户</p>' 
                Case 1
                        Return '<p>当前登录用户: '&$GlobalTemp[17] 
        EndSwitch
EndFunc

Func _RT_ValueToString($Index)
        If $GlobalINI[$Index][1] = 1 Then Return 'checked'
EndFunc

Func _INIPageVar()

        $Rt_MainPage[1]='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">' & _ 
        '<html>' & _
        '<head>' & _
        '<meta http-equiv="Content-Type" content="text/html; charset=GB2312">' & _
        '<!-- TemplateBeginEditable name="doctitle" -->' & _
        '<title>STU FUSION 远程管理</title>' & _
        '<!-- TemplateEndEditable -->' & _
        '<!-- TemplateBeginEditable name="head" -->' & _
        '<!-- TemplateEndEditable -->' & _
        '<style type="text/css">' & _
        '<!--' & _
        'body {' & _
        '        font: 100% 宋体, 新宋体;' & _
        '        background: #666666;' & _
        '        margin: 0;' & _
        '        padding: 0;' & _
        '        text-align: center;' & _
        '        color: #000000;' & _
        '}' & _
        '' & _
        '.oneColElsCtrHdr #container {' & _
        '        width: 46em;' & _
        '        background: #FFFFFF;' & _
        '        margin: 0 auto;' & _
        '        border: 1px solid #000000;' & _
        '        text-align: left; ' & _
        '}' & _
        '.oneColElsCtrHdr #header { ' & _
        '        background: #DDDDDD; ' & _
        '        padding: 0 10px 0 20px;' & _
        '} ' & _
        '.oneColElsCtrHdr #header h1 {' & _
        '        margin: 0;' & _
        '        padding: 10px 0;' & _
        '}' & _
        '.oneColElsCtrHdr #mainContent {' & _
        '        padding: 0 20px; ' & _
        '        background: #FFFFFF;' & _
        '}' & _
        '.oneColElsCtrHdr #footer { ' & _
        '        padding: 0 10px; ' & _
        '        background:#DDDDDD;' & _
        '} ' & _
        '.oneColElsCtrHdr #footer p {' & _
        '        margin: 0; ' & _
        '        padding: 10px 0; ' & _
        '}' & _
        '.oneColElsCtrHdr #container #mainContent form table tr th {' & _
        '        color: #426EB4;' & _
        '        font-family: "宋体";' & _
        '        font-size: 16px;' & _
        '}' & _
        '.sf {' & _
        '        font-family: "宋体";' & _
        '        font-size: 16px;' & _
        '        font-style: normal;' & _
        '        line-height: normal;' & _
        '}' & _
        '.oneColElsCtrHdr #container #mainContent form table tr .sf .sf {' & _
        '        font-size: 14px;' & _
        '        color: #000;' & _
        '}' & _
        '.Main {' & _
        '        font-family: "宋体";' & _
        '        font-size: 36px;' & _
        '        font-style: normal;' & _
        '        color: #03F;' & _
        '        font-weight: bold;' & _
        '        text-align: center;' & _
        '}' & _
        '-->' & _
        '</style></head>' & _
        '' & _
        '' & _
        '<body class="oneColElsCtrHdr">' & _
        '' & _
        '<div id="container">' & _
        '  <div id="header">' & _
        '<h1>STU FUSION 远程管理</h1>' & _
        '<!-- end #header --></div>'

        $Rt_MainPage[4]='  <div id="mainContent">' & _
        '        <h1> </h1>' & _
        '  <!-- end #mainContent --></div>'

        $Rt_MainPage[9] = '<div id="mainContent">' & _
                '<h1>404 错误</h1>' & _
                '<p>请求的页面不存在</p>' & _
  '</div>'


        $Rt_MainPage[2]='  <div id="footer">'
;~         '<p>当前登录用户: 08ymsu</p>' & _
        $Rt_MainPage[3] = '<p>Copyright© Republican     <a href="/">返回首页</a> </p>' & _
        '  <!-- end #footer --></div>' & _
        '<!-- end #container --></div>' & _
        '' & _
        '</html>'




        $Rt_MainPage[5]='  <div id="mainContent">' & _ 
        '    <table width="683" height="80" border="0">' & _
        '      <tr>' & _
        '        <th width="336" height="43" class="Main" scope="row"><a href="User.html">用户设置</a></th>' & _
        '        <td width="337" class="Main"><a href="Program.html">程序设置</a></td>' & _
        '      </tr>' & _
        '    </table>' & _
        '    <!-- end #mainContent -->' & _
        '  </div>'


        $Rt_MainPage[6]='  <div id="mainContent">' & _ 
        '<form name="form1" method="post" action="">' & _
        '  <table width="601" border="0">' & _
        '    <tr>' & _
        '      <th width="178" class="sf" scope="row"><span class="set">[1]始终在线模式</span></th>' & _
        '      <td width="53" align="center"><label>' & _
        '        <input name="Ck1" type="checkbox" id="Ck1" '&_RT_ValueToString(2)&'>' & _
        '      </label></td>' & _
        '      <td width="163" align="right" class="set">在线命令发送间隔</td>' & _
        '      <td width="179" align="left"><label>' & _
        '        <input name="tx1" type="text" id="tx1" value="'&$GlobalINI[13][1]&'">' & _
        '      </label></td>' & _
        '    </tr>' & _
        '    <tr>' & _
        '      <th scope="row"><span class="set">[2]自动注销</span></th>' & _
        '      <td align="center"><label>' & _
        '        <input name="ck2" type="checkbox" id="ck2" '&_RT_ValueToString(1)&'>' & _
        '      </label></td>' & _
        '      <td align="right" class="set">注销流量</td>' & _
        '      <td align="left"><label>' & _
        '        <input name="tx2" type="text" id="tx2" value="'&$GlobalINI[6][1]&'">' & _
        '      </label></td>' & _
        '    </tr>' & _
        '    <tr>' & _
        '      <th height="28" class="set" scope="row"><span class="set">[3]连接外网</span></th>' & _
        '      <td align="center"><label>' & _
        '        <input name="ck3" type="checkbox" id="ck3" '&_RT_ValueToString(25)&'>' & _
        '      </label></td>' & _
        '      <td align="right" class="set">网络超时</td>' & _
        '      <td align="left"><label>' & _
        '        <input name="tx3" type="text" id="tx3" value="'&$GlobalINI[11][1]&'">' & _
        '      </label></td>' & _
        '    </tr>' & _
        '    <tr>' & _
        '      <th class="set" scope="row"><span class="set">[4]定时关机</span></th>' & _
        '      <td align="center"><label>' & _
        '        <input name="ck4" type="checkbox" id="ck4" '&_RT_ValueToString(22)&'>' & _
        '      </label></td>' & _
        '      <td align="right" class="set">关机时间</td>' & _
        '      <td align="left"><label>' & _
        '        <input name="tx4" type="text" id="tx4" value="'&$GlobalINI[23][1]&'">' & _
        '      </label></td>' & _
        '    </tr>' & _
        '    <tr>' & _
        '      <th colspan="2" align="right" scope="row"><label>' & _
        '        <input type="submit" name="sub" id="sub" value="提交"> ' & _
        '      </label></th>' & _
        '      <td colspan="2" align="right"><label>' & _
        '        <input type="reset" name="rs" id="rs" value="重置">' & _
        '      </label></td>' & _
        '      </tr>' & _
        '  </table>' & _
        '' & _
        '</form>' & _
        '  </div>'
        
        
        
        $Rt_MainPage[7]='  <div id="mainContent">' & _ 
        '<form name="form1" method="post" action="">' & _
        '  <table width="690" height="124" border="0">' & _
        '    <tr>' & _
        '      <th width="160" class="oneColElsCtrHdr" scope="row">用户名:</th>' & _
        '      <td width="168" align="left"><label>' & _
        '        <select name="Dft0" size="1" id="Dft0">' & _Rt_UserName_String() & _
        '        </select>' & _
        '      </label></td>' & _
        '      <td width="348"><label>' & _
        '        <input type="submit" name="Del" id="Del" value="删除">' & _
        '      </label></td>' & _
        '    </tr>' & _
        '    <tr>' & _
        '      <th scope="row">密码:</th>' & _
        '      <td align="left"><label>' & _
        '        <input type="password" name="Dft1" id="Dft1" value="'&$UserValue[0][7]&'">' & _
        '      </label></td>' & _
        '      <td><a href="http://netms.stu.edu.cn/ModifyPassword.aspx">更改密码</a></td>' & _
        '    </tr>' & _
        '    <tr>' & _
        '      <th align="center" scope="row"><label>' & _
        '        <input type="submit" name="Login" id="Login" value="登录">' & _
        '      </label></th>' & _
        '      <td align="center"><label>' & _
        '        <input type="submit" name="Check" id="Check" value="查询">' & _
        '      </label></td>' & _
        '      <td align="center"><label>' & _
        '        <input type="submit" name="LogOff" id="LogOff" value="注销">' & _
        '      </label></td>' & _
        '    </tr>' & _
        '  </table>' & _
        '</form>' & _
        '  </div>'
        
        
        $Rt_MainPage[8]='<div id="mainContent">' & _ 
        '<form id="form1" name="form1" method="post" action="">' & _
        '  <table width="400" border="1" align="center">' & _
        '    <tr>' & _
        '      <td width="107">用户名:</td>' & _
        '      <td width="277"><label>' & _
        '        <input type="text" name="user" id="user">' & _
        '      </label></td>' & _
        '    </tr>' & _
        '    <tr>' & _
        '      <td>密码:</td>' & _
        '      <td><label>' & _
        '        <input type="password" name="pass" id="pass">' & _
        '      </label></td>' & _
        '    </tr>' & _
        '    <tr>' & _
        '      <td> </td>' & _
        '      <td><label>' & _
        '        <input type="submit" name="bt1" id="bt1" value="登录">' & _
        '        <input type="reset" name="reset" id="reset" value="重置">' & _
        '      </label></td>' & _
        '    </tr>' & _
        '  </table>' & _
        '</form>' & _
        '<h1> </h1>' & _
        '        <!-- end #mainContent --></div>' & _
        '  <div id="footer">'
EndFunc

Func _Rt_UserName_String()
        Local $Context = ""
        For $i = 1 To $UserValue[0][0]
                $Context &='          <option>'&$UserValue[$i][0]&'</option>'
        Next
        Return $Context
EndFunc
 楼主| 发表于 2010-11-7 20:22:05 | 显示全部楼层
回复 4# chenronting

这个是直接连接到程序的哦~~推荐你下官网的文件运行,这样会有更深刻的理解。
发表于 2010-11-7 22:37:58 | 显示全部楼层
不知道这个有什么作用的了
发表于 2010-11-7 22:51:14 | 显示全部楼层
6000行代码,真是辛苦~
 楼主| 发表于 2010-11-7 23:23:55 | 显示全部楼层
本帖最后由 republican 于 2010-11-7 23:52 编辑

回复 10# afan

从7月份我发帖问loadimage的问题开始,我就开始写这个东东了。

为了写这个东东,我才给出了Winhttp_GetResopnd的UDF.
同时诞生的有Winhttp_PostFile.
程序代码从一开始就做了向后兼容,变量的自动递延,你上面看到的“开启/关闭”啊,input中的值都是可以使用GlobalMapID的变量直接进行操作。
为了写这个程序,我终于把POP3的解码和绕开BUG的功能完成了。
为了写这个程序,我终于明白了进程间的通信要怎样设计。
还有许许多多遇到的问题都一一解决了.
可以说,这是我对AU3全部的理解所写成的一个程序,6000行的代码并不算多。
其实我发此帖的目的是想让大家了解到新的交互界面的设计方法。我认为我们的想象力都被束缚了,我认为我们的界面设计应该以网页样式为基础,这样才有良好的可移植性。

评分

参与人数 1金钱 +30 收起 理由
newuser + 30 非常棒,请多指教!

查看全部评分

发表于 2010-11-11 08:43:51 | 显示全部楼层
本帖最后由 newuser 于 2010-11-11 08:46 编辑

回复 1# republican
我是内网用户,按照步骤使用,无法使用该工具啊?

启动工具软件后,在IE输入本机IP地址,显示登陆界面很慢啊!
而且他的初始:用户名和密码是什么吗?随便书写吗?我随便写了一个,可不能登陆!
 楼主| 发表于 2010-11-11 10:25:12 | 显示全部楼层
本帖最后由 republican 于 2010-11-11 10:28 编辑

用户名: user
密码: pass

可能我没说清楚,整个工具只适合汕大的内网使用,部分功能(如本贴的网页交互方式)才有通用性。


如果显示界面的过程很慢,请检查是否使用了代理或者DAC脚本,若有,去掉。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-7 23:33 , Processed in 0.083670 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表