Memory.CreateObject

number Memory.CreateObject ( 

number  Handle,

string  progID,

string  EventSink (Optional) )

Description

Create a OLE object or any object.

Parameters

Handle

(number) Handle of of your house object.

progID

(string) Friendly-name or component's GUID of the COM component.

EventSink (Optional)

(string) Name of function that want get event sink.

Returns

(number) Return Object pointer if success else retun zero.

ResultVariable

When adding an action with the script editor, you can use this field to specify a variable that the return value will be stored in.

Note: progID can be friendly-name like 'AcroPDF.PDF.1' or be component's GUID like {CA8A9780-280D-11CF-A24D-444553540000}. (use component's GUID with two {} character).

Note On Event Sink function: event sink function must have two parameters first for event name and second for number of real parameters to that sends to event name so all time event sink function is in the form of 'function some_name(Event, num_of_param)'. with second parameter you can find out how much parameters you can get with 'Memory.GetObjectEventParam' function. event sink functions can return anything or nothing this means if your event dont need return anything just leave it alone but if it want you have some way for return all values :
for return boolean you must return false or true like 'retuen false' or 'return true'.
for return string just return a string value like 'return "Test Value"'
for return number as long just return numbers like 'return 12345' but this way just return value as long (beaware)
for return number as int64, float, double, byte and short you must return a formed string like below :
for int64 : 'return "int64:875454654787654547"' and for Unsigned int64 : 'return "uint64:875454654787654547"'
for float : 'return "float:2757.545"' and for Unsigned float : 'return "ufloat:2757.545"'
for double : 'return "double:2757.545"' and for Unsigned double : 'return "udouble:2757.545"'
for byte : 'return "byte:150"' and for Unsigned byte : 'return "ubyte:150"'
for short : 'return "short:150"' and for Unsigned short : 'return "ushort:150"'

Example 1

-- Create a PDF Object in a tree PDFObject1 = Memory.CreateObject(Tree.GetProperties("Tree1").WindowHandle, "AcroPDF.PDF.1", "") PDFObject2 = Memory.CreateObject(Tree.GetProperties("Tree2").WindowHandle, "{CA8A9780-280D-11CF-A24D-444553540000}", "")

Example 2

-- Create a SAPI Object Sapi = Memory.CreateObject(0, "SAPI.SpVoice", "")

See also:  Related Actions

Сайт управляется системой uCoz