========================================================
===
Application Object ===
========================================================
~Represents the entire Outlook application.
Application := ComObjActive("Outlook.Application")
~You can use
CreateItem directly from this object without traversing the entire hierarchy.
--------------------------------------------------------
=== Application Methods ===
--------------------------------------------------------
ActiveExplorer ~Returns the topmost Explorer object on the desktop.
~Returns nothing if no explorer is active.
ActiveExplorer := ComObjActive("Outlook.Application").ActiveExplorer
ActiveInspector ~Returns the topmost
Inspector object on the desktop.
~Returns nothing if no inspector is active.
ActiveInspector := ComObjActive("Outlook.Application").ActiveInspector
ActiveWindow ~Returns the topmost Microsoft Outlook window which can be either an Explorer or Inspector object.
~Returns nothing if no explorer or inspector is open.
ActiveWindow := ComObjActive("Outlook.Application").ActiveWindow
AdvancedSearch~Returns a
Search Object.
~Use the
Save Method to retain the search filter.
Application.AdvancedSearch(Scope, Filter, SearchSubFolders, Tag)
- Scope (Required): The folder path.
- Filter (Optional): The DASL filter that defines the parameters or the search.
- SearchSubFolders (Optional): also search sub folders.
- Tag: The name of the search for saving purposes.
CopyFile Application.CopyFile(FilePath, DestFolderPath)
- FilePath (Required): The path of the file to copy.
- DestFolderPath (Required): Path of the location to copy to.
Path := "C:\Documents and Settings\" . A_UserName . "\Desktop\Book1.xls" ;create a blank workbook on your desktop
File := ComObjActive("Outlook.Application").CopyFile(Path, "Inbox")
CreateItem Application.CreateItem(ItemType)
- ItemType (Required): The
OlItemTypetype for the new item.
~This method can only create default items.
;example of creating a MailItem and setting it's format to HTML
olMailItem := 0
MailItem := ComObjActive("Outlook.Application").CreateItem(olMailItem)
olFormatHTML := 2
MailItem.BodyFormat := olFormatHTML
MailItem.HTMLBody := "<HTML><H2>The body of this message will appear in HTML.</H2><BODY> Please enter the message text here. </BODY></HTML>"
MailItem.Display
CreateItemFromTemplate Application.CreateItem(TemplatePath, InFolder)
- TemplatePath (Required): The path and file name of the template.
- InFolder (Optional): The folder where the item will go. If empty will go to the default folder.
;create a template
olMailItem := 0
Item := ComObjActive("Outlook.Application").CreateItem(olMailItem)
Item.Subject := "Testing"
Item.To := "Myself"
Item.Display
Item.SaveAs("C:\Testing.oft") ;outlook may detect this action as a virus
;create new message with template
Item := Application.CreateItemFromTemplate("C:\Documents and Settings\" . A_UserName . "\ApplicationData\Microsoft\Templates\Testing.oft")
Item.Display
CreateObject ~Creates an Automation object of the specified class.
Application.CreateObject(ObjectName)
- ObjectName (Required): The name of the object
class to create.
IE := ComObjActive("Outlook.Application").CreateObject("InternetExplorer.Application")
IE.Visible := 1 ;true
IE.Navigate("www.microsoft.com")
GetNamespace ~Returns the NameSpace object of a certain type.
Application.GetNamespace(Type)
- Type (Required): "MAPI" is the only type supported.
NameSpace:= ComObjActive("Outlook.Application").GetNameSpace("MAPI")
GetObjectReference~Creates a strong or weak object reference for a specified Outlook object.
Application.GetObjectReference(Item, ReferenceType)
- Item (Required): The object to reference.
-
ReferenceType(Required): The object's type.
- olStrong := 1
- olWeak := 0
;Item := ?
Reference := ComObjActive("Outlook.Application").GetObjectReference(Item, 0)
IsSearchSynchronous ~Returns true or false indicating if a search will be synchronous or asynchronous.
~True if synchronous and false otherwise.
Application.IsSearchSynchronous(LookInFolders)
- LookInFolders (Required): The path to the folders to search. Enclose the path with single quotes.
Application := ComObjActive("Outlook.Application").IsSearchSynchronous("My Documents")
Quit ~Logs you completely out of Outlook.
Application := ComObjActive("Outlook.Application").Quit
;or
Application.Quit
--------------------------------------------------------
=== Application Properties ===
--------------------------------------------------------
Application ~Returns an Application object that represents the parent Outlook application.
Application := ComObjActive("Outlook.Application")
;or
Application := ComObjCreate("Outlook.Application")
Assistance ~Returns an
Assistance object used to invoke help.
Application := ComObjActive("Outlook.Application")
Assistance := Application.Assistance
Class ~Returns an
constant indicating the object's class.
Application := ComObjActive("Outlook.Application")
Class := Application.Class
COMAddIns ~Returns a COMAddIns collection that represents all the Component Object Model (COM) add-ins currently loaded in Microsoft Outlook.
MsgBox % "There are " . ComObjActive("Outlook.Application").COMAddIns.Count . " COM add ins."
DefaultProfileName ~Returns the default profile name.
MsgBox % "The default profile name is """ . ComObjActive("Outlook.Application").DefaultProfileName . """."
Explorers ~Returns a
Explorers collection of all open
Explorer objects.
MsgBox % "There are " . ComObjActive("Outlook.Application").Explorers.Count . " explorers in the collection."
Inspectors ~Returns a
Inspectors collection of all open
InspectorObjects.
Application := ComObjActive("Outlook.Application")
If (Application.Inspectors.Count = 0)
MsgBox, No Inspectors open.
Else {
Loop % Application.Inspectors.Count
Message .= Application.Inspectors.Item(A_Index).Caption . "`n"
MsgBox % Message
}
IsTrusted ~Returns True or False to indicate if an add-in or external caller is considered trusted.
If (ComObjActive("Outlook.Application").IsTrusted = 1)
MsgBox, The add-in or external caller is trusted
Else MsgBox, The add-in or external caller is not trusted
LanguageSettings ~Returns a
LanguageSettingsobject for the application that contains the language-specific attributes of Outlook.
LanguageSettings := ComObjActive("Outlook.Application").LanguageSettings
Name ~Returns the display name for the object.
MsgBox % "The display name is " . ComObjActive("Outlook.Application").Name . "."
Parent ~Returns the parent Object of the specified object.
Parent := ComObjActive("Outlook.Application").Parent
ProductCode ~Returns a String specifying the Microsoft Outlook
globally unique identifier (GUID).ProductCode := ComObjActive("Outlook.Application").ProductCode
Reminders ~Returns a
Reminders collection that represents all current reminders.
;example 1
For Reminder in ComObjActive("Outlook.Application").Reminders
MsgBox % Reminder.Caption
;example 2
MsgBox % ComObjActive("Outlook.Application").Reminders.Count
Session ~Returns the
NameSpaceobject for the current session.
~The
GetNamespacemethod can be used to accomplish the same thing. Only MAPI is supported.
Session := ComObjActive("Outlook.Application").Session
;or
Session := ComObjActive("Outlook.Application").GetNamespace("MAPI")
TimeZones ~Returns a
TimeZonescollection that represents the set of time zones supported by Outlook.
TimeZones := ComObjActive("Outlook.Application").TimeZones
Loop % TimeZones.Count {
TimeZone := TimeZones.Item(A_Index)
Message .= TimeZone.Name . "`n"
} MsgBox % Message
Version ~Returns or sets a String indicating the number of the version.
MsgBox % ComObjActive("Outlook.Application").Version