本帖最后由 CCM 于 2016-2-1 17:32 编辑
直接运行脚本是正常的,在不同台电脑上运行都可以。
但编译成exe后,只要一执行,就出现 unable to open the script file
脚本内容如下,请问有什么地方错了吗?autoit版本是3.6.0;2016-02-01-CCM
Local $file = @ScriptDir & "" & "userlist.txt"
Local $UserName = ".加密憑證.pfx"
Local $Pwd = "123456789"
Local $fo = FileOpen($file)
If $fo = -1 Then
MsgBox(0, "檔案錯誤", "Userlist.txt 不存在。")
Exit
EndIf
While 1
Sleep(500)
Local $fl = FileReadLine($fo)
If $fl = "" Then ExitLoop
WinWaitActive("軟體憑證設定")
ControlClick("軟體憑證設定", "", "WindowsForms10.BUTTON.app.0.129c8662")
WinWaitActive("新增軟體憑證")
ControlClick("新增軟體憑證", "", "WindowsForms10.EDIT.app.0.129c8662")
WinWaitActive("開啟舊檔")
ControlSend("開啟舊檔", "", "[CLASS:Edit; INSTANCE:1]", @ScriptDir & "" & $fl & $UserName)
ControlClick("開啟舊檔", "", "[CLASS:Button; INSTANCE:1]")
WinWaitActive("新增軟體憑證")
ControlSend("新增軟體憑證", "", "WindowsForms10.EDIT.app.0.129c8661", $Pwd)
ControlClick("新增軟體憑證", "", "WindowsForms10.BUTTON.app.0.129c8662")
WinWaitActive("匯入成功")
ControlClick("匯入成功", "", "[CLASS:Button; INSTANCE:1]")
WEnd
FileClose($file)
WinActivate("軟體憑證設定")
ControlClick("軟體憑證設定", "", "WindowsForms10.BUTTON.app.0.129c8663")
MsgBox(0x40000, "憑證匯入", "憑證已經匯入完畢,請按【確定】結束作業。")
我有把防毒软体卸载后测试,还是出现一样的问题。
用搜索的只找到一篇,但也没具体解决帮法,请有遇过的前辈给点意见,
谢谢! |