Obviator Posted July 30, 2011 Share Posted July 30, 2011 i have a small utility i use at work that gives me PC Name, PC Manufacturer, Serial Number and whether or not a specific program is loaded. i'd also like to add what printers are loaded on each machine, but i absolutely suck at arrays. i've been playing with and can make it output just what i want, but i'd like to put all the information out on one MsgBox rather than one for each printer. i don't have my source code here at home but my output looks like:Computer Name: "Computer Name" Computer Manufacturer: "Computer Manufacturer" Computer SerialNumber: "Computer SerialNumber" WIMS Number: "WIMS Number" (or "NO WIMS")What i'd like to do is put installed printers underneath the "WIMS" and all i need is "Port", "Driver", & "Name". Port could be LPT1, USB, network address (we don't use print servers here), or PDF (that would tell me that they have full-blown Adobe Pro on the system). i don't want anyone to do the work for me, but show me how i could grab the information i want to an array and place it under the information i already have. Sorta like:Printer Name Port Driver "HP Color LJ 5550" XXX.XX.XXX.XXX "HP Color LJ 5500" "Bob's LJ 4000 USB "Universal Printer Driver"Loaded printers could number anywhere from 2 to about 10 (maybe more). Any assistance would be greatly appreciated.Thanks,Dave Link to comment Share on other sites More sharing options...
martin Posted July 30, 2011 Share Posted July 30, 2011 i have a small utility i use at work that gives me PC Name, PC Manufacturer, Serial Number and whether or not a specific program is loaded. i'd also like to add what printers are loaded on each machine, but i absolutely suck at arrays. i've been playing with and can make it output just what i want, but i'd like to put all the information out on one MsgBox rather than one for each printer. i don't have my source code here at home but my output looks like: Computer Name: "Computer Name" Computer Manufacturer: "Computer Manufacturer" Computer SerialNumber: "Computer SerialNumber" WIMS Number: "WIMS Number" (or "NO WIMS") What i'd like to do is put installed printers underneath the "WIMS" and all i need is "Port", "Driver", & "Name". Port could be LPT1, USB, network address (we don't use print servers here), or PDF (that would tell me that they have full-blown Adobe Pro on the system). i don't want anyone to do the work for me, but show me how i could grab the information i want to an array and place it under the information i already have. Sorta like: Printer Name Port Driver "HP Color LJ 5550" XXX.XX.XXX.XXX "HP Color LJ 5500" "Bob's LJ 4000 USB "Universal Printer Driver" Loaded printers could number anywhere from 2 to about 10 (maybe more). Any assistance would be greatly appreciated. Thanks, Dave I think the information you need is in the registry "\HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices\" The printers are listed as key names and the data gives the driver and port. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Obviator Posted July 31, 2011 Author Share Posted July 31, 2011 Martin, thanks for that. i can get the information, but my (towering) limitation is that i can just provide the information as one MsgBox after another. i'd like to be able to present them all at once, hence the array idea. If i can capture the information in an array then i should be able to display it on the same MsgBox as the other information i capture. Either a WMI call to loop through the printers or looping through the registry i just can't capture the data as i'd like. i really need help on how to build an array that would capture the data and then present it. i feel like a complete dunce, i've just never been able to get arrays or how to construct them in my head. Thanks, Dave Link to comment Share on other sites More sharing options...
smartee Posted July 31, 2011 Share Posted July 31, 2011 hi,Here is a great place to learn about Arrays in AutoIt. No need to be so hard on yourself, post the code you have so far. Link to comment Share on other sites More sharing options...
Obviator Posted August 9, 2011 Author Share Posted August 9, 2011 Smartee, Thanks for the link, i've been reading it and think i'm a "little" smarter than when i started. It's been a busy couple of weeks getting systems moved to Win7 but i'm no further along with my script than when i started. What i've got is this (heavily borrowed from JSThePatriot): #include "CompInfo.au3" ;If you are wanting to pull WMI data from different computers then Declare $cI_CompName as the computer name before the include. ;NOTE: Printers contains alot of information, and may require a different output format. Dim $Print Dim $aPrinter Dim $j, $k, $l $j = 0 $k = 0 $l = 0 _ComputerGetPrinters($Print) If @error Then $error = @error $extended = @extended Switch $extended Case 1 _ErrorMsg($ERR_NO_INFO) Case 2 _ErrorMsg($ERR_NOT_OBJ) EndSwitch EndIf For $i = 1 To $Print[0][0]Step 1 For $j = 1 To $aPrint[0][0][0] Step 1 $aPrint[$j][0][0] = $Print[$i][0] $aPrint[0][$k][0] = $Print[$i][28] $aPrint[0][0][$l] = $Print[$i][31] ; MsgBox(0, "Test _ComputerGetPrinters", "Name: " & $Print[$i][0] & " -- " & "DeviceID: " & $aPrint[$i][28] & " -- " & "DriverName: " & $aPrint[$i][31]) Next Next Where i "think" i'm going is getting JSThePatriot's WMI array to feed "my" array in the way i want it. So far no luck, but i'm hopeful that if i keep plugging i might get it yet. Thanks, Dave 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