本帖最后由 xyhqqaa 于 2012-1-30 02:10 编辑
公司由于公用电脑连接打印机。但是每次都有连接数限制。有时候打印连接数量因为个别原因,导致打印机无法正常接收任务打印。现在的想法是连接远程打印机的计算机管理界面然后清除会话任务。但是现在却不知道如何调用- -。然后自动关闭打印机任务,然后启动再清除会话任务数。新手求帮助#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $sUserName = "ADMINISTRATOR"
Local $sPassword = "密码"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
$Input = GUICtrlCreateInput("", 40, 40, 201, 28)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Button1", 256, 40, 105, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
RunAs($sUserName,"", $sPassword, 0, "mmc.exe compmgmt.msc /computer="&GUICtrlRead($input))
EndSwitch
WEnd
;清理打印任务
RunWait(@ComSpec & " /c net stop spooler", "", @SW_HIDE)
FileDelete(@SystemDir & "\spool\PRINTERS\*.*")
RunWait(@ComSpec & ' /c sc config spooler start= "AUTO"', '', @SW_HIDE)
RunWait(@ComSpec & ' /c net start spooler', '', @SW_HIDE)
|