Hello,
I'm afraid you will have to use COMObject for that. Try the following script, hope this helps:
Code |
---|
Script = Новый ComObject("MSScriptControl.ScriptControl");
Script.Language = "vbscript";
Script.AddCode("
|Function GetDefaultPrinter()
|GetDefaultPrinter=vbNullString
|Set objWMIService=GetObject(""winmgmts:"" _
|& ""{impersonationLevel=impersonate}!\\.\root\cimv2"")
|Set colInstalledPrinters=objWMIService.ExecQuery _
|(""Select * from Win32_Printer"")
|For Each objPrinter in colInstalledPrinters
|If objPrinter.Attributes and 4 Then
|GetDefaultPrinter=objPrinter.Name
|Exit For
|End If
|Next
|End Function");
DefaultPrinter = TrimAll(Script.run("GetDefaultPrinter")); |