Re: Win32::Printer::Enum::Printer($server)
- From: Thomas Kratz <ThomasKratz@xxxxxxxxxxxxxxxx>
- Date: Wed, 13 Jul 2005 11:12:52 +0200
Sully wrote:
the $attrib returns the column heading rather than the data from the array.
I'm sure I am missing something simple but my brain has overheated. .
Aah! I had to read this a few times before I realized what you mean. You have lost all indentation in your reply
.
Here is what I have so far:
#use strict; use warnings;
use Win32::OLE qw/in/; Win32::OLE->Option(Warn => 1);
$ARGV[0] ||= '';
my $wmi =
Win32::OLE->GetObject("winmgmts:{impersonationLevel=impersonate,(security)}$ARGV[0]")
or die "error initializing WMI interface, ",
Win32::OLE->LastError;
my @attrib = qw/DeviceID Status/;
print join(', ', @attrib), "\n"; for my $p ( in($wmi->InstancesOf('Win32_Printer')) ) { $_ ||= '' for @$p{@attrib};
print join(', ', @$p{@attrib}), "\n";
if($attrib[1] ne Error)
No @attrib contains the headings. What you want is the actual parameter of the hash referenced by $p. Also ITYM 'eq' instead of 'ne'.
if ( $p->{Status} eq 'Error' )But then as you have noticed, the 'Status' parameter doesn't do what you want (see my other response)
{ # system("D:/\\server/share/\\dir/\\frmsendmail.exe blank\.txt -t
me\@mine.com -priority 1 -subject a_printer_has _a_problem");
}
}
Thomas
--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
.- References:
- Re: Win32::Printer::Enum::Printer($server)
- From: Sully
- Re: Win32::Printer::Enum::Printer($server)
- Prev by Date: Re: Win32::Printer::Enum::Printer($server)
- Next by Date: Thanks
- Previous by thread: Re: Win32::Printer::Enum::Printer($server)
- Next by thread: re:Win32::Printer::Enum::Printer($server)
- Index(es):
Relevant Pages
|