vbscript - How getObject Function internally works? -


i'm automating inventor 2013 using uft follows:-

set oapp = getobject(,"inventor.application") set odoc = oapp.activedocument

here i'm using getobject() function reference of running inventor application. have questions getobject() function that

1)how find out application present or in running state?

2)how access header class of particular application access of methods , properties of application's class?

can explain this?

getobject , createobject part of com automation provided vbscript. vbscript can't use com objects available through windows. vbscript can use objects expose string called programmatic identifier (progid). although not com objects have progid, com objects have 128-bit number called class identifier, or clsid. if com object has progid, can use vbscript instantiate object, invoke methods , properties, , destroy object.

getobject , createobject works similar in way, serve different purposes.
if need create new instance of object, use createobject.
if need reference existing instance of object, use getobject.

getobject function has 2 optional arguments: object's pathname (i.e., full path , filename) , object's progid. although both arguments optional, must specify @ least one. if omit both arguments, error results. example:

dim worddoc set worddoc = getobject ("filepath\filename.doc") 

when code executed, application associated specified pathname started , object in specified file activated. if pathname zero-length string (""), getobject returns new object instance of specified type. if pathname argument omitted, getobject returns active object of specified type. if no object of specified type exists, error occurs.

if specify progid not pathname, results differ depending on how set arguments. if pass empty string first argument in code such as

set wordapp = getobject("", "word.application") 

vbscript returns new instance of word's application object (i.e., object represents word application). getobject call equivalent createobject call

set wordapp = createobject ("word.application") 

if omit pathname argument leave comma

set wordapp = getobject (, "word.application") 

vbscript returns existing instance of application object if 1 exists.

for more information, check this , this links.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -