PPT2HTML "hooks" to external applications
There's simply no way we can add all the features our PPT2HTML users would like us to.
We do our best to add often-requested features, but we also let you add your own new features with PPT2HTML's "hooks".
Hooks let you tell PPT2HTML to run programs at several points while PPT2HTML is converting your PPT files to HTML. You can choose to run external programs and batch files:
- Just before PPT2HTML reads the html template file
- Just before PPT2HTML starts to generate HTML for a presentation
- Just before PPT2HTML generates HTML for each slide in the presentation
- Just after PPT2HTML has generated HTML for each slide
- After all HTML and image files have been generated and saved for the presentation
You trigger actions at these "hook points" by adding special commands to the PPTools.INI file in the [PPT2HTML] section:
; command to run just before PPT2HTML reads the template file HookPreTemplate= [commands] ; command to run just before PPT2HTML starts generating HTML for the presentation HookPreHTML= [commands] ; command to run before PPT2HTML starts generating HTML/Images for each slide HookPreSlide= [commands] ; command to run after PPT2HML has generated HTML/images for each slide HookPostSlide= [commands] ; command to run when PPT2HTML has finished generating HTML/images for the entire presentation or range HookPostHTML= [commands]
HookPreTemplate might be useful if you want to do some processing on the template itself before using it to create HTML.
If you need to do any batch processing of either HTML or images, we suggest (STRONGLY) that you use HookPostHTML rather than HookPostSlide; otherwise the process you set off may not finish before PPT2HTML calls it again when the next slide HTML is created. Use HookPostSlide and HookPreSlide only when there's no other way to solve a problem.
The ability to run a particular program is useful, but it's a lot better when you can specify a file or files for the program to work with, input and/or output folders and so on. PPT2HTML lets you pass the names of files and folders it's using off to the external programs you hook into.
For example, suppose you want to perform some type of image processing on all the images generated by PPT2HTML.
Add this to your PPTools.INI file, [PPT2HTML] section:
HookPostHTML=c:\some\folder\programname.exe %idrive:%idir%basename*.%iext /x /y /z
where:
c:\some\folder\programname.exe is the full path to the program that'll the image processing
%idrive is the drive where PPT2HTML has created images
%idir is the path to the folder on that drive
%basename is the base name you chose for your image and html files
%iext is the jpg, png or other extension of the image files
/x /y /z are parameters that tell the program what to do with the images
So if you choose MyFile as the base name, opted for PNG images and output everything to C:\MyHTML\, the command above would turn into:
c:\some\folder\programname.exe C:\MyHTML\MyFile*.PNG /x /y /z
when PPT2HTML executes it (which happens after it's generated all the HTML and images for your presentation).
NOTE: IrfanView is a great image processing/viewing program that not only offers plenty of command line options but is free. For example, you can use this to resample all of the JPG files in c:\MyFiles to 500x300 PNGs in d:\Temp:
i_view32.exe c:\myfies\*.jpg /resample=(500,300) /convert=d:\temp\*.png
To use something like this to resample all images to 640x480, overwriting the originals with the new ones, you could put this in your PPTools.INI file:
HookPostHTML=c:\folder\i_view32.exe %idrive%idir%iname%iext /resample=(640,480) /convert=%idrive%idir%iname%iext
Note that when used in HookPostHTML, the name parameters are treated as wildcards: Name* rather than Name001
There are lots more of these "replaceable parameters" ( things that look like %this ) you can use:
Type | Parameter | Example | Replaced with |
PPT file | %sfullname | C:\My Documents\MyFile.PPT | Fully pathed name of presentation PPT2HTML is currently converting |
%sdrive | C: | Drive letter portion of full presentation path | |
%sdir | \My Documents\ | Directory portion of full presentation path, including backslashes | |
%sname | MyFile | Presentation file name w/o extension | |
%sext | PPT | Extension part of presentation name | |
HTML file | %hfullname | C:\OutputFolder\Slide001.htm | Fully pathed name of current HTML file |
%hdrive | C: | Drive letter portion of full HTML file path | |
%hdir | \OutputFolder\ | Directory portion of full HTML file path, including backslashes | |
%hname | Slide001 | HTML file name w/o extension | |
%hext | htm | Extension part of HTML file name | |
Image file | %ifullname | C:\OutputFolder\Slide001.jpg | Fully pathed name of current image file |
%idrive | C: | Drive letter portion of full image file path | |
%idir | \OutputFolder\ | Directory portion of full image file path, including backslashes | |
%iname | Slide001 | Image file name w/o extension (note that this is the same as the HTML file name w/o extension) | |
%iext | jpg | Extension part of image file name | |
%iheight | 600 | Height of image in pixels | |
%iwidth | 800 | Width of image in pixels | |
Template file | %tfullname | C:\Users\MyName\Appdata\Roaming\Microsoft\Basic.htm | Fully pathed name of current template file |
%tdrive | C: | Drive letter portion of full template file path | |
%tdir | \Program Files\RnR\PPToolsV2\ | Directory portion of full template file path, including backslashes | |
%tname | Basic | Template file name w/o extension | |
%text | htm | Extension part of template file name | |
Misc | %basename | Slide | Basename from Preferences dialog (the "Slide" in "Slide001.htm" etc.) |
%outputfolder | \OutputFolder\ | Output folder | |
%odrive | C: | Output drive | |
%pptoolsfolder | C:\Program Files\RnR\PPToolsV2\ | PPTools Folder | |
%stitle | Slide title or Slide+slide number if no title | Slide title/Slide+SlideNumber | |
%num | Ordinal number of the slide being converted | 42 | |
%quot | Quote mark | " | |
%crlf | Carriage return/LineFeed pair | ||
%cr | Carriage return | ||
%lf | LineFeed pair |
Some of these values are undefined at certain hook points during the conversion process. For example, until PPT2HTML has begun converting Slide 1 to HTML, it can't supply valid values for the HTML or Image file replacement parameters that change from slide to slide (name and fullname) but it can supply those that don't change from one slide to the next: (drive, directory and extension).
The PPT file and Template file parameters are all valid at any hook point.
[Previous] [Home] [Next]