Documentation

#COM

COM

Syntax: #COM varname methodname arguments

Executes a method for a COM object stored in varname. Create a com variable reference using %comcreate. If the method requires any arguments, list them after the method name. Do not specify the @ character before the variable name. Method names in COM are CASE SENSITIVE.

See #CALL for an alternative syntax.

Examples:

#VAR Outlook %comcreate("Outlook.Application")
#VAR NameSpace %comget(Outlook, "GetNamespace", "MAPI")
#VAR Folders %comget(NameSpace, "Folders", "InBox")
#VAR InBox %comget(Folders, "Folders", "InBox")
#VAR Msg %comget(InBox,"Items",1)


#CALL %comset(Msg,"Subject","This is a test")
#COM Msg Save


Retrieves the first email message in your InBox (stored in Msg). Then changes the Subject property of that message to "This is a test". Then, using the #COM command, the new message is saved.

#VAR Outlook %comcreate("Outlook.Application")
#VAR NameSpace @Outlook.GetNamespace("MAPI")
#VAR Folders @NameSpace.Folders("InBox")
#VAR InBox @Folders.Folders("InBox")
#VAR Msg @InBox.Items(1)


#VAR Msg.Subject "This is a test"
#CALL @Msg.Save


Alternate syntax for the same result. Uses the short-cut syntax for accessing COM methods and properties, and uses the #CALL command instead of the #COM command to execute function calls.

Add comment

Login or register to post comments