rudi Posted July 18, 2006 Share Posted July 18, 2006 Hello,I'd like to write a autoit3 script, that 1.) searches for the installed printers with something like"GetPrinterList", or "FileFindFirstFile" (like PrinterFindFirstPrinter) and like FileFindNextFile (so like PrinterFindNextPrinter)2.) to display a dropdown list to select one printer from the list of the found printers3.) to get the type of the selected printer.Then I could use this selection for saving and restoring printer settings using RUNDLL32 PRINTUI.DLL,PrintUIEntry /Ss /n "The Full Printer Name" /a "CustomPrinterSettings-XY.bin" d u g 2as described here: http://www.novell.com/coolsolutions/trench/11548.html honestly I have no clue for coding step 1 - 3, who is the Autoit3 expert to help me, bloody beginner ?Thanks for all suggestions, maybe a mix of rundll32.exe calls or CMD box features could be (ab)used?Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
rudi Posted July 18, 2006 Author Share Posted July 18, 2006 Hello, just found by google, that I can open the printer's "folder" by the call rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder no idea, if this might be helpful to read the list of installed printers. Especially as this is *NOT* the place to get the full printer name for NDPS printers: this isn't "Printer.full.name on TREENAME", but "\\TREENAME\Printer.full.name" Hmmm.... Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
GaryFrost Posted July 18, 2006 Share Posted July 18, 2006 might want to look at http://www.autoitscript.com/forum/index.ph...st&p=145152 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Briegel Posted July 19, 2006 Share Posted July 19, 2006 Hello, I'd like to write a autoit3 script, that 1.) searches for the installed printers with something like"GetPrinterList", or "FileFindFirstFile" (like PrinterFindFirstPrinter) and like FileFindNextFile (so like PrinterFindNextPrinter) 2.) to display a dropdown list to select one printer from the list of the found printers 3.) to get the type of the selected printer. Then I could use this selection for saving and restoring printer settings using RUNDLL32 PRINTUI.DLL,PrintUIEntry /Ss /n "The Full Printer Name" /a "CustomPrinterSettings-XY.bin" d u g 2 as described here: http://www.novell.com/coolsolutions/trench/11548.html honestly I have no clue for coding step 1 - 3, who is the Autoit3 expert to help me, bloody beginner ? Thanks for all suggestions, maybe a mix of rundll32.exe calls or CMD box features could be (ab)used? Regards, Rudi. I wrote a ServiceInfo-tool for my company a few month ago. Maybe you can use some parts of it. The original has 6 TAB's and I removed 5 of them. Names I used most are german but I think you get along. In case of doubt you can ask me. The printers I found in the registry. For functions I used 'RUNDLL32 PRINTUI.DLL' like you. Maybe code looks kindly because I never learned to program but it works for me. expandcollapse popup#include <GUIConstants.au3> #NoTrayIcon Opt("GUIOnEventMode", 1) $standardprinter = RegRead( "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\windows", "Device") $standardprinter = StringSplit($standardprinter, ",") $standardprinter = $standardprinter[1] $mainwindow = GUICreate("ServiceInfo", 430, 400) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ; 3. Reiter "Drucker" $tab3=GUICtrlCreateTab (-1, -1, 433, 350) $tab3a=GUICtrlCreateTabitem ("Drucker") GUISetFont (12) GUICtrlCreateLabel ( "Standarddrucker: ", 70, 50 ) GUICtrlCreateLabel ( $standardprinter, 220, 50 ) GUICtrlCreateLabel ( "Installierte Drucker: ", 70, 100 ) GUISetFont (9) GUICtrlCreateList("",70, 120, 200, 200) For $i = 1 To 1000 $reg = RegEnumVal( "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices", $i) If @error = -1 Then ExitLoop GUICtrlSetData(-1, $reg, $standardprinter) Next $tabtestdruck=GUICtrlCreateButton ("Testdruck", 300, 90, 100, 30) GUICtrlSetOnEvent($tabtestdruck, "Testdruck") $tabdruckereinstellung=GUICtrlCreateButton ("Einstellungen", 300, 140, 100, 30) GUICtrlSetOnEvent($tabdruckereinstellung, "Druckereinstellung") $tabdruckereigenschaft=GUICtrlCreateButton ("Eigenschaften", 300, 190, 100, 30) GUICtrlSetOnEvent($tabdruckereigenschaft, "DruckerEigenschaft") $tabdruckerfenster=GUICtrlCreateButton ("Warteschlange", 300, 240, 100, 30) GUICtrlSetOnEvent($tabdruckerfenster, "DruckerFenster") $tabdruckerordner=GUICtrlCreateButton ("Druckerordner", 300, 290, 100, 30) GUICtrlSetOnEvent($tabdruckerordner, "druckerordner") $tabbeenden=GUICtrlCreateButton ("Beenden", 164,360, 100, 30) GUICtrlSetOnEvent($tabbeenden, "Beenden") GUISetState(@SW_SHOW) While 1 Sleep(500) WEnd Func druckerordner() Run("rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder") EndFunc Func Testdruck() $drucker=GUICtrlRead ( 8 ) $instring = StringInStr ( $drucker, "\\") If $drucker == "" Then MsgBox(16,"TestDruck", "Es wurde kein Drucker ausgewählt!") ElseIf $instring == 0 Then RunWait( "rundll32 printui.dll,PrintUIEntry /n""\\" & @ComputerName & "\" & $drucker & """ /k" ) MsgBox(64, "TestDruck", "Der TestDruck wurde an den Drucker """ & $drucker & """ abgeschickt!" & @CRLF & "Bitte überprüfen Sie den Ausdruck.") Else RunWait( "rundll32 printui.dll,PrintUIEntry /n " & $drucker & " /k" ) MsgBox(64, "TestDruck", "Der TestDruck wurde an den Drucker """ & $drucker & """ abgeschickt!" & @CRLF & "Bitte überprüfen Sie den Ausdruck.") EndIf EndFunc Func DruckerFenster() $drucker=GUICtrlRead ( 8 ) $instring = StringInStr ( $drucker, "\\") If $drucker == "" Then MsgBox(16,"Drucker-Warteschlange", "Es wurde kein Drucker ausgewählt!") ElseIf $instring = 0 Then RunWait( "rundll32 printui.dll,PrintUIEntry /n""\\" & @ComputerName & "\" & $drucker & """ /o" ) Else RunWait( "rundll32 printui.dll,PrintUIEntry /n " & $drucker & " /o" ) EndIf EndFunc Func DruckerEigenschaft() $drucker=GUICtrlRead ( 8 ) $instring = StringInStr ( $drucker, "\\") If $drucker == "" Then MsgBox(16,"Drucker-Eigenschaften", "Es wurde kein Drucker ausgewählt!") ElseIf $instring = 0 Then RunWait( "rundll32 printui.dll,PrintUIEntry /n""\\" & @ComputerName & "\" & $drucker & """ /p" ) Else RunWait( "rundll32 printui.dll,PrintUIEntry /n " & $drucker & " /p" ) EndIf EndFunc Func DruckerEinstellung() $drucker=GUICtrlRead ( 8 ) $instring = StringInStr ( $drucker, "\\") If $drucker == "" Then MsgBox(16,"Drucker-Einstellungen", "Es wurde kein Drucker ausgewählt!") ElseIf $instring = 0 Then RunWait( "rundll32 printui.dll,PrintUIEntry /n""\\" & @ComputerName & "\" & $drucker & """ /e" ) Else RunWait( "rundll32 printui.dll,PrintUIEntry /n " & $drucker & " /e" ) EndIf EndFunc Func CLOSEClicked() Exit EndFunc Func Beenden () Exit EndFunc Hope I can help. Link to comment Share on other sites More sharing options...
Shaun Burdick Posted July 19, 2006 Share Posted July 19, 2006 So if you wanted something like DriveGetDrive("ALL") then use it in a function like this: Func GetPrinterList() Local $arrPrinterList[20];doubt there are more than 20 printers For $i = 1 To 1000 $reg = RegEnumVal( "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices", $i) If @error = -1 Then ExitLoop $arrPrinterList[$i] = $reg Next $arrPrinterList[0] = $i Return $arrPrinterList EndFunc This will return an array with all the printers array[0] will contain the number of printers in the list --ShaunProject PageProjects:[Drive and Printer List Tool] [RunAS Box Tool] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now