Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Win32 - M$ Outlook and Perl.

by Mr. Muskrat (Canon)
on May 06, 2002 at 20:59 UTC ( #164449=note: print w/replies, xml ) Need Help??

in reply to Win32 - M$ Outlook and Perl.


Anytime I am trying to use perl and OLE to access M$ products, I start by creating a macro that does exactly what I want the perl program to do. Then I start translating the macro into perl. I've been considering creating a translator but I just never seem to have the time. Most of the work of translating it can be done with some regular expressions. It's the odd situations that the translator is actually required for.
For example, I wanted to setup my page for printing and I created a macro to do it. Here is a small snippet of that macro:

With ActiveSheet.PageSetup .PrintTitleRows = "$1:$2" .PrintTitleColumns = "" .PrintArea = "$B:$I" End With
So I save that little snippet in a file called mymacro.txt. And then I run this code on it:
my $pl = ""; open(TXT, "<mymacro.txt"); while (<TXT>) { s/\./->/; s/=/=>/; s/"/'/g; s/\s+End With/);/; s/\s+With (\w+)->(\w+)/\$Range = \$$1->$2;\nwith (\$Range/i; s/(.*[^;])\n/$1,\n/; $pl .= $_; } close(TXT); open(TXT, ">"); print TXT $pl; close(TXT);
and the contents of are:
$Range = $ActiveSheet->PageSetup; with ($Range, PrintTitleRows => '$1:$2', PrintTitleColumns => '', PrintArea => '$B:$I', );
Not all macros will translate this easily though.

Matthew Musgrove
Who says that programmers can't work in the Marketing Department?
Or is that who says that Marketing people can't program?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://164449]
[Corion]: Oof - "Anyway, if it is not obvious, please keep this discussion entirely confidential for now.", as seen on a public mailing list ;)
[Discipulus]: uh no choroba.. i do not practice much with online putyour image sites:can you suggest one (that possibly remove the pic after few days)?
[choroba]: Corion a bug report?
[choroba]: I have no idea :-( I used to post to, but they don't seem to feature "private" pictures in the free version now
[Discipulus]: dazz i'm not an experts but i think it would be possible
[Corion]: dazz: I think Image::Magick can "read" from an in-memory filehandle
[Corion]: choroba: No, some general admin discussion of how to handle (company) user accounts
[Discipulus]: might be it is necessary to pass the pic data like MIME::Base64:: encode( data..

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2017-03-27 07:50 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (317 votes). Check out past polls.