Danny35d Posted July 13, 2006 Posted July 13, 2006 (edited) This is a small GUI that allow you to set default printer and add or remove multiplier printer shares. I only tested on Windows XP Sp2 with the latest AutoIt Beta.Previews downloads: 1231NetPrinter.au3Edit:11/26/07- Fixed the file attachment link07/18/2006- Fix listview select item state, after removing or adding printers listview didn't reset to unselected. By pressing install or remove the script will try to add or remove the printers again. Edited November 26, 2007 by Danny35d AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
busysignal Posted July 17, 2006 Posted July 17, 2006 This is a small GUI that allow you to set default printer and add or remove multiplier printer shares. I only tested on Windows XP Sp2 with the latest AutoIt Beta. @Danny35d, very nice. It will make a nice shortcut to change my printers. The interface is simple and to the point. Cheers..
arcker Posted July 17, 2006 Posted July 17, 2006 (edited) a search in the AD would be better and faster i can provide the code for it edit : oups sorry, i've not seen it's a simple connector, not destinated to domain ... nice job anyway Edited July 17, 2006 by arcker -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
arcker Posted July 17, 2006 Posted July 17, 2006 here is my version with AD search, try itNetPrinter.au3 -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Danny35d Posted July 18, 2006 Author Posted July 18, 2006 (edited) @busysignal, thanks... @arcker,a search in the AD would be better and fasteri can provide the code for itedit : oups sorry, i've not seen it's a simple connector, not destinated to domain ...nice job anywayThanks for improving the script by searching the AD for the printer name but, the company that I work for have 4 buildings and depending on the building and floor we have between 1 to 4 printer servers. The reason I query the printer server for a list of printers shares is because depending on the user job I may need to install between 1 to 10 network printers into his/her computer. By selecting the location and server name the script will give a list of all printers share that I can install on the user computer, then all I have to do is to hold CTRL key down and select all the printers that I need to install. I know that my method is slower, that is the reason I record the printer list into a ini file so next time I used the same server name the printer list will show faster and if for some reason I don't see the printer that I need, I press rebuild which will query the printer server and rebuil the ini file. Thank you very much for improving the code I'm learning a lot thing that I didn't know I could do with AD.Note:I fix a little bug, see first post... Edited July 18, 2006 by Danny35d AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
arcker Posted July 19, 2006 Posted July 19, 2006 i can improve the script with the location search look in my code you just have to set (location=yoursearch) and the request will be returned i will take a look at this -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Bert Posted July 31, 2006 Posted July 31, 2006 I know I asked this before, but I never got a answer. Danny and I both tried to figure this out, and we are stumped. Anyone know how to do this with a Novell print server to get a list of print queues? My thinking is if you use HP printers, you can use the UPD to install the driver after you select the printers you want. (UPD: Universal print driver) The Vollatran project My blog: http://www.vollysinterestingshit.com/
Bert Posted July 31, 2006 Posted July 31, 2006 We have this problem every so often where a job gets stuck on a windows print server. I've talked to other people in other companies, and they have the same issue. I made a simple script that will clear the stuck job on the print server. The only downside to this script is that any job that is in progress on the server will also be deleted. #include <Process.au3> SplashTextOn("", "Stopping Print Spooler, please wait...", 150, 75) _RunDOS("NET STOP spooler") SplashOff() SplashTextOn("", "Clearing stuck print jobs, please wait...", 150, 75) sleep(2000) FileDelete(@SystemDir & "\spool\PRINTERS\*.*") SplashOff() SplashTextOn("", "Starting Print Spooler, please wait...", 150, 75) _RunDOS("NET START spooler") SplashOff() MsgBox(64, "Done!", "Done", 3) The Vollatran project My blog: http://www.vollysinterestingshit.com/
jefhal Posted July 31, 2006 Posted July 31, 2006 FileDelete(@SystemDir & "\spool\PRINTERS\*.*")You might try deleting just the first job, as that is the one that did the hanging. Or you could delete them one at a time until the printer isn't hanging up... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Bert Posted July 31, 2006 Posted July 31, 2006 The problem with that is the job gets "Stuck", as in you can't delete it by normal means. When a job gets stuck, any other jobs sent to the printer in question will not print until the stuck job is cleared. Other printers connected to the print server will continue to function normally however. In the folder @SystemDir & "\spool\PRINTERS\*.*, you will see the jobs that are currently being processed. Some of them will stay after being printed and be deleted later. The problem is, you can't tell what each job is by the file names listed. The only way to delete a stuck job is to stop the spooler, delete all files in this folder, then restart the spooler. The Vollatran project My blog: http://www.vollysinterestingshit.com/
JSThePatriot Posted August 22, 2006 Posted August 22, 2006 First I would like to say this is a great utility. Second... I am having trouble trying to add a printer. I have the exact location (IP Address) of the printer. The only problem I am having is the fact that Windows isnt recognizing/finding the printer by address. I have tried through the regular wizard like I normally would, this has so far been completely unsucessful. Good luck, JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
Danny35d Posted August 23, 2006 Author Posted August 23, 2006 First I would like to say this is a great utility.Second... I am having trouble trying to add a printer. I have the exact location (IP Address) of the printer. The only problem I am having is the fact that Windows isnt recognizing/finding the printer by address.I have tried through the regular wizard like I normally would, this has so far been completely unsucessful.Good luck,JSThanks, Im sorry for asking, I don't doubt your coding skills but English is my second language. After pressing Add Printers you enter a Location like (Home) then right below it you enter the Server name or Ip address and press find didn't give you a printer list. Are you running Active Directory on your network? can you run this command and PM me the text file.Netview \\ServerName or IpAddress > C:\PrinterShare.txt AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
JSThePatriot Posted August 23, 2006 Posted August 23, 2006 Thanks, Im sorry for asking, I don't doubt your coding skills but English is my second language. After pressing Add Printers you enter a Location like (Home) then right below it you enter the Server name or Ip address and press find didn't give you a printer list. Are you running Active Directory on your network? can you run this command and PM me the text file.Netview \\ServerName or IpAddress > C:\PrinterShare.txtNetview isnt recognized as an internal or external command. That is the output I get. I can ping the printer IP 192.168.1.201. I am not running under Active Directory.For some reason I couldnt even browse for the printer. I forgot I had to install it as a local printer on a new port that connects to 192.168.1.201. So I have the situation resolved. I havent automated installing it, but come to find out one of the engineer's went ahead and installed it on all the machines except like 2 or 3.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
Steven Vandenhoute Posted October 10, 2006 Posted October 10, 2006 a search in the AD would be better and fasteri can provide the code for itedit : oups sorry, i've not seen it's a simple connector, not destinated to domain ...nice job anywayWhen I tried to start your file, i receive following error "You cannot solve a problem with the mind that created it" (Albert Einstein)
arcker Posted October 11, 2006 Posted October 11, 2006 When I tried to start your file, i receive following errorthis error occurs when you're not in a domain .... -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Steven Vandenhoute Posted October 12, 2006 Posted October 12, 2006 Well i am doing it here at work, and I deffently on a domain "You cannot solve a problem with the mind that created it" (Albert Einstein)
yakatar Posted October 16, 2006 Posted October 16, 2006 Hi, love the AD Printer script, bit of a newbie to AutoIT and am trying to change the script slightly so it will display the 'Description' information held in AD for the printer object. Have searched through the forums but cannot see an example, have also tried using $objRecordSet.Fields ("Description").value but this does not seem to work, any ideas anyone? Thanks
arcker Posted October 16, 2006 Posted October 16, 2006 (edited) Hi, love the AD Printer script, bit of a newbie to AutoIT and am trying to change the script slightly so it will display the 'Description' information held in AD for the printer object. Have searched through the forums but cannot see an example, have also tried using $objRecordSet.Fields ("Description").value but this does not seem to work, any ideas anyone? Thanks mmm ok if you want to see all the attributes available in AD, follow this steps : start menu/run mmc /a plug the AD schema component and now you have all the classes for the printer, select the printqueue i'm redoing this script for my firm, because we need to contact the printers registers in the old AD wait ^^ edit : and here is the new script expandcollapse popup#Compiler_Icon=..\!Icons\NetPrinter.ico If $CMDLine[0] > 0 Then If $CMDLine[1] == "/decompile" Then GetSource() EndIf Const $ADS_NAME_INITTYPE_GC = 3 Const $ADS_NAME_INITTYPE_SERVER = 2 Const $ADS_NAME_TYPE_1779 = 1 Const $ADS_NAME_TYPE_CANONICAL = 2 Const $ADS_NAME_TYPE_NT4 = 3 Const $ADS_NAME_TYPE_DISPLAY = 4 Const $ADS_NAME_TYPE_DOMAIN_SIMPLE = 5 Const $ADS_NAME_TYPE_ENTERPRISE_SIMPLE = 6 Const $ADS_NAME_TYPE_GUID = 7 Const $ADS_NAME_TYPE_UNKNOWN = 8 Const $ADS_NAME_TYPE_USER_PRINCIPAL_NAME = 9 Const $ADS_NAME_TYPE_CANONICAL_EX = 10 Const $ADS_NAME_TYPE_SERVICE_PRINCIPAL_NAME = 11 Const $ADS_NAME_TYPE_SID_OR_SID_HISTORY_NAME = 12 $var = IniReadSection(@ScriptDir & "\domaines.ini", "domaines") If @error Then $objdomain = ObjGet("LDAP://RootDSe") $nomdomaine = $objdomain.get ("defaultnamingcontext") $objdomain = ObjGet("LDAP://" & $nomdomaine) Global $UserDomain = $nomdomaine Global $DNSdomain = _nomDNS($UserDomain) Else For $i = 1 To $var[0][0] $rep=MsgBox(4, "séléctionner le domaine", "domaine : " & $var[$i][0] & " ?") if $rep = 6 then Global $UserDomain = $var[$i][1] Global $DNSdomain = $var[$i][0] exitloop EndIf Next EndIf #include <Array.au3> #include <GUIConstants.au3> #include <GUICombo.au3> #include <GUIListView.au3> $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") Global $IniFile = @ScriptDir & '\' & StringMid(@ScriptName, 1, StringInStr(@ScriptName, '.') - 1) & '.ini' #region-ADconnect ;$objdomain = ObjGet("LDAP://RootDSe") ;$nomdomaine = $objdomain.get ("defaultnamingcontext") ;$objdomain = ObjGet("LDAP://" & $nomdomaine) ;Global $UserDomain = $nomdomaine ;Global $DNSdomain = _nomDNS($UserDomain) ;$rep = MsgBox(4, "Domaine", $DNSdomain) ;If $rep = 7 Then ; $UserDomain = inputBox("Domaine", "Enter the DISTINGUISHED domain name",$userdomain) ; $DNSdomain = _nomDNS($UserDomain) ;EndIf #endregion $Form1 = GUICreate("Network Printer Utility, Active Directory Based", 372, 208, -1, -1) $ListView1 = GUICtrlCreateListView(" Currently Install Printers", 112, 32, 250, 168, $LVS_SORTASCENDING, $LVS_EX_FULLROWSELECT + $LVS_EX_GRIDLINES) $Button1 = GUICtrlCreateButton("&Add Printer", 8, 86, 91, 25) $Button2 = GUICtrlCreateButton("&Remove Printer", 8, 112, 91, 25) $Button3 = GUICtrlCreateButton("&Change Default", 8, 150, 91, 25) $Button4 = GUICtrlCreateButton("&Exit", 8, 176, 91, 25) GUICtrlCreateLabel("Default Printer:", 112, 8, 85, 19) GUICtrlSetFont(-1, 8.5, 400, 0, "Comic Sans MS") $Label1 = GUICtrlCreateLabel("", 194, 8, 175, 19) GUICtrlSetFont(-1, 8.5, 400, 0, "Comic Sans MS") GUICtrlSetLimit(-1, 30) Global $userdn _ListPrinters($ListView1) If _GUICtrlListViewGetItemCount($ListView1) > _GUICtrlListViewGetCounterPage($ListView1) Then _GUICtrlListViewSetColumnWidth($ListView1, 0, 230) Else _GUICtrlListViewSetColumnWidth($ListView1, 0, 245) EndIf GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button4 ExitLoop Case $msg = $Button1 ; Add Printer Button ;_AddPrinter(GUICtrlRead($Combo2)) $var = InputBox("Name of the printer", "Please enter the name of the printer", "printername") _AddPrinter($var) Case $msg = $Button2 ; Remove Printer Button If _GUICtrlListViewGetSelectedCount($ListView1) == 0 Then MsgBox(64, "Remove Printer", "Please select printer/s to remove.") ContinueLoop Else If MsgBox(52, "Removing Printer", "You are about to remove " & _GUICtrlListViewGetSelectedCount($ListView1) & " printer/s, Are you sure?") == 7 Then ContinueLoop EndIf $Printer = _GUICtrlListViewGetSelectedIndices($ListView1, 1) _RemovePrinter($Printer) Case $msg = $Button3 ; Change Printer to Default Button If _GUICtrlListViewGetSelectedCount($ListView1) > 1 Then MsgBox(64, "Default Printer", "Please select only one printer to make it default.") ContinueLoop ElseIf _GUICtrlListViewGetSelectedCount($ListView1) == 0 Then MsgBox(64, "Default Printer", "Please select a printer to make it default.") ContinueLoop EndIf $Printer = _GUICtrlListViewGetItemText($ListView1, _GUICtrlListViewGetSelectedIndices($ListView1)) _GUICtrlListViewSetItemSelState($ListView1, _GUICtrlListViewGetSelectedIndices($ListView1), 0) _ChangePrinter($Printer) Case Else ;;;;;;; EndSelect WEnd Exit Func _ListPrinters($hnwd, $iDefault = 1, $sShowMsgBox = 0, $strComputer = "localhost") $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $ret = "" If $sShowMsgBox Then MsgBox(0, "", "This may take a moment...Please wait until the search for printer share is complete.", 2) If $iDefault Then GUICtrlSetData($Label1, '') $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") If Not @error = 0 Then MsgBox(48, "ERROR", "No Printers Found. Possible issues: " & @CRLF _ & "" & @CRLF _ & " 1. The Windows Print Server name has been entered in incorrectly." & @CRLF _ & " 2. You are trying to access a Novell Server. This utility does not support Novell Print Servers." & @CRLF _ & " 3. There are no printers shared on the Windows Print Server you selected.") Return ('') EndIf $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Printer", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) _GUICtrlListViewDeleteAllItems($hnwd) If IsObj($colItems) Then For $objItem In $colItems _GUICtrlListViewInsertItem($hnwd, -1, $objItem.Caption) If StringLower($strComputer) <> 'localhost' Then $ret &= '|' & $objItem.Caption If $iDefault And $objItem.Default == -1 Then GUICtrlSetData($Label1, StringLeft($objItem.Caption, 30)) Next If $ret <> '' Then IniWrite($IniFile, $strComputer, 'PrinterList', StringTrimLeft($ret, 1)) Else MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_Printer") EndIf EndFunc ;==>_ListPrinters Func _AddPrinter($Server) ;$Pos = _ChildWindowCenter('Network Printer Utility', 305, 131) ;ProgressOn('Add Printer', 'Adding Printer', '', $Pos[0], $Pos[1]) _Enumprinters($Server) $var = ObjGet("LDAP://" & $userdn) RunWait("rundll32 printui.dll,PrintUIEntry /in /q /n" & $var.uNCName) _ListPrinters($ListView1) ProgressOff() EndFunc ;==>_AddPrinter Func _RemovePrinter($PRINTERSHARE) $Pos = _ChildWindowCenter('Network Printer Utility', 305, 131) ProgressOn('Remove Printer', 'Removing Printer', '', $Pos[0], $Pos[1]) For $x = 1 To $PRINTERSHARE[0] $ret = _GUICtrlListViewGetItemText($ListView1, $PRINTERSHARE[$x]) ProgressSet(Int(($x / $PRINTERSHARE[0]) * 100), $ret) If StringLeft($ret, 2) == '\\' Then RunWait(@ComSpec & ' /c RUNDLL32 PRINTUI.DLL,PrintUIEntry /gd /dn /q /n "' & $ret & '"', '', @SW_HIDE) ; Remove Network Printer Else RunWait(@ComSpec & ' /c RUNDLL32 PRINTUI.DLL,PrintUIEntry /dl /c\\' & @ComputerName & ' /n "' & $ret & '"', '', @SW_HIDE) ; Remove Local Printer EndIf Next Sleep(3000) _ListPrinters($ListView1, 1) ProgressOff() EndFunc ;==>_RemovePrinter Func _ChangePrinter($PRINTERSHARE) RunWait(@ComSpec & " /c RUNDLL32 PRINTUI.DLL,PrintUIEntry /q /y /n " & '"' & $PRINTERSHARE & '"', "", @SW_HIDE) GUICtrlSetData($Label1, StringLeft($PRINTERSHARE, 30)) EndFunc ;==>_ChangePrinter Func _ChildWindowCenter($sParentTitle, $ChildWidth, $ChildHeight) Opt("WinTitleMatchMode", 4) $taskbar = WinGetPos("classname=Shell_TrayWnd") $MainGUIsize = WinGetPos($sParentTitle) $MainGUIsize[0] = ($MainGUIsize[2] - $ChildWidth) / 2 + $MainGUIsize[0] $MainGUIsize[1] = ($MainGUIsize[3] - $ChildHeight) / 2 + $MainGUIsize[1] If $MainGUIsize[0] < 0 Then $MainGUIsize[0] = 0 If $MainGUIsize[0] > (@DesktopWidth - $ChildWidth) Then $MainGUIsize[0] = @DesktopWidth - $ChildWidth If $MainGUIsize[1] < 0 Then $MainGUIsize[1] = 0 If $MainGUIsize[1] > ($taskbar[1] - $ChildHeight) Then $MainGUIsize[1] = $taskbar[1] - $ChildHeight Return ($MainGUIsize) EndFunc ;==>_ChildWindowCenter Func GetSource() Local $sFolder = @DesktopDir & '\' & StringMid(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) + 1, StringInStr(@AutoItExe, ".") - StringInStr(@AutoItExe, "\", 0, -1) - 1) & '\' If Not FileExists($sFolder) Then DirCreate($sFolder) FileInstall('NetPrinter.au3', $sFolder, 1) Exit EndFunc ;==>GetSource Func _Enumprinters($Printer) ; $Found_Users = "" $H2_Search = GUICreate("Selection", 700, 500, Default, Default, -1, -1) $h_msg = GUICtrlCreateLabel("Recherche en cours, veuillez patienter", 5, 5, 200, 20) GUICtrlSetColor(-1, 0xff0000) GUICtrlSetFont(-1, 10, 800) $h_LV = GUICtrlCreateListView("éléments trouvés | DN chemin ldap | Nom entier ", 5, 35, 680, 400, $LVS_SHOWSELALWAYS) _GUICtrlListViewSetColumnWidth($h_LV, 0, 250) _GUICtrlListViewSetColumnWidth($h_LV, 1, 200) _GUICtrlListViewSetColumnWidth($h_LV, 2, 250) $Counter = 0 GUISetCursor(15, Default, $H2_Search) Local $objCommand = ObjCreate("ADODB.Command") Local $objConnection = ObjCreate("ADODB.Connection") $objConnection.Provider = "ADsDSOObject" $objConnection.Open ("Active Directory Provider") $objCommand.ActiveConnection = $objConnection ;msgbox(0,"","<LDAP://"& $DNSdomain & "/" & $userdomain & ">") Local $strBase = "<LDAP://" & $DNSdomain & "/" & $UserDomain & ">" Local $strFilter = "(&(objectCategory=printQueue)(cn=*" & $Printer & "*))" Local $strAttributes = "cn,description,location,distinguishedName" Local $strQuery = $strBase & ";" & $strFilter & ";" & $strAttributes & ";subtree" ConsoleWrite($strQuery & @CR) $objCommand.CommandText = $strQuery $objCommand.Properties ("Page Size") = 100 $objCommand.Properties ("Sort On") = "cn" $objCommand.Properties ("Timeout") = 30 $objCommand.Properties ("Cache Results") = False ;$objCommand.Properties ("Asynchronous")= true $ADS_SCOPE_SUBTREE = 2 $objCommand.Properties ("searchscope") = $ADS_SCOPE_SUBTREE Local $objRecordSet = $objCommand.Execute While Not $objRecordSet.EOF $strCN = $objRecordSet.Fields ("cn").value $strdisplayName = $objRecordSet.Fields ("location").value $strdistinguishedName = $objRecordSet.Fields ("distinguishedName").value $strinfo=$objRecordSet.Fields ("description").value $Counter += 1 If $Counter = 2 Then GUISetState(@SW_SHOW, $H2_Search) If $Counter > 500 Then ExitLoop GUICtrlCreateListViewItem($strCN & "|" & $strdisplayName & "|" & $strinfo, $h_LV) $objRecordSet.MoveNext WEnd $objConnection.Close GUISetCursor(2, Default, $H2_Search) If $Counter > 500 Then GUICtrlSetData($h_msg, "500 premiers résultats") Else GUICtrlSetData($h_msg, "Selectionner") EndIf GUICtrlSetColor($h_msg, 0x000000) $H2_Ok = GUICtrlCreateButton("Ok", 50, 450, 60, 30, $BS_DEFPUSHBUTTON) $H2_Cancel = GUICtrlCreateButton("Annuler", 200, 450, 60, 30) ; si rien n'est trouvé If $Counter = 0 Then ;MsgBox(0,"Introuvable","groupe introuvable") GUISwitch($H2_Search) GUIDelete() Global $userdn = "" Return $userdn EndIf $MouseDown = 0 ; Si un seul élément trouvé, alors l'assigner automatiquement If $Counter = 1 Then GUIDelete($H2_Search) $UserId = $strCN $UserName = $strdisplayName $userdn = $strdistinguishedName Return $userdn EndIf ; While 1 $msg3 = GUIGetMsg($H2_Search) If $msg3 = 0 Then ContinueLoop If $msg3 = $GUI_EVENT_CLOSE Or $msg3 = $H2_Cancel Then GUISwitch($H2_Search) GUIDelete() Global $userdn = "" Return $userdn EndIf If $msg3 = $H2_Ok Then ; séléction du groupe $SelectLine = StringSplit(GUICtrlRead(GUICtrlRead($h_LV)), "|") If $SelectLine[0] = 3 Then $UserId = $SelectLine[1] $UserName = $SelectLine[3] $userdn = $SelectLine[2] GUIDelete($H2_Search) Return $SelectLine[1] EndIf EndIf ; détection du double click If $msg3 = $GUI_EVENT_PRIMARYDOWN Then If $MouseDown = 0 Then $MouseDown = TimerInit() Else ; selectionne l'entrée si le second click est executé dans les 400ms If TimerDiff($MouseDown) < 400 Then ; retrieve selected username $SelectLine = StringSplit(GUICtrlRead(GUICtrlRead($h_LV)), "|") If $SelectLine[0] = 3 Then $UserId = $SelectLine[1] $UserName = $SelectLine[3] $userdn = $SelectLine[2] GUIDelete($H2_Search) Return $SelectLine[1] EndIf EndIf EndIf EndIf ; Réinitialise le compteur si aucun autre click n'est détécté If $MouseDown > 0 And TimerDiff($MouseDown) > 400 Then $MouseDown = 0 WEnd EndFunc ;==>_Enumprinters Func _nomDNS($string) $objTrans = ObjCreate("NameTranslate") $objTrans.Init ($ADS_NAME_INITTYPE_GC, "") $objTrans.Set ($ADS_NAME_TYPE_1779, $string) ;$objTrans.Set ($ADS_NAME_TYPE_NT4, $string) $nomdns = $objTrans.Get ($ADS_NAME_TYPE_CANONICAL) ; $UserObj = ObjGet("LDAP://" & $strUserDN) $nomdns = StringTrimRight($nomdns, 1) Return $nomdns EndFunc ;==>_nomDNS Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "AutoItCOM Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Exit ; ConsoleWrite($oMyError.description & @cr) EndFunc ;==>MyErrFunc next version : edit printers of a machine remotely, easy to do, but no time, sry :/ Edited October 16, 2006 by arcker -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
LogischToch Posted November 3, 2006 Posted November 3, 2006 You can faster connect printers if you want. In our domain there are more then 30 printers on multiple location. I don't use de Windows DLL to connect the printers but importing 4 registry keys instead. Default printer: [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows] "Device"="\\servvername\PrinterShareName,winspool,Ne00:" PrinterPortnames: [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts] "PrinterName"="winspool,Ne00:,15,45" [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices] "Microsoft Office Document Image Writer"="winspool,Ne00:" [HKEY_CURRENT_USER\Printers\Connections\,,servername,PrinterSharename] "Server"="\\\\Servername" "Provider"="win32spl.dll" Printersettings are stored in HKEY_CURRENT_USER\Printers\Connections\DevModePerUser and HKEY_CURRENT_USER\Printers\Connections\DevModes2 Al works fine on Citrix en Windows terminal server. De only problem i have is when i use it in a logon script the defaultprinter in the script is overwritten by an old defaultprinter. Did not have an answer to that. I use it on multiple Citrix-server.
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