Putting a Graphic into a PowerPoint doc from within RunRev

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Posts: 112
Joined: Sat Dec 13, 2008 4:55 pm

Putting a Graphic into a PowerPoint doc from within RunRev

Post by trailboss » Mon Mar 18, 2013 12:54 am

I've used the following script to create a PowerPoint document containing text data that was arranged in RunRev.

How can I get RunRev to send, paste, (whatever) a GRAPHIC into a PowerPoint document in the same way and hopefully at the same time?

on mouseUp
open file specialFolderPath("desktop") & "/Data in a PowerPoint Document.ppt" for write
put cd fld "MyData" into localvariable
put localvariable into myText
write myText to file specialFolderPath("desktop") & "/Data in a PowerPoint Document.ppt"
close file specialFolderPath("desktop") & "/Data in a PowerPoint Document.ppt"
launch document specialFolderPath("desktop") & "/Data in a PowerPoint Document.ppt"
end mouseUp

Thanks very much,


Posts: 30
Joined: Tue Mar 20, 2012 10:44 pm

Re: Putting a Graphic into a PowerPoint doc from within RunR

Post by AZSun » Sat Sep 14, 2013 10:51 pm

Hi Tom,
I am very much a new user to LiveCode, but I think I have the rough framework of what you want to accomplish. I use the text-to-PowerPoint-trick often to convert outlines in MSWord to PowerPoint slides. I also have used the web creation tools with MSOffice. There used to be a Save as File => Single File Web Page option. It basically converted images to a mime text format (no separate folder for images). LiveCode is good at text manipulation so I think it should be able to do what you are asking. If it is using the base64 encoding, then that's in LiveCode too.

I then designed this test of concept:
I tried this example. I made a PowerPoint slide with text and an image (.jpg). I then converted it to a Single File Web Page with the extension .mht and then looked at it with notepad and saw the encoded stuff and checked there were no links to an image folder. Then I opened it with Powerpoint and it created the original slide again. As an aside, I tried changing the extension to the .ppt and then it would not open in PowerPoint. It had to have the .mht ending for PowerPoint to open it correctly. The picture in the slide looked good. I also could open it in a Web browser.

I did find this info for people with PowerPoint 2010
When you try to save a presentation as a webpage in Microsoft PowerPoint 2010, the following Save as type options are not available in the Save As dialog box:
Web Page (*.htm;*.html)
Single File Web Page (*.mht;*.mhtml)
Back to the top | Give Feedback
To work around this issue, you can save presentations as an .htm file or as an .mht file by using the PowerPoint object model. This method provides compatibility with older add-ins and macros.

You can also save a file as a webpage (*.htm;*.html) to the desktop without embedding True Type fonts (msoFalse) by using the ppSaveAsHTML argument for the *.htm file format. To do this, follow these steps:
In PowerPoint 2010, open the presentation that you want to export to HTML.
Press Alt+F11.
Press Ctrl+G.
In the Immediate pane, type the following, and then press Enter:
ActivePresentation.SaveAs "<Drive>:\users\<username>\desktop\<filename>.htm", ppSaveAsHTML, msoFalse

Note To save by using the Single File Web Page (*.mht;*.mhtml) file format, replace htm at the end of the file name with mht, and replace ppSaveAsHTML with ppSaveAsWebArchive.
That last line of the quote is the key... I think you should then be able to examine the text file and see how it is done.
Good luck,

Posts: 30
Joined: Tue Mar 20, 2012 10:44 pm

Re: Putting a Graphic into a PowerPoint doc from within RunR

Post by AZSun » Sun Sep 22, 2013 7:07 pm

Ok, here's a basic text template that puts an image into PowerPoint. I tried to make a small text file to act as a simple template. Thus, I did not mess with a PowerPoint .mht export. The text below if saved in notepad with a .mht extension can be opened in PowerPoint and the image will be displayed. This was a basic proof of concept. The base64 text is converted into an image in PowerPoint.

I believe formatting can all be done with html/css as that is what the PowerPoint exports look like they are doing. MHTML files are basically html and mime merged together and PowerPoint and many web browsers can read them.

Code: Select all

From: "Saved by Windows Internet Explorer 9 and notepad simplified a little"
Subject: Test IMAGE Red
Date: Sun, 22 Sep 2013 08:25:19 -0700
MIME-Version: 1.0
Content-Type: multipart/related;

This is a multi-part message in MIME format.

Content-Type: text/html;
Content-Transfer-Encoding: quoted-printable
Content-Location: mhtml:file://E:\mhtml-1.mht

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Test message no. 1</TITLE>
<META content=3D"text/html; charset=3Dwindows-1252" = http-equiv=3DContent-Type>
<META name=3DGENERATOR content=3D"MSHTML 9.00.8112.16476"></HEAD>
<!-- The path to the image needs to be in the src, but it uses the base64 encoded stuff below. -->
<!-- From what I understand, the path can be imaginary so long as it is used everywhere it is needed.-->
<!-- I left the partial image path here to credit where I got the test mhtml information. -->
<IMG border=3D0 alt=3D"red test = image"=20
src=3D"mhtml:file://E:\mhtml-1.mht!cid:image1.mhtml-1@dsv.su.se" = width=3D117=20 height=3D32>=20

Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-Location: cid:image1.mhtml-1@dsv.su.se


Here is the image test source and sites that helped.
http://people.dsv.su.se/~jpalme/ietf/mh ... mhtml.html
http://www.phpied.com/mhtml-when-you-ne ... and-under/

Thanks, now this has sparked an interest in figuring out base64 encoding and decoding. I'll have to check that out.
Hope this gets you started.

Post Reply

Return to “Multimedia”