Powerpoint

From AutoIt Wiki
Jump to navigation Jump to search

This page is still a work in progress.

The PowerPoint UDF offers basic functions to control and manipulate Microsoft PowerPoint.

Concepts

UDF

The PowerPoint UDF is based on the following concept:

  • _PPT_Open
  • Some functions allow to process just a single Slide and others allow a range of Slides.
    The the description of the specific function.
  • Some functions allow to process just a single Shape and others allow a range of Shapes.
    The the description of the specific function.
  • _PPT_Close

PowerPoint

Terms
  • An event is an activity that lasts 24 hours or longer.
  • An appointment is an activity that does not involve reserving resources or inviting other people.
  • A meeting is an appointment for which you reserve a period of time, invite people to, or reserve resources.

A more detailed description of this terms can be found here.

Concepts

You can get an overview of the concepts of PowerPoint on this website.

Events

PowerPoint provides a wide range of events through which it can notify your script that a significant change has occurred. For example, PowerPoint events can notify your script when you start a slide show..
To receive notification of a significant event, write an event-handler procedure. This is a function that PowerPoint calls when the event is called. The code you put in the event handler allows your program to respond appropriately to the event and, in some cases, even lets your program cancel the default action associated with the event.

Responding to Events
The following example (reduced to the minimum) shows how to handle events:

Global $oOL = _OL_Open()
Global $oTemp = ObjEvent($oOL, "oOL_") ; Create the application-level event handler 
While 1
	Sleep(10)
WEnd
Func oOL_NewMailEx($sEntryIDs)
	Local $iItemCount, $oItem
	Local $aEntryIDs = StringSplit($sEntryIDs, ",", $STR_NOCOUNT) ; multiple EntryIDs are separated by ,
	$iItemCount = UBound($aEntryIDs)
	ConsoleWrite("OutlookEX UDF Example Script - " & ($iItemCount = 1 ? "new item has" : "new items have") & " arrived!" & @CRLF & @CRLF)
	For $i = 0 To $iItemCount - 1
		$oItem = $oOL.Session.GetItemFromID($aEntryIDs[$i], Default) ; Translate the EntryID string to the item object
		ConsoleWrite("From:    " & $oItem.SenderName & @CRLF & "Subject: " & $oItem.Subject & @CRLF & "Class:   " & $oItem.Class & " (43=Mail, 53=MeetingRequest ...)" & @CRLF)
	Next
EndFunc

More examples come with the UDF.

Object model

The Outlook object model is described here.

Folders

It does not matter where an item is stored. You can access any folder and get/create/modify items there.

Folders you can access:

Syntax Folder you access
"rootfolder\subfolder\...\subfolder" any public folder or any folder of the current user (replace rootfolder with * to access the root folder of your mailbox)
"\\rootfolder" default folder of another user (class specified by $iOL_FolderType) (replace "rootfolder" with "*" to access your mailbox)
"\\rootfolder\\subfolder\...\subfolder" subfolder of the default folder of another user (class specified by $iOL_FolderType)
"\\rootfolder\subfolder\..\subfolder" subfolder of another user
"" default folder of the current user (class specified by $iOL_FolderType)
"\subfolder" subfolder of the default folder of the current user (class specified by $iOL_FolderType)

Note: You need to use different formats to access public folders and the mailbox of other users!

"rootfolder" is one of the following:

  • Mailbox name, e.g. "John.Doe@company.com"
  • Display name, e.g. "John Doe"

For details please see the item specific section below.

Search folders

As of January 2018 the UDF supports Search Folders as well. Please have a look at functions _OL_SearchFolder*.

Naming pattern

If a method can be used for more than one item type (e.g. mail, calendar and notes) the function is called _OL_ItemXXX else the function is named like the item type e.g. _OL_CalendarXXX

Example Scripts

For single functions

Every function of the UDF comes with an example script (except internal functions). The example script is named like the function.

Extended Examples

Example scripts which describe more than a single function of the UDF are prefixed with _PPT_Example_.

Function specific pages

The following pages contain information for the functions that can be used for many different item types.

Find an Item

Further information on how to find items: OutlookEX UDF - Find Items

Forward an Item

Further information on how to forward items: OutlookEX UDF - Forward Items