sdwd_lhq 发表于 2010-4-11 10:40:19

我也想学习一下

txhr1spa 发表于 2010-4-17 10:59:21

#include <Excel.au3>
#include <Array.au3>
Dim $ck
$ck=WinExists ( "新型合作医疗信息管理系统 - Windows Internet Explorer")
If$ck=0 Then
        Run("C:\Program Files\Internet Explorer\iexplore.exe http://60.1.1.1/CBX/AppSvr.dll/cms100_main.ao")
    WinWait("新型合作医疗信息管理系统 - Windows Internet Explorer")
    WinSetState("新型合作医疗信息管理系统 - Windows Internet Explorer","",@SW_MAXIMIZE)
    MouseClick("left",45, 185,1)
    WinWait("用户登录")
    Send("l0")
    Send("{tab}")
    Send("za")
    Send("{enter}")
    Sleep(2000)
    MouseClick("left",42, 184,1)
    WinActive ("新型合作医疗信息管理系统 - Windows Internet Explorer")
        Sleep(1000)
        ControlClick("新型合作医疗信息管理系统 - Windows Internet Explorer","","TcxButton7")
Else
        WinSetState ( "新型合作医疗信息管理系统 - Windows Internet Explorer", "", @SW_MAXIMIZE )
        WinActive ("新型合作医疗信息管理系统 - Windows Internet Explorer")
        Sleep(1000)
        ControlClick("新型合作医疗信息管理系统 - Windows Internet Explorer","","TcxButton7")
endIf
       

;等待录入病人信息并打开and读取费用文件
Dim $ddlr
$ddlr=MsgBox ( 1, "等待录入", "现在要自动录入费用吗" )
If $ddlr=1 Then
        WinActivate("新型合作医疗信息管理系统 - Windows Internet Explorer")
        Sleep(1000)
        ControlClick("新型合作医疗信息管理系统 - Windows Internet Explorer","","")
        ;MouseClick("left",431, 425,1)
        $sFilePath1 = @DesktopDir & "\brfy.xls" ;打开EXCEL费用文件
    $oExcel = _ExcelBookOpen($sFilePath1)
    If @error = 1 Then
      MsgBox(0, "错误!", "无法创建对象!")
      Exit
    ElseIf @error = 2 Then
      MsgBox(0, "错误!", "文件不存在!")
      Exit
    EndIf
        ;查找最后一行
;#comments-start
    Dim $i=1,$k
       Do
          $k = _ExcelReadCell($oExcel, $i, 1)
          $i=$i+1
   Until $k=""
    ;MsgBox(1,$i,$k)
    $i=$i-2
        ;MsgBox(1,$i,$k)
;#comments-end

        Dim $aArray
    $aArray = _ExcelReadSheetToArray($oExcel, 1, 1) ;读取费用EXCEL文件
   ;_ArrayDisplay($aArray, "$aArray 数组值");显示数组
       _ExcelBookClose($oExcel) ; 关闭工作表, 退出
        Local $row=2
        While $row<>$i+1
                Sleep(300)
                Send($aArray[$row])
      ;MsgBox(1,"需要人工干预","请选择")
                ;WinActivate("新型合作医疗信息管理系统 - Windows Internet Explorer")
           ;Send("{enter}")
                ;ControlClick("新型合作医疗信息管理系统 - Windows Internet Explorer","","")
                Sleep(1000)
                If $aArray[$row]="ps" Or $aArray[$row]="fl" Or $aArray[$row]="lms" Then
                Send("{DOWN}")
                Send("{DOWN}")
                EndIf
                Send("{enter}")
          ;Else
                ;Sleep(1000)
                ;Send("{enter}")
                ;EndIf
               
                Send($aArray[$row])
                Send("{enter}")
                Sleep(500)
                Send($aArray[$row])
                Send("{enter}")
                Sleep(500)
                $row=$row+1       
        WEnd
Else
   Exit
EndIf

menfan 发表于 2010-4-17 11:05:25

有意思,学习一下。。

xz00311 发表于 2010-4-18 21:49:35

最好能远程看一下或者你可以用标题加高级类和控件坐标可以做得到send的时候延时一下就可以了

flyingrabbit 发表于 2010-5-10 10:00:30

学习一下。新手上路,不要见笑
页: 1 [2]
查看完整版本: 如何将excel的数据(逐行)自动录入到相应的空格里面?