BookmarkSubscribe
Choose Language Hide Translation Bar
Highlighted
geoff1
Occasional Contributor

Add multiple Gifs files to report

Hello,

I have a few different script running to monitor different data from different tables.

All charts are saved as GIF files under C:\Customer\Data.

I want to create a ppt with one GIF file per slide, with title slide = Gif file name.

 

The script below is working OK to create a ppt with only 3 GIFs.

 

 

NewReport= new window("New report",
       V List Box(
       Outline box(
       "Gif1",
       Picture Box( Open("C:\Customer\Data\Gif1.gif", gif ));
       ),
       Outline box(
       "Gif2",
       Picture Box( Open("C:\Customer\Data\Gif2.gif", gif ));
       ),
       Outline box(
       "Gif3",
       Picture Box( Open("C:\Customer\Data\Gif3.gif", gif ));
       ),
      ););
NewReport << Save Presentation( "C:\Customer\Report\NewReport.pptx", Insert(2), "GIF" );

 

 

I modified the script below to add all Gifs files from the data folder but it doesn’t work.

 

 

mypath =("C:\Customer\Data\");
FileName = Files in Directory(mypath);
NewReport= new window("New report",
       V List Box(
       For (i=1, i<=N items(FileName), i++,
       Outline box(
       ""||FileName[i]||"",
       Picture Box( Open("C:\Customer\Data\"||FileName[i]||"", gif )),
       ),
       );    
););
NewReport << Save Presentation( "C:\Customer\Report\NewReport.pptx", Insert(2), "GIF" );

 

 

Thanks for your help

 

Geof

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
wjlevin
Community Trekker

Re: Add multiple Gifs files to report

I can never really write scripts without actually trying them out - so I mocked up your situation using JMP on the Mac - so this is going to be a bit different but I think you can translate to Windows.

 

 

current_directory = convert file path (".");
FileName = Files in Directory (Current_directory||"Pictures");
OB_Expr = Expr(
Outline Box( "" || dv_FileName || "", Picture Box( Open( current_directory||"pictures/" || dv_FileName || "", jpg ) ), )
);

NewReport = New Window( "New report" );

For( i = 1, i <= N Items( FileName ), i++,
NewReport << append( eval(Substitute( Name Expr( OB_Expr ), Expr( dv_filename ), FileName[i] ) ))
);

NewReport << Save Presentation( "C:\Customer\Report\NewReport.pptx", Insert( 2 ), "GIF" );

 

 

3 REPLIES 3
wjlevin
Community Trekker

Re: Add multiple Gifs files to report

Geoff - for one thing - you have a couple of extra commas in the script that aren't needed - but I'm not sure if that's a problem.

 

Just looking at this - I'd set up the New Window like this:

 

NewReport = New Window( "New report");

 

Put the loop on its own and use append - something like

NewReport << Append ( Picture Box( Open( "C:\Customer\Data\" || FileName[i] || "", gif ) )

 

Now that's missing the OutlineBox - so you'd have to get a little more complicated to accomodate that by using an Expr(). - are you familiar with that?

 

I can write something out for you if you'd like. 

wjlevin
Community Trekker

Re: Add multiple Gifs files to report

I can never really write scripts without actually trying them out - so I mocked up your situation using JMP on the Mac - so this is going to be a bit different but I think you can translate to Windows.

 

 

current_directory = convert file path (".");
FileName = Files in Directory (Current_directory||"Pictures");
OB_Expr = Expr(
Outline Box( "" || dv_FileName || "", Picture Box( Open( current_directory||"pictures/" || dv_FileName || "", jpg ) ), )
);

NewReport = New Window( "New report" );

For( i = 1, i <= N Items( FileName ), i++,
NewReport << append( eval(Substitute( Name Expr( OB_Expr ), Expr( dv_filename ), FileName[i] ) ))
);

NewReport << Save Presentation( "C:\Customer\Report\NewReport.pptx", Insert( 2 ), "GIF" );

 

 

geoff1
Occasional Contributor

Re: Add multiple Gifs files to report

Works fine !
Thank You

Not the same subjetct, but any setting to make the picture as big as possible on the ppt slide without changing the proportions ? Automatic fit ?
0 Kudos