内网考勤,自动软件制作的问题,请高手赐教。
网页代码如下,这个网页很奇怪,是打开一个网页,然后弹出一个小窗口,在小窗口上登陆,研究了很久也没有实现。而且登陆按钮,不是用button制作的,搞不懂,请高手赐教<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /><title>
网络办公自动化系统-登 陆
</title><link href="CSS/css.css" rel="stylesheet" type="text/css" /><link rel="stylesheet" type="text/css" href="css/style.css" /><link rel="stylesheet" type="text/css" href="Ext/resources/css/ext-all.css" />
<script type="text/javascript">
var bk="DSC07219.JPG";
function load()
{
if(bk=="") bk="default.png";
document.getElementById("bkpic").src="BK/"+bk;
}
function resizepic(pic)
{
var rpicht = ht-10;
var tpicwd = pic.width;
var tpicht = pic.height;
var multi = tpicht/rpicht;
pic.height = rpicht;
pic.width = tpicwd/multi;
}
</script>
</head>
<body onload="load()" >
<script src="Ext/adapter/ext/ext-base.js" type="text/javascript"></script>
<script src="Ext/ext-all.js" type="text/javascript"></script>
<script src="JS/globel.js" type="text/javascript"></script>
<script type="text/javascript">
Ext.onReady(function()
{
Ext.QuickTips.init();
Ext.BLANK_IMAGE_URL = 'ext/resources/images/default/s.gif';
var cp= new Ext.state.CookieProvider();
var uid = cp.get('userid');
var udpt = cp.get('userdept');
var UserDeptFields = Ext.data.Record.create([
{name: 'id',mapping:'id'},{name: 'userdept',mapping:'dept'}
]);
varUserDeptStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url:'DATA/UserInfo/GetDepart.aspx'
}),
reader: new Ext.data.JsonReader({
root: 'data',
id: 'id'
},
UserDeptFields
)
});
UserDeptStore.load();
var UserFields = Ext.data.Record.create([
{name: 'id',mapping:'id'},{name: 'userid',mapping:'userid'} ,{name: 'userName',mapping:'userName'}
]);
var UserStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url:'DATA/UserInfo/GetUser.aspx?id=',
method:'post'
}),
reader: new Ext.data.JsonReader({
root: 'data',
id: 'id'
},
UserFields
),
autoLoad:true,
listeners : {
load : function() {
yh.setValue(uid);
}
}
});
UserStore.load();
var bm = new Ext.form.ComboBox({
id:'DeptName',
name:'DeptName',
fieldLabel:'部 门',
store :UserDeptStore,
valueField : 'userdept',
displayField : 'userdept',
typeAhead : true,
mode : 'local',
width: 190,
triggerAction : 'all',
emptyText: '',
listeners:{
select : function(combo, record, index){
UserStore.proxy= new Ext.data.HttpProxy({url: 'DATA/UserInfo/GetUser.aspx?id=' + escape(combo.value)});
UserStore.load();
}
}
});
var yh = new Ext.form.ComboBox({
id:'TxtName',
name:'TxtName',
store :UserStore,
hiddenName:'userid',
fieldLabel:'用 户',
valueField : 'userid',
displayField : 'userName',
typeAhead : true,
mode : 'local',
width: 190,
triggerAction : 'all',
emptyText: ''
});
bm.setValue(udpt);
if(udpt!=""&&udpt!=null)
{
UserStore.proxy= new Ext.data.HttpProxy({url: 'DATA/UserInfo/GetUser.aspx?id=' + escape(udpt)});
UserStore.load();
yh.setValue(uid);
}
var loginForm=new Ext.FormPanel
({
bodyStyle:"padding:2px 0 0 15px",
border:false,
width:380,
labelWidth:70,
plain:true,
layout:"form",
baseCls:"x-plain",
items:[
{
boder:false,
bodyStyle:"margin:0px 0px 7px 0px",
html:'<img src="images/logo.png" height=47 width=344><br>'
},
{
boder:false,
bodyStyle:"margin:5px 0px 8px 0px",
plain:true
},
bm,
yh,
{
xtype: 'textfield',
inputType:'password',
fieldLabel:'密 码',
id:'TxtPwd',
name:'TxtPwd',
width:190,
allowBlank:false,
blankText:'密码不能为空'
}
/*
{
xtype: 'textfield',
fieldLabel:' 验证码 ',
id:'TxtCode',
name:'TxtCode',
width:80,
allowBlank:false,
blankText:'验证码不能为空'
},{
id:'CodeImge',
bodyStyle:"padding:0px 0px 0 70px",
boder:false,
html:''
}
*/
]
});
var loginWin=new Ext.Window({
title:"用户登录",
width:435,
height:235,
layout:"form",
iconCls:"usericon",
//不可以随意改变大小
resizable:true,
collapsible:false,
closeAction : 'close',
closable:true,
//modal: 'true',
buttonAlign:"center",
bodyStyle:"padding:5px 0 0 15px",
items:,
listeners:{
"show":function()
{
loginForm.getForm().reset();
},
specialkey: function(e)
{
if (e.getKey() == e.ENTER) {
alert("回车事件");
}
}
},
buttons:[{
text:"登录",
minWidth:70,
handlernOk
}],
keys:[{
key: Ext.EventObject.ENTER,
fn: onOk ,
scope : this
}]
});
loginWin.show();
function onOk()
{
if(loginForm.getForm().isValid())
{
//弹出效果
Ext.MessageBox.show
(
{
msg: '正在登录系统,请稍等...',
progressText: 'loading...',
width:300,
wait:true,
waitConfig: {interval:200},
icon:'download',
animEl: 'loading'
}
);
setTimeout(function(){}, 1000);
loginForm.form.submit({
url:"URL/ValidateCode.aspx",
method:"OST",
success:function(form,action)
{
//成功后
var flag=action.result.success;
if(flag=="true")
{
var cp1 = new Ext.state.CookieProvider();
cp1.set('userid',Ext.get('userid').dom.value);
cp1.set('userdept',Ext.get('DeptName').dom.value);
window.location.href="Default.aspx";
}
else
{
var error = action.result.error;
//Ext.MessageBox.alert("提示信息",error);
alert(error);
window.location.reload();
}
},
failure:function(form,action)
{
Ext.MessageBox.alert("提示信息","登录失败!");
}
});
}
}
//document.getElementById('CodeImge').innerHTML='验证码图片:<img src="URL/Image.aspx" width=57 height=25 align="AbsMiddle"><input type="button" onclick="ReBtn()" value="看不清"><br>';
});
function ReBtn()
{
window.location.reload();
/*
Ext.Ajax.request({
url:"URL/Image.aspx",
method:"OST",
success:function()
{
document.getElementById('CodeImge').innerHTML='验证码图片:<img src="URL/Image.aspx" width=57 height=25 align="AbsMiddle"><input type="button" onclick="ReBtn()" value="看不清"><br>';
}
});
*/
}
</script>
<div align="center"><img src="BK/default.png" onload="resizepic(this)" style="vertical-align:middle;" id="bkpic"/></div>
</body>
</html> 自己写的代码无法实现呢
#include <IE.au3>
$name = "苍井空"
$pass = "87654321"
$oIE=_IECreate("内网.org,在家不知道网址,明天去单位测试")
$Form = _IEFormGetObjByName($oIE, "new Ext.FormPanel")
$username = _IEGetObjByName($oIE,"TxtName")
$password = _IEGetObjByName($oIE,"TxtPwd")
_IEPropertySet($password,"innertext",$pass)
_IEPropertySet($username,"innertext",$name)
_IEFormSubmit ($Form)
IELinkClickByText ($oIE, "登录") 看不懂哎,帮你顶顶吧! 呵呵,有验证码哦 本帖最后由 netegg 于 2012-12-29 01:30 编辑
这个貌似是js,不是网页源码吧 不用验证码,可以输入账号密码了,但是不能登录,求解,我的那段代码哪儿改一下可以登录呢 已经可以自动登录了,但是无法考勤和退出 呵呵,我们公司用的CRM系统, 也带考勤功能,我也是搞的自动的 已经搞定了,框架网页,要定位到考勤那个框架才行。
可是我还有一个问题,恳求大家帮忙
就是多账号输入问题,我用的是2个TXT,一个输入账号,另外一个输入密码,能否合并成一个文本呢? $file1 = FileOpen("MIMA.txt", 0)
; 检查文件是否正常打开
If $file1 = -1 Then
MsgBox(0, "错误", "无法打开目标文件。")
Exit
EndIf
$file2 = FileOpen("ID.txt", 0)
; 检查文件是否正常打开
If $file2 = -1 Then
MsgBox(0, "错误", "无法打开目标文件。")
Exit
EndIf
我是这样读取文本的,然后再赋值给相应的网页代码,有没有办法合并呢?
$i=0
While 1
$i=$i+1
$line = FileReadLine($file1)
$line2 = FileReadLine($file2)
If @error = -1 Then ExitLoop 回复 10# xcd
用ini文件不就行了嘛? 现在基本调试完毕,但是没有纠错语言,不知道怎么写啊?比如网页弹出“上班提醒”,还有没到下班时间如果运行程序,点击了会弹出是否早退的提醒,一旦弹错就无法继续了。
#include <IE.au3>
$PID = ProcessExists("iexplore.exe")
If $PID Then ProcessClose($PID)
;;;;;关闭所有IE窗口,并新建考勤窗口
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://172.23.0.199/oa/Login.aspx")
;=========================================================读取账号密码
$file1 = FileOpen("账号密码.txt", 0)
; 检查文件是否正常打开
If $file1 = -1 Then
MsgBox(0, "错误", "无法打开目标文件。")
Exit
EndIf
; =================输入账号密码
$i=0
While 1
$i=$i+1
$line1 = FileReadLine($file1)
$i=$i+1
$line2 = FileReadLine($file1)
If @error = -1 Then ExitLoop
$name = $line1
$pass = $line2
sleep(2000)
$oIE = _IEAttach("http://172.23.0.199/oa/","url")
_IEAction ($oIE, "refresh")
sleep(3000)
$Form = _IEFormGetObjByName($oIE, "new Ext.FormPanel")
$username = _IEGetObjByName($oIE,"TxtName")
$password = _IEGetObjByName($oIE,"TxtPwd")
sleep(500)
_IEPropertySet($password,"innertext",$pass)
sleep(500)
$XLCD =_IEGetObjByName($oIE,"ext-gen87")
$XLCD.click();下拉菜单选择
sleep(500)
$XZ = _IETagNameGetCollection($oIE,"DIV",$name)
sleep(500)
$XZ.click();
sleep(500)
$LOGIN =_IEGetObjByName($oIE,"ext-gen25")
$LOGIN .click()
sleep(1500)
;===============================================已登录,下面开始考勤。
sleep(1000)
sleep(1000)
$oFrame = _IEFrameGetCollection($oIE, 1) ;主框架中的框架1
$KQ = _IEGetObjById($oFrame, "kaoqin")
$KQ.click()
sleep(1000)
;===============================================退出登录
$olinks = _IELinkGetCollection($oFrame)
For $oLink In $oLinks
If $olink.outertext= "[安全退出]" Then
exitloop
EndIf
next
_IEAction($oLink, "click")
sleep(2000)
;==============================考勤完毕,转入下一个++++++++++++++++++++++
_IEAction ($oIE, "refresh")
;刷新网页,准备下一个考勤。
Wend
FileClose($file1)
;;;;;;;;============================================= 关闭IE8
$oIE = _IEAttach("http://172.23.0.199/oa/","url")
$Ele = _IEGetObjById($oIE,"lg")
If IsObj($oIE) Then $oIE.document.parentwindow.eval
('javascript:window.opener=null;window.open("","_self"); self.close();')
;;;;;关闭考勤网页,退出程序
Exit 頂一下,學習一下。
页:
[1]