Re: Windows Process Info
Win32::PerfLib, maybe? I know you can get the PID and the start time of a process. No listing in perfmon for parent process, but 'creating process id' is listed. Maybe that gives you what you need. I think the author has some examples at http://www.bybyte.de/jmk hope that helps Chris Patrick B Cromer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent by: cc: [EMAIL PROTECTED] Subject: Windows Process Info eState.com 09/09/2004 01:41 PM Is there a way to get information on a Windows process other than using Win32::Process::Info? Currently, there is a memory leak when using the Info module (see perl bug #33499). While the bug will be fixed in the next version of ActivePerl I am not sure that upgrading to a new version will be possible on the servers we are running. Specifically, the two pieces of information needed are the parent process of a process and the creation time of a process. Any solution short of an external subroutine or a process external to Perl would be appreciated. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
OLE and WMI cleanup question
I've written a script in which I'm doing wmi calls via OLE. Is there any OLE cleanup I should be doing prior to leaving the subroutine? Thanks. my ($sysname) = @_; my ($WMI,$class, $OSdata, $item); eval { $class = WinMgmts:{impersonationLevel=impersonate}!//$sysname; unless ($WMI = Win32::OLE- GetObject( $class )) { print Error creating WMI Object on $sysname \n; } ## WMI looks good so execute the OS query $OSdata = $WMI- ExecQuery(SELECT * FROM Win32_OperatingSystem); foreach $item (in $OSdata) { print $sysname is running $item-{Caption} - $item-{Version} - Service Pack Level $item-{ServicePackMajorVersion}.$item-{ServicePackMinorVersion}\n; } }; ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
win32::taskscheduler prob
I'm having a problem with getting win32:: taskscheduler to work - using version 2.03a/perl 5.8.0 build 806. Running the script below gives me Win32::TaskScheduler: fatal error: null pointer, call NEW() use Win32::TaskScheduler; use strict; my $scheduler = Win32::TaskScheduler-New(); my $result1 = $scheduler-SetTargetComputer(testbox1); my %trig = ( 'BeginYear' = 2004, 'BeginMonth' = 4, 'BeginDay' = 1, 'StartHour' = 16, 'StartMinute' = 55, 'TriggerType' = $scheduler-TASK_TIME_TRIGGER_DAILY, 'Type' = { 'DaysInterval' = 1, }, ); my $tsk = stuff1; $scheduler-NewWorkItem($tsk,\%trig); $scheduler-SetApplicationName(mspaint.exe); $scheduler-Save(); Any ideas appreciated. Thanx ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: win32::taskscheduler prob
Thanx for the suggestion, unfortunately, I'm still getting the error. Trigger.pl didn't return any errors. Chris Steven Manross To: [EMAIL PROTECTED], [EMAIL PROTECTED][EMAIL PROTECTED] ght.com cc: Subject: RE: win32::taskscheduler prob 04/01/2004 05:51 PM Not sure why, but I got that same error with your code, until I ran Umberto's trigger.pl example from the download file on sourceforge. And now your code works. :( :) Odd, but... Hey, it works! Steven Modified it slightly to see where things were failing... The two errors were in SetApplicationName and Save since something previously failed (like maybe the new). use Win32::TaskScheduler; use strict; my $scheduler = Win32::TaskScheduler-New(); my $result1 = $scheduler-SetTargetComputer(SOMEPC); my %trig = ( 'BeginYear' = 2004, 'BeginMonth' = 4, 'BeginDay' = 1, 'StartHour' = 16, 'StartMinute' = 55, 'TriggerType' = $scheduler-TASK_TIME_TRIGGER_DAILY, 'Type' = { 'DaysInterval' = 1, }, ); my $tsk = stuff1; print new work item = .$scheduler-NewWorkItem($tsk,\%trig); print \nset app name = .$scheduler-SetApplicationName(mspaint.exe); print \nsave = .$scheduler-Save(); -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, April 01, 2004 3:11 PM To: [EMAIL PROTECTED] Subject: win32::taskscheduler prob I'm having a problem with getting win32:: taskscheduler to work - using version 2.03a/perl 5.8.0 build 806. Running the script below gives me Win32::TaskScheduler: fatal error: null pointer, call NEW() use Win32::TaskScheduler; use strict; my $scheduler = Win32::TaskScheduler-New(); my $result1 = $scheduler-SetTargetComputer(testbox1); my %trig = ( 'BeginYear' = 2004, 'BeginMonth' = 4, 'BeginDay' = 1, 'StartHour' = 16, 'StartMinute' = 55, 'TriggerType' = $scheduler-TASK_TIME_TRIGGER_DAILY, 'Type' = { 'DaysInterval' = 1, }, ); my $tsk = stuff1; $scheduler-NewWorkItem($tsk,\%trig); $scheduler-SetApplicationName(mspaint.exe); $scheduler-Save(); Any ideas appreciated. Thanx ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
stupid pattern match question
I'm not quite sure how to code this, (or search for a solution to) I want to search a text file, and replace a text string of the format $xxx. Example: I want to search for $sysname in a file, but I want to first assign that string to a perl variable. I've tried various combinations of escaping the $, but it is not working. so something like this: $target = $sysname; if (/$target/) { print found $sysname\n; } however, if I do this, it works. if /\$sysname/ { print found $sysname\n; } Thanks. Chris ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
OLE/Excel graphing problem
I've been playing with some code to populate an excel spreadsheet (office 2k) with data, produce a graph, and export it as a gif. I've been trying to figure out how to turn off the x-axis on the resulting graph, and haven't been having any luck. I created a macro in excel, looked at the resulting code, and I think this is the code that is turning off the x-axis: With ActiveChart .HasAxis(xlCategory, xlPrimary) = False .HasAxis(xlValue, xlPrimary) = True End With so I tried converting this perl as follows: (questionable line indicated by ) my $chart = $excel-Charts-Add; $chart-{ChartType} = xlAreaStacked; $chart-SetSourceData( {Source = $range, PlotBy = xlColumns} ); $chart-{HasTitle} = 1; $chart-ChartTitle-{Text} = This is a test graph, only a test; $sheet = $book-Charts(1); $sheet-{Name} = chris; $sheet-HasAxis-(xlCategory,xlPrimary) = 0; gives me: Can't modify non-lvalue subroutine call at chart2.pl line 40. Any suggestions appreciated. Thanks. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: OLE/Excel graphing problem
oops, sorry, thought I did... $sheet-HasAxis-(xlCategory,xlPrimary) = 0; line 40 but anyway, I found an answer to my problem. Instead of the above line, I used $chart-Axes(xlCategory)-{TickLabelPosition} = xlNone; Carl Jolley [EMAIL PROTECTED] To: [EMAIL PROTECTED] et cc: [EMAIL PROTECTED] Subject: Re: OLE/Excel graphing problem 12/02/2002 04:40 PM On Mon, 2 Dec 2002 [EMAIL PROTECTED] wrote: I've been playing with some code to populate an excel spreadsheet (office 2k) with data, produce a graph, and export it as a gif. I've been trying to figure out how to turn off the x-axis on the resulting graph, and haven't been having any luck. I created a macro in excel, looked at the resulting code, and I think this is the code that is turning off the x-axis: With ActiveChart .HasAxis(xlCategory, xlPrimary) = False .HasAxis(xlValue, xlPrimary) = True End With so I tried converting this perl as follows: (questionable line indicated by ) my $chart = $excel-Charts-Add; $chart-{ChartType} = xlAreaStacked; $chart-SetSourceData( {Source = $range, PlotBy = xlColumns} ); $chart-{HasTitle} = 1; $chart-ChartTitle-{Text} = This is a test graph, only a test; $sheet = $book-Charts(1); $sheet-{Name} = chris; $sheet-HasAxis-(xlCategory,xlPrimary) = 0; gives me: Can't modify non-lvalue subroutine call at chart2.pl line 40. Any suggestions appreciated. I suggest that you tell us all what line 40 of chart2.pl is. [EMAIL PROTECTED] Carl Jolley All opinions are my own and not necessarily those of my employer ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: problem trapping command output
Thanks guys. Thats what I was after. Maybe this is a stupid question, but I'll ask it anyway... Is there some way of telling when an application is sending output to STDERR and not STDOUT? Is it just a case of try STDERR if nothing on STDOUT? rotaiv [EMAIL PROTECTED] Sent by: To: [EMAIL PROTECTED] [EMAIL PROTECTED]cc: eState.com Subject: Re: problem trapping command output 06/28/2001 07:57 AM For a quick answer, see below (taken from Perl Cookbook 16.7. Reading STDERR from a Program): @result = `c:\\gzip\\gzip.exe -d c:\\gzip\\readme.gz 21`; foreach $line(@result) { print the output of the command is $line; } (Note: I dropped the '\n' on the print line as the output usually has it's own line feeds). For a more detailed explanation, see below: Each program has the capability of generating output to STDOUT and STDERR. By default, when you redirect output, you will only get STDOUT. The version of gzip that I use sends errors messages to STDERR and not STDOUT. Therefore, to capture STDERR on NT, you need to use the '2' redirection command. NT also allows you to use the '1' parameter to tell the second redirect command to send the output where ever the first redirect command is sending it's output. For example, to log all output from gzip to a log file, you would use the following: gzip.exe -d readme.gz logfile.txt 21 This tells NT to send STDOUT to logfile.txt and send STDERR to where ever STDOUT is going (which in this case would also be logfile.txt). Naturally, UNIX shells have the same capability but the syntax changes depending on what shell you are using. rotaiv At 06/27/2001 03:33 PM, [EMAIL PROTECTED] wrote: Hi, running winnt/2k AS perl build 623 I've been ftp'ing files across a wan link, and unzipping them with gzip. Occasionally, the file gets corrupted. I wanted to add some error checking to my script to not try to process the file if gzip could not unzip it, for whatever reason. so I tried doing something like this: @result = `c:\\gzip\\gzip.exe -d c:\\gzip\\readme.gz`; foreach $line(@result) { print the output of the command is $line\n; } now readme.gz is a file I intentionally corrupted(to get output from gzip). The output of gzip run against this file from the cmd line is: gzip: c:\gzip\readme.gz: invalid compressed data--crc error but the above code fragment produces no output. I would have expected the print statement in the above code fragment to be executed. Any clues appreciated. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users