Search the Community
Showing results for tags 'rundll32'.
-
_GUICtrlTab_FindTab($currentprinter & " Printing Preferences", "Page Setup") On all 64bit systems that I have testes this on, it seems to fail or return -1. I compiled the scripts with beta 3.3.9.4 I am trying to grab the tab control from running rundll32 printui.dll,PrintUIEntry /e /n What am I doing wrong here?
- 3 replies
-
- 64bit
- GUICtrlTab
-
(and 1 more)
Tagged with:
-
Use these functions to capture and restore windows network printers. This script was used in a Win XP/7 environment running 2008 R2 servers. Global Const $PrinterList = (@DesktopDir & "printerlist.csv") Func PrinterBackup() Local $csvfile ConsoleWrite($PrinterList & @LF) $csvfile = FileOpen($PrinterList, 10) ; Pull default printer and write it to the first line of the file $objWMI = ObjGet("winmgmts:.rootCIMV2") $colPrinters = $objWMI.ExecQuery("SELECT * FROM Win32_Printer", "WQL", 0x10 + 0x20) If IsObj($colPrinters) Then For $objPrinter In $colPrinters If $objPrinter.Default = "True" And $objPrinter.Network = "-1" Then ConsoleWrite("Writing printer " & $objPrinter.Name & @CR) Sleep(500) FileWriteLine($PrinterList, $objPrinter.Name & @CR) EndIf Next EndIf ; Then grab the rest of the printers, if any $objWMI = ObjGet("winmgmts:.rootCIMV2") $colPrinters = $objWMI.ExecQuery("SELECT * FROM Win32_Printer", "WQL", 0x10 + 0x20) If IsObj($colPrinters) Then For $objPrinter In $colPrinters If $objPrinter.Network = "-1" And $objPrinter.Default = ("") Then ConsoleWrite("Writing printer " & $objPrinter.Name & @CR) Sleep(500) FileWriteLine($PrinterList, $objPrinter.Name & @CR) EndIf Next EndIf FileClose($csvfile) If FileExists($PrinterList) = 0 Then TrayItemSetState($ItemPrinterRestore, $TRAY_DISABLE) ElseIf FileExists($PrinterList) <> 0 Then TrayItemSetState($ItemPrinterRestore, $TRAY_ENABLE) EndIf EndFunc ;==>PrinterBackup Use this function to restore printers.... Global Const $PrinterList = (@DesktopDir & "printerlist.csv") Func PrinterRestore() Local $PrinterArray[1], $x, $csvfile If FileExists($PrinterList) Then $csvfile = FileReadLine($PrinterList) If Not $csvfile = ("") Then _FileReadToArray($PrinterList, $PrinterArray) For $x = 1 To 1 RunWait(@ComSpec & " /c " & "rundll32 printui.dll,PrintUIEntry /in /n" & $PrinterArray[$x], "", @SW_HIDE) RunWait(@ComSpec & " /c " & "rundll32 printui.dll,PrintUIEntry /y /n" & $PrinterArray[$x], "", @SW_HIDE) Next For $x = 2 To $PrinterArray[0] RunWait(@ComSpec & " /c " & "rundll32 printui.dll,PrintUIEntry /in /n" & $PrinterArray[$x], "", @SW_HIDE) Next EndIf EndIf EndFunc ;==>PrinterRestore