OLE Functions

2002-02-14 Thread Richard A. Evans
I have seen (and have written) perl code such as: use Win32::OLE; # use existing instance if Excel is already running eval {$ex = Win32::OLE->GetActiveObject('Excel.Application')}; die "Excel not installed" if $@; unless (defined $ex) { $ex = Win32::OLE->new('Excel.Application', su

RE: Moon phases in Perl

2002-02-14 Thread Richard A. Evans
> Any known moon calculator for the moon phases (moon calendar). Ideas appreciated. I've never used it, but you might look at Astro::Moonphase Regards, Rick ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveSt

RE: Regular expression

2001-07-03 Thread Richard A. Evans
Assuming this line is typical, here is a script which gives a couple of ways to approach the regex: $text = 'LOG_INFO : cpcdos22.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success.'; print "$1 \n" if $text =~ /\/(.+):/; print "$1 \n" if $text =~ /\/([^\/]+):/; Which outputs:

RE: what editor do you use?

2001-06-26 Thread Richard A. Evans
I use Multi-Edit. Without going into the myriad of features, I will say this: It has done whatever I need, regardless of what I'm editing. It handles Perl, Unix shell files, HTML, Java, JavaScript, DOS Batch files, and everything else I have *ever* edited. I've even used it to fix damaged Word

RE: Randomly selecting characters from a list

2001-06-25 Thread Richard A. Evans
Actually that's probably about as good as any other way. Quoting from the Perl Cookbook: "Making random numbers is hard." Also from the Perl Cookbook, here is a way to generate a 10 character string 'randomly': @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9 ); $password = join( "", @chars[ map { ra

RE: Find && Grep

2001-06-20 Thread Richard A. Evans
>> If I had a complex ANDed expression, I'd just hard code it in the >> subroutine. >> >> For something simple, such as the word TABLE followed somewhere by the word >> ALIGN, you could use: >> >> my $stringToFind = 'TABLE.+ALIGN'; >> >> >> Regards, >> >> Rick >Sure, if you wanted to match VEGE

RE: WIN ME, ActiveStaePerl and CGI

2001-06-20 Thread Richard A. Evans
David, You might check this link: http://dynamicnet.net/support/fp/perlwithPWS.htm It covers Microsoft Personal Web Server with perl. I had to adjust the paths in the registry, but otherwise it worked fine. Since the Registry mods are so easy, it's simple to test. Regards, Rick Evans

RE: Find && Grep

2001-06-14 Thread Richard A. Evans
I believe this snippet of code does what you ask. It finds all files containing a specific string Since it prints line number and filename as it goes, there is no need to store them, as you could capture the results. Regards, Rick Evans __BEGIN__ use strict;

RE: Deleting HTML files in a directory

2001-06-14 Thread Richard A. Evans
if ( opendir( DIR, '.' ) ) { my @htmlFiles = grep { /\.html?$/i } readdir(DIR); closedir( DIR ); print "Deleting the following file(s):\n "; print join "\n ", @htmlFiles; unlink @htmlFiles; } Works in current directory. You [c|sh]ould add an error check to the unlink.

RE: 'Reversing an array'

2001-06-11 Thread Richard A. Evans
> I have an array with value of 1-10. > What is the fastest way to 'reverse' the values to 10-1 (ie. 10 9 8 7 6 ...) Use reverse... @list = (1 .. 10); print join " ", @list, "\n"; @list = reverse @list; print join " ", @list, "\n"; ___ Perl-Win32-User