Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

win32::ole ppt regexp

by lhoffmeyer (Initiate)
on Jan 09, 2003 at 20:24 UTC ( #225632=perlquestion: print w/ replies, xml ) Need Help??
lhoffmeyer has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to find a way to regexp ppt textboxes in a slide? I am trying this snippit although it does not work. $shape and $p2 are defined and I am using them for other things
foreach my $shape (in $p2->Slides(4)->Shapes()){ if ($shape->{Type}==18) {$shape~=/members\=[0-9]{2,3}/members\=$b4r4/;} }
I imagine there is something simple I have left out. Any suggestions?

Edit by dws to add <code> tags

Comment on win32::ole ppt regexp
Download Code
Replies are listed 'Best First'.
Re: win32::ole ppt regexp
by MZSanford (Curate) on Jan 10, 2003 at 16:48 UTC
    I don't have time at the moment to whip up a sample bit of code to make sure this is the problem, but i think you are trying to substitute member=(\d+) with members=$b4r4, which really does need a s/// ... maybe you skipped the leading s ? does running under -w produce any useful messages ?
    from the frivolous to the serious
      Yes, certainly I need the s///. Still doesn't work, though. It appears that no text is being captured to regexp. I changed script a bit but still is not working. No errors or messages but no output to print command either.
      foreach my $shape (in $p2->Slides(4)->Shapes()){ if ($shape->{Type}==18){ my $text = $shape->TextFrame->TextRange; print "$text \n"; $shape =~s/members\=[0-9]{2,3}/members\=$b4r4/; } }
        A few thoughts ...

        • The regexp should probably be run against $text, not $shape.
        • you should not need the in in your foreach loop
        • You said the print is printing nothing ... are you seeing the new lines ? (maybe nothing = 18 ?)
        • Last time i worked with Power Point (a month or so ago), i resorted to using perl -d, putting a break at a line similar to your foreach, and then using Data::Dumper to poke around for the text box i needed (which ended up being $Presentation->Slides(1)->Shapes->Title->TextFrame->TextRange->{Text})

        from the frivolous to the serious

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://225632]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (16)
As of 2015-07-29 16:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (265 votes), past polls