Re: Win32::Printer::Enum::Printer($server)



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^.-
.



Relevant Pages

  • Re: Kinky Orchids (or can any ID supporter explain this)
    ... you'd get lost. ... Intellligence invites variety of design. ... What evolution has provided us with is a brain that is incredibly ... One thing you might mistake for intelligence in bacteria is something ...
    (talk.origins)
  • Re: Kinky Orchids (or can any ID supporter explain this)
    ... you'd get lost. ... Intellligence invites variety of design. ... What evolution has provided us with is a brain that is incredibly ... condemned ID as Creationism and henceforth science will be decided by ...
    (talk.origins)
  • Re: Meltdown
    ... We then went to the store to pick up some misc. ... started to get excited and felt 'LOST' I did not know what to do except ... It was not rational thinking. ... never had brain fog like this before. ...
    (alt.med.fibromyalgia)
  • Re: Meltdown
    ... We then went to the store to pick up some misc. ... started to get excited and felt 'LOST' I did not know what to do except ... It was not rational thinking. ... never had brain fog like this before. ...
    (alt.med.fibromyalgia)
  • Re: 9 levels of outline indentation is not enough!
    ... My brain is quite human, ... I really would like to use Word, it provides so many useful tools plus the ... ability to easily edit. ... Is one really limited to 9 levels of indentation in a Word outline? ...
    (microsoft.public.word.numbering)