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
trailboss
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,

Tom

AZSun
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
WORKAROUND
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,

AZSun
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;
	type="text/html";
	boundary="----=_ANY_SEPARATOR"

This is a multi-part message in MIME format.

------=_ANY_SEPARATOR
Content-Type: text/html;
	charset="iso-8859-1"
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>
<BODY>
<p></P>
<!-- 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
</BODY></HTML>

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

R0lGODlhdQAgAPcAAP//////zP//mf//Zv//M///AP/M///MzP/Mmf/MZv/MM//MAP+Z//+ZzP+Z
mf+ZZv+ZM/+ZAP9m//9mzP9mmf9mZv9mM/9mAP8z//8zzP8zmf8zZv8zM/8zAP8A//8AzP8Amf8A
Zv8AM/8AAMz//8z/zMz/mcz/Zsz/M8z/AMzM/8zMzMzMmczMZszMM8zMAMyZ/8yZzMyZmcyZZsyZ
M8yZAMxm/8xmzMxmmcxmZsxmM8xmAMwz/8wzzMwzmcwzZswzM8wzAMwA/8wAzMwAmcwAZswAM8wA
AJn//5n/zJn/mZn/Zpn/M5n/AJnM/5nMzJnMmZnMZpnMM5nMAJmZ/5mZzJmZmZmZZpmZM5mZAJlm
/5lmzJlmmZlmZplmM5lmAJkz/5kzzJkzmZkzZpkzM5kzAJkA/5kAzJkAmZkAZpkAM5kAAGb//2b/
zGb/mWb/Zmb/M2b/AGbM/2bMzGbMmWbMZmbMM2bMAGaZ/2aZzGaZmWaZZmaZM2aZAGZm/2ZmzGZm
mWZmZmZmM2ZmAGYz/2YzzGYzmWYzZmYzM2YzAGYA/2YAzGYAmWYAZmYAM2YAADP//zP/zDP/mTP/
ZjP/MzP/ADPM/zPMzDPMmTPMZjPMMzPMADOZ/zOZzDOZmTOZZjOZMzOZADNm/zNmzDNmmTNmZjNm
MzNmADMz/zMzzDMzmTMzZjMzMzMzADMA/zMAzDMAmTMAZjMAMzMAAAD//wD/zAD/mQD/ZgD/MwD/
AADM/wDMzADMmQDMZgDMMwDMAACZ/wCZzACZmQCZZgCZMwCZAABm/wBmzABmmQBmZgBmMwBmAAAz
/wAzzAAzmQAzZgAzMwAzAAAA/wAAzAAAmQAAZgAAM+4AAN0AALsAAKoAAIgAAHcAAFUAAEQAACIA
ABEAAADuAADdAAC7AACqAACIAAB3AABVAABEAAAiAAARAAAA7gAA3QAAuwAAqgAAiAAAdwAAVQAA
RAAAIgAAEe7u7t3d3bu7u6qqqoiIiHd3d1VVVURERCIiIhEREQAAACH5BAAAAAAALAAAAAB1ACAA
QAj/AP8JHEiwoMGDCBMqXMiwocOGIyJKnEixosWLGDNq3MixY0aBFKuJrBZypMiIJ0ekrLhSpUmS
KEdObMkSpsuYOG/qTMnzJUWQHoMKHUq0KEagRpMqXaoUaU6dG2lKlOqRKtOkTq9q3VrV5sd/XMOK
ZZp1rNmzGsuiXct2hNq2cMVmXdkzZ12LLe/ehYrXpsy/MPUGHvw04lzCdhFbzasYMd+aUxsnnrzT
q1uwcTN3tVrxrebPWDGDHr3UM+nTHE2jXn1RNevXEl3Dfi179urDJrte5BzVcknNhyNHZiyzJnGv
uWMuppu7uHLkyV1Kxe1ccOGZ0Cn/xshcu8/K2g2LQ8bJGPJj4eh3+/WNHb118PAtBn8aXTrn6s7t
l2QP9b399fhNN55tbe31FYEITlRbgqAtyCBwAz5I20MUVmjhhRgyFBAA

------=_ANY_SEPARATOR--
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/
http://www.chilkatsoft.com/p/p_73.asp

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”