Sub Main
Dim Result As Integer
'Initially Recorded: 2005-8-9 16:40:25
'Script Name: 新增直接入库单
'药品表: 药品代码 单位 单价 数量 批号
' "ZY.2151999017" "kg" "10" "100" "0001"
' "ZY.2151999015" "kg" "11" "111" "0002"
Dim yaoMing As String, danWei As String, danJia As string
Dim shuLIANG AS string , piHao as string
dim msgtext as string
dim fname as string
'以下是单据头:
Window SetContext, "Caption=直接入库单据", ""
EditBox Click, "ObjectIndex=4", "Coords=148,7"
'这里取的是鼠标坐标,根据实际情况调整
Window SetContext, "Class=TdxPopupEditForm", ""
InputKeys "{DOWN}{ENTER}{tab}"
Window SetContext, "Caption=直接入库单据", ""
InputKeys "%{DOWN}"
Window SetContext, "Class=TdxPopupEditForm", ""
InputKeys "{DOWN}{ENTER}"
'以下是单据体:
fname=InputBox("Enter a filename to print:")
'输入药品表文件
Open fname For Input As #1
'打开文件
Do While Not Eof(1)
'循环读入药品,直到结束
Input #1,yaoMing, danWei, danJia,shuLIANG,piHao
Window SetContext, "Caption=直接入库单据", ""
InputKeys "%n"
Window SetContext, "Class=TdxPopupEditForm", ""
'InputKeys "{up}"
'说明:如果焦点在输入框则不用上面的{UP}
InputKeys yaoMing & "{ENTER}{ENTER}"
Window SetContext, "Caption=直接入库单据", ""
InputKeys "{TAB}" & danWei & "{TAB}" & danJia & "{TAB}{TAB}" & shuLIANG & "{TAB}" & piHao
Window SetContext, "Caption=直接入库单据", ""
InputKeys "{TAB}1"
Window SetContext, "Class=TdxPopupEditForm", ""
InputKeys "{DOWN}{ENTER}"
Loop
Window SetContext, "Caption=直接入库单据", ""
InputKeys "^a"
'药品录入完毕审核
Close #1
End Sub