Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

COM Object Reference [AutoHotkey v1.1+]


  • Please log in to reply
233 replies to this topic
rani
  • Members
  • 217 posts
  • Last active: Jul 21 2016 12:53 PM
  • Joined: 18 Mar 2008

Can you get it to work in VBScript?


I know JavaScript,
I'll try it with JavaScript ?

  • Guests
  • Last active:
  • Joined: --

Have you tried:

tTxtO := ComObjCreate("Txt[color=red]S[/color]DKLib.TxtSDK")


at last I foound the 'problem' of instance
I was looking at the regedit and found that:
in VB project it's written as
("TxtSDKLib.TxtSDK")

but in regedit it is something like :
"txsd.TxtSDK" where actually the txsd is the name of the .dll file:
txsd.dll

and now it gave correctly the instance:
oTX :=ComObjCreate("txsd.TxtSDK")
without any mistake.

but now I faced another problem:
how to get return value of parameter of a Method :

oTX.getID(ID)

the value ID is a return value from the method getID
I got ID=""
how I actually getting the ID ?
in VB project I get it correctly as in syntax:
oTX.getID ID

jethrow
  • Moderators
  • 2854 posts
  • Last active: May 17 2017 01:57 AM
  • Joined: 24 May 2009
Do you have an API reference for the Com Object?

the value ID is a return value from the method getID

Do you mean it's a ByRef param?

I got ID=""

Are you sure it's blank, or is it just not a visible string? What are the results of:
MsgBox, % IsObject(ID) ", " !!ID


rani
  • Members
  • 217 posts
  • Last active: Jul 21 2016 12:53 PM
  • Joined: 18 Mar 2008

the value ID is a return value from the method getID

Do you mean it's a ByRef param?

yes I mean byRef ID (is a string)
getting ID value after execute the method

is there special syntax (getting value) in AHK_L ?

jethrow
  • Moderators
  • 2854 posts
  • Last active: May 17 2017 01:57 AM
  • Joined: 24 May 2009
There is ComObjValue(), but you only answered 1 of my questions.

rani
  • Members
  • 217 posts
  • Last active: Jul 21 2016 12:53 PM
  • Joined: 18 Mar 2008
[quote name="jethrow"]Do you have an API reference for the Com Object?

do you mean I follow the API reference ?

I actually run VB project code (the old VB6 not VB.net)
and on each function or method I try to run it with AHK_L

there are no too many functions/ methods

rani
  • Members
  • 217 posts
  • Last active: Jul 21 2016 12:53 PM
  • Joined: 18 Mar 2008

There is ComObjValue(), but you only answered 1 of my questions.


VB method:
oTX.getID ID
to get ID (string)

so what is the syntax to get ID(string) value by AHK_L with comObjValue ?
(didnt't find any example for that)

jethrow
  • Moderators
  • 2854 posts
  • Last active: May 17 2017 01:57 AM
  • Joined: 24 May 2009

Are you sure it's blank, or is it just not a visible string? What are the results of:

MsgBox, % IsObject(ID) ", " !!ID

If it's not blank, what is the value of the variable? (use ListVars)

rani
  • Members
  • 217 posts
  • Last active: Jul 21 2016 12:53 PM
  • Joined: 18 Mar 2008

Are you sure it's blank, or is it just not a visible string? What are the results of:

MsgBox, % IsObject(ID) ", " !!ID

If it's not blank, what is the value of the variable? (use ListVars)


from listvars I get
hModule[8 of 63]: 17170432
ID[0 of 0]:

and in msgBox I get null (or ="")

jethrow
  • Moderators
  • 2854 posts
  • Last active: May 17 2017 01:57 AM
  • Joined: 24 May 2009

and in msgBox I get null (or ="")

Then it's quite apparent you aren't listening :?

Anyways, if I'm going to help anymore, I'll need a link to the documentation for this Com Object (API Reference), and a working VBScript or JScript example. Good luck.

rani
  • Members
  • 217 posts
  • Last active: Jul 21 2016 12:53 PM
  • Joined: 18 Mar 2008

and in msgBox I get null (or ="")

Then it's quite apparent you aren't listening :?

I followed your instructions with :
MsgBox, % IsObject(ID) ", " !!ID
and with listvars

and I said that from msgBox got empty values on the alert box.
but now I'll try with JScript,

anyway,
thanks for help

rani
  • Members
  • 217 posts
  • Last active: Jul 21 2016 12:53 PM
  • Joined: 18 Mar 2008
AHK_L COM argument return value

checking JSscript and VBscript on com automation return value
caused error (type mismatch)
seems VB script can return only variant type values
(and not let say BSTR)

JScript , cannot return values byref (maybe with object arguments)
so it's not straight forward, and I didn't succeed to implement on COM argument.

AHK_L
it seems the AHK_L has some bug or different syntax, how get return value from COM argument (byref)
methods of COM with arguments are passing correctly, but not returned values

any help or advice will be appreciated.

rani
  • Members
  • 217 posts
  • Last active: Jul 21 2016 12:53 PM
  • Joined: 18 Mar 2008

for this Com Object (API Reference), and a working VBScript or JScript example. Good luck.


VB6 dll (dll+class)

I build dll width 2 arguments

public sub subTest(x as string, byRef yRetrun as string)

yReturn ="returnValue"

end sub

public function funcTest(x as string) as string

funcTest ="returnValue"

end function

with comObjCreate the instance is OK (IsObject=1)
the value of funcTest in AHK_L receive a correct value means

oReturn : ComObjCreate("dllx.Return")
funTest := oReturn.funTest("X")
received ok the value "returnValue"

but with the sub the return value byRef, don't work !:
txtValue := ""
oReturn.subTest("X",txtValue)
the txtValue equal to ""

means:
the AHK_L comObject cannot get return value's byRef from sub's (methods)
or there is special syntax for that ?

I think lexikos should give some remark on that, either

"how to get return value's from sub or method"

Jethrow,
from this thread , when I follow your answers it looks your most professional,
just if you can give another answer on this issue.

I gave all the info you need.

dumpster.monkey
  • Members
  • 12 posts
  • Last active: Sep 25 2011 12:59 PM
  • Joined: 30 Jul 2011
Not sure if this is the right place to ask, but:

If I use this method to show swf using the new gui, add, activex:
#SingleInstance force 

w = 530
h = 336

Gui, 1: +LastFound -Caption +AlwaysOnTop -SysMenu 
Gui, 1: Show, w%w% h%h% Center, Flash 
Gui, 1: Margin, 0 ,0
Gui, 1: Add, ActiveX, w%w% h%h% vpwb, D27CDB6E-AE6D-11cf-96B8-444553540000
getSwfFromDisk = %A_ScriptDir%/HyperFPLaunch/hiScores_0.swf
pwb.Navigate("file:///" . getSwfFromDisk)
Return 

GuiClose: 
  Esc::
  Gui, 1:Destroy 
  ExitApp 
Return

Is there a way to set parameters - eg using com.ahk I would use:

COM_Invoke(psf, "Scale=", "exactfit")
COM_Invoke(psf, "bgcolor=", "#261800")


or do I need to wrap it in html and use

Gui Add, ActiveX, w%w% h%h% vpwb, Shell.Explorer



nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
COM_Invoke(psf, "Scale=", "exactfit")
psf.Scale := "exactfit"