RE: STDIN Timeout
And here we go, Told you it was silly :-) -Original Message- From: C. Church [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 6:21 PM To: [EMAIL PROTECTED] Subject: Re: STDIN Timeout Here's some silly code that does the Job. LINE: while (STDIN){ print $_; for ($i=1; $i1000; $i++){} last LINE if $i==1000; } I'm not sure what this is intended to do... But what it actually does is read the input (one line), print it out, and wait some arbitrary amount of clock cycles before no longer accepting input. It doesn't, in any way, timeout the user if they don't input text in some amount of time. It could've been more easily, and clearly written as: while() { print; sleep(5); last; } Which is what it does, just with a specified sleep period, instead of an arbitrary amount of clock cycles. Now, if you wanted to tiemout the user, and you had no alarm() function, you might try something like this: # unbuffer stdout $| = 1; # for small sleeps (to avoid hampering input) use Time::HiRes qw( sleep ); use Term::ReadKey; print foo: ; my $count = 0; # this is our timeout counter... my $max_count = 60; # 30 half-seconds my $complete_input = ''; # loop forever (not really) while(1) { if($count == $max_count) { print(\nERROR: Input timed out!\n); last; } # non-blocking 'getc' my $input = ReadKey(-1); if(!defined($input) || !length($input)) { # got no input from ReadKey() $count++; sleep(0.5); # half a second next; } else { # got input! # ReadKey will be non-blocking, and will not print print($input); $count = 0; # reset timer $complete_input .= $input; # look for an entered newline if($complete_input =~ /\r|\n/) { print(\nComplete input is: $complete_input\n); last; } } } That definately works on win2k w/ 5.6.1 build 632. No need for a seperate thread, or an alarm =) !c === Discreet Packaging: www.dronecolony.com C. Church === ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Disclaimer - Winterthur Europe Assurances - Avenue des Arts/Kunstlaan 56 - 1000 Brussels - Belgium. This e-mail is intended solely for the above-mentioned recipient and it may contain confidential or privileged information. If you have received it in error, please notify the sender immediately and delete the e-mail. You must not copy, distribute, disclose or take any action in reliance on it. This e-mail message and any attached files have been scanned for the presence of computer viruses. However, you are advised that you open any attachments at your own risk. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Interrupt Trapping?
Mundell, R. (Ronald) wrote: Good Day All How does one trap interrupts? Under shell scripting one have the trap command available. I am looking to catch the Ctrl-C keystrokes. $SIG{'INT'} = \handler; sub handler { print Caught a SIG '$_[0]' - shutting down\n; exit 0; } -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Removing HTML tags
That's a new suggestion! Thank you. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stephen Patterson Sent: Wednesday, November 19, 2003 2:35 PM To: [EMAIL PROTECTED] Subject: Re: Removing HTML tags Craig Cardimon wrote: I'm calling the following modules that I have installed: use HTML::TreeBuilder; use HTML::FormatText 2; This is how I'm using the modules (basically straight from Perl Cookbook (Second Edition), page 802): $plain_text = HTML::FormatText-format_string($html_text); This code does not appear to function well, however, on tags spanning more than one line. How should I go about fixing this? The best way I've found of doing this in the past has been to use SGML::StripParser from CPAN, rather than any of the HTML::xx modules. ___ 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
Capture external command output line by line on Windows 98
Hello, I'm trying to Capture external command output and error line by line. I wrote this example witch work excellent on Windows 2000: open(PROC,DIR 21 |); while(PROC) { print (LINE:$_); } close(PROC); But on Windows 98 it don't do nothing! I'm user perl 5.6.1 activestate 625. I need to display the output line by line and not all at once so I can't use system command. How can I implement it on windows 98 ? Rami ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Excel stuff.
Currently I'm using Spreadsheet::WriteExcel. I am trying to work out how to do the following... 1. Merge cells. 2. Make all columns AutoFit, after the data has been entered. 3. Freeze panes. I don't use Spreadsheet::WriteExcel but if you can use Win32::OLE then this should help. use Win32::OLE; use Win32::OLE::Variant; my $vtfalse = Variant(VT_BOOL, 0); my $vttrue = Variant(VT_BOOL, 1); my $vtpages = Variant(VT_I4, 1); $Excel = Win32::OLE-GetActiveObject('Excel.Application') || Win32::OLE-new('Excel.Application'); $Excel-{'Visible'} = 1;#0 is hidden, 1 is visible $Excel-{SheetsInNewWorkBook} = 1; $Book = $Excel-Workbooks-Add(); $Sheet = $Book-Worksheets(1); $Sheet-{Name} = 'My test worksheet'; $Sheet-Range('a1')-{Value} = 'A1'; $Sheet-Range('b2')-{Value} = 'B2'; my @columnheaders = qw(A:B); foreach my $range(@columnheaders){ $Sheet-Columns($range)-AutoFit(); } $mynextcol = 'b'; for (my $n=1;$n5;$n+=2){ my $range = $mynextcol++ . '1:' . $mynextcol++ . '1'; $Sheet-Range($range)-Merge(); $Sheet-Range($range)-{HorizontalAlignment} = xlHAlignCenter; } #$Sheet-Range('b3')-Select(); # cell #$Sheet-Range('b:b')-Select(); # column $Sheet-Range('3:3')-Select(); # row $Excel-ActiveWindow-{FreezePanes} = $vttrue; -- Nathaniel G. Bartusiak TTMS, Keesler AFB ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Excel stuff.
Nathaniel, I also use the OLE and I think you showed me how to freeze panes long ago. Anyways, the problem that I ran into using that command was: If the pane has already been frozen when you execute the same command, you get fatal error. So, do you know of a way to wrap a test around the freeze? Sorry for digressing out a little Matt Ross Configuration Management ePIMS Wk: 817.245.6540 2 way pager: 888.468.0815 E-mail: [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 8:25 AM To: [EMAIL PROTECTED] Subject: Re: Excel stuff. Currently I'm using Spreadsheet::WriteExcel. I am trying to work out how to do the following... 1. Merge cells. 2. Make all columns AutoFit, after the data has been entered. 3. Freeze panes. I don't use Spreadsheet::WriteExcel but if you can use Win32::OLE then this should help. use Win32::OLE; use Win32::OLE::Variant; my $vtfalse = Variant(VT_BOOL, 0); my $vttrue = Variant(VT_BOOL, 1); my $vtpages = Variant(VT_I4, 1); $Excel = Win32::OLE-GetActiveObject('Excel.Application') || Win32::OLE-new('Excel.Application'); $Excel-{'Visible'} = 1;#0 is hidden, 1 is visible $Excel-{SheetsInNewWorkBook} = 1; $Book = $Excel-Workbooks-Add(); $Sheet = $Book-Worksheets(1); $Sheet-{Name} = 'My test worksheet'; $Sheet-Range('a1')-{Value} = 'A1'; $Sheet-Range('b2')-{Value} = 'B2'; my @columnheaders = qw(A:B); foreach my $range(@columnheaders){ $Sheet-Columns($range)-AutoFit(); } $mynextcol = 'b'; for (my $n=1;$n5;$n+=2){ my $range = $mynextcol++ . '1:' . $mynextcol++ . '1'; $Sheet-Range($range)-Merge(); $Sheet-Range($range)-{HorizontalAlignment} = xlHAlignCenter; } #$Sheet-Range('b3')-Select(); # cell #$Sheet-Range('b:b')-Select(); # column $Sheet-Range('3:3')-Select(); # row $Excel-ActiveWindow-{FreezePanes} = $vttrue; -- Nathaniel G. Bartusiak TTMS, Keesler AFB ___ 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
Re: Capture external command output line by line on Windows 98
Rami Addady wrote: Hello, I'm trying to Capture external command output and error line by line. I wrote this example witch work excellent on Windows 2000: open(PROC,DIR 21 |); while(PROC) { print (LINE:$_); } close(PROC); But on Windows 98 it don't do nothing! I'm user perl 5.6.1 activestate 625. I need to display the output line by line and not all at once so I can't use system command. How can I implement it on windows 98 ? Either get cmd.exe which can handle 21 or use a Perl equivalent of dir instead of shelling out. There is a cmd.exe on my Tripod site for 9x. -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
What about Win32-MAPI?
Hi all, Does anybody know anything about Win32-MAPI? I can not find this module anywhere. Is there any 'known substitute'? I was trying to fetch Outlook messages from Perl. I did it with this module in the past and was pretty simple. Many thanks in advance Guillermo *** The contents of this Email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this Email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. If you have received this mail in error please Email the sender. *** RS Components Ltd. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Capture external command output line by line on Windows 98
Either get cmd.exe which can handle 21 I did't find any cmd.exe that feed me the output line by line and not all at once. Can you recommand some thing ? or use a Perl equivalent of dir instead of shelling out. DIR was just for the example. The input command will vary. Regards, Rami - Original Message - From: $Bill Luebkert [EMAIL PROTECTED] To: Rami Addady [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, November 20, 2003 5:36 PM Subject: Re: Capture external command output line by line on Windows 98 Rami Addady wrote: Hello, I'm trying to Capture external command output and error line by line. I wrote this example witch work excellent on Windows 2000: open(PROC,DIR 21 |); while(PROC) { print (LINE:$_); } close(PROC); But on Windows 98 it don't do nothing! I'm user perl 5.6.1 activestate 625. I need to display the output line by line and not all at once so I can't use system command. How can I implement it on windows 98 ? Either get cmd.exe which can handle 21 or use a Perl equivalent of dir instead of shelling out. There is a cmd.exe on my Tripod site for 9x. -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /-- o // // Castle of Medieval Myth Magic http://www.todbe.com/ -/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: What about Win32-MAPI?
I have been looking for it too, but no luck. The author seems to have dropped off the Earth, he doesn't reply to any mails and his site is down. The module is not available from CPAN either... You can use Win32-OLE to access the MAPI object model, but this is kludgy at best. I have made some attempts, but for what I need to do, it's just too messy. If you want an example, I can send you some of my test scripts off list. Anyways, if someone else has this module and can share it (put it in some web space or something) or if someone knows of a mirror of the author`s site, that would be great. Sorry I can't be of more help, J-S -Message d'origine- De: Guillermo Lopez [mailto:[EMAIL PROTECTED] Date: 20 novembre, 2003 10:51 À: '[EMAIL PROTECTED]' Objet: What about Win32-MAPI? Hi all, Does anybody know anything about Win32-MAPI? I can not find this module anywhere. Is there any 'known substitute'? I was trying to fetch Outlook messages from Perl. I did it with this module in the past and was pretty simple. Many thanks in advance Guillermo *** The contents of this Email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this Email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. If you have received this mail in error please Email the sender. *** RS Components Ltd. ___ 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
RE: What about Win32-MAPI?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Guillermo Lopez Sent: Thursday, November 20, 2003 10:51 AM To: '[EMAIL PROTECTED]' Subject: What about Win32-MAPI? Hi all, Does anybody know anything about Win32-MAPI? I can not find this module anywhere. Is there any 'known substitute'? I was trying to fetch Outlook messages from Perl. I did it with this module in the past and was pretty simple. Many thanks in advance Guillermo Take a look at MAPI in: http://aspn.activestate.com/ASPN/docs/ActivePerl/faq/Windows/ActivePerl-Winfaq9.html HTH - Lynn. ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
evt logs
I backup Eventlogs everydaybut it is saved as an Evt file (have to). Is there a way or method to read this evt file so it diplays in txt format?. Thanks Do you Yahoo!? Free Pop-Up Blocker - Get it now
RE: Excel stuff.
Nathaniel, I also use the OLE and I think you showed me how to freeze panes long ago. Anyways, the problem that I ran into using that command was: If the pane has already been frozen when you execute the same command, you get fatal error. So, do you know of a way to wrap a test around the freeze? Thanks for the info, I didn't know about that problem. If you really want to test it then use an eval and check $@, its like a try-catch in Java. Or if you just want to set the freeze, all you have to do is unfreeze the sheet first. use Win32::OLE::Variant; my $vtfalse = Variant(VT_BOOL, 0); my $vttrue = Variant(VT_BOOL, 1); ... $Sheet-Range('3:3')-Select(); # row $Excel-ActiveWindow-{FreezePanes} = $vttrue; #unfreeze $Excel-ActiveWindow-{FreezePanes} = $vtfalse; $Sheet-Range('4:4')-Select(); # row $Excel-ActiveWindow-{FreezePanes} = $vttrue; -- Nathaniel G. Bartusiak TTMS, Keesler AFB ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Excel stuff.
Hi Nathaniel, Thanks for that, it's very helpful. I'm now trying to switch from Spreadsheet::WriteExcel, to Win32::OLE. The biggest problem I seem to have now is translating this command: my $temp = [EMAIL PROTECTED]; $page}-write_row($row, 5, $temp); Can you help? I don't know if this does everything that write_row does but it will write an array in some cells. @row = ('x','y','z'); $Sheet-Range('d3:f3')-{Value} = [EMAIL PROTECTED]; -- Nathaniel G. Bartusiak TTMS, Keesler AFB ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs