Sign in to follow this  
Followers 0
ReFran

objCreat with classID possible?

5 posts in this topic

Hi,

we have a telphone system with an IE addin, which allows to copy a number to the clipbord and then to choose "call" (via contextmenu).

I searched in the internet for a ActiveX to do that direct from autoIt but didn't found a useable object.

The important lines in the IE addin seems to be:

<object id="theobj" classid="clsid:17D74897-AB4C-4c8b-AB17-4811B6F9E7D3"></object>

theobj.MakeCall(sNewText);

In the registristry I found:

class = Cisco.ClickToCall.Common.ClickToCallCOMAPI

Assembly = Cisco.ClickToCall.Common.COMCallableWrapper

where in the cisco programm directory is a file like the Assembly

= Cisco.ClickToCall.Common.COMCallableWrapper.dll

But in the registry nothing usable.

Is there a direct way to use the information like:

$oCisco = objCreate('classid="clsid:17D74897-AB4C-4c8b-AB17-4811B6F9E7D3"')

$oCisca.MakeCall(sText)

or should I try to use it via IE-object?

Thanks in advance, Reinhard

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Of course you can make object out of CLSID. It's actually a peace of cake:

#include <WinAPI.au3>

; Don't forget initialization!
DllCall("ole32.dll", "long", "CoInitializeEx", "ptr", 0, "dword", 2) ; COINIT_APARTMENTTHREADED

Global $sCLSID = "{13709620-C279-11CE-A49E-444553540000}" ; SHELL   http://msdn.microsoft.com/en-us/library/bb776890(VS.85).aspx

Global $oShell = _ObjCreateFromCLSID($sCLSID)
;Global $oShell = ObjCreate("Shell.Application")

$oShell.MinimizeAll()
Sleep(1500)
$oShell.UndoMinimizeAll()




; Function
Func _ObjCreateFromCLSID($sCLSID)

    Local $tCLSID = _WinAPI_GUIDFromString($sCLSID)
    Local $tIID = _WinAPI_GUIDFromString("{00020400-0000-0000-C000-000000000046}") ; IDispatch

    Local $aCall = DllCall("ole32.dll", "dword", "CoCreateInstance", _
            "ptr", DllStructGetPtr($tCLSID), _
            "ptr", 0, _
            "dword", 1, _ ; CLSCTX_INPROC_SERVER
            "ptr", DllStructGetPtr($tIID), _
            "idispatch*", 0)

    If @error Then
        Return SetError(3, 0, 0)
    EndIf

    Return $aCall[5]

EndFunc

edit:

That will minimize all windows for 1.5 sec and restore them afterwards.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Hi,

unbelievable, so easy?

I changed only 2-3 lines from your script and it seems to work.

At least I get the same error msgbox like I get from IE:

"Connection error...ensure system is running."

That makes sense, because I stay now at home. :D

So maybe I can test exactly not before monday.

Attached the changed file.

Thank you very much, Reinhard

#include <WinAPI.au3>
#include <array.au3>

; Don't forget initialization!
DllCall("ole32.dll", "long", "CoInitializeEx", "ptr", 0, "dword", 2) ; COINIT_APARTMENTTHREADED
Global $sCLSID = "{17D74897-AB4C-4c8b-AB17-4811B6F9E7D3}"

Global $oCisco = _ObjCreateFromCLSID($sCLSID)
$oCisco.MakeCall("123-45678")

Func _ObjCreateFromCLSID($sCLSID)
    Local $tCLSID = _WinAPI_GUIDFromString($sCLSID)
    Local $tIID = _WinAPI_GUIDFromString("{00020400-0000-0000-C000-000000000046}") ; IDispatch
    Local $aCall = DllCall("ole32.dll", "dword", "CoCreateInstance", _
            "ptr", DllStructGetPtr($tCLSID), _
            "ptr", 0, _
            "dword", 1, _ ; CLSCTX_INPROC_SERVER
            "ptr", DllStructGetPtr($tIID), _
            "idispatch*", 0)

    If @error Then
        Return SetError(3, 0, 0)
    EndIf
    ;_arraydisplay($aCall)
    Return $aCall[5]
EndFunc

Share this post


Link to post
Share on other sites

Using the IE object it is as simple as:

$oTheObj = _IEGetObjById($oIE, "theobj")

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Hi Dale,

Thanks for the Info. I will use both.

I write a toolsbar menu, with the main used tel'numbers stored in a ini.

For that I need the dll-call.

In a second step I will integrated as menu-item a search in our "Yellow-pages" for names and numbers. In that I can use the IE-object.

Best regards, Reinhard

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0