Jump to content

Connecting with a VBA/COM or .NET API


Recommended Posts

Hi all,

I'm trying to write a script that connects with a VBA/COM API to get the status of a connected phone. I've been looking up and down this forum for tips or other user's experiences, but I can't seem to find anything (even remotely) similar. It shouldn't be so hard to do, however.

Software I'm trying to connect to

I'm trying to integrate CallCenter by using their API, which is documented over here JustRemotePhone API Reference

Things I've tried

I've tried using ObjCreate but I don't get any result, it always returns the same (negative) error.

#Version 1 tried
ObjCreate("JustRemotePhone.RemotePhoneService")

#Version 2 tried
ObjCreate("JustRemotePhoneCOM.RemotePhoneService")

#Version 3 tried
ObjCreate("JustRemotePhoneCOM.RemotePhoneService.Application")

None of the three versions I tried seem to deliver any result other than a negative error value which basically says that the given class is not valid.

I am starting to get the hang of AutoIt by now, but unmanaged programming languages and object-oriented stuff is still quite a grey zone for me. If anyone could help me 'talk' to this application, I'd be immensely grateful!

Thanks in advance and kind regards from Belgium!

 

Jan

Link to comment
Share on other sites

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

That's the "Invalid Class String" exception.
You are sure that all components of the application (including the COM interface) have been installed?
Maybe they have been installed for the System (or any other admin user) user and hence are not accessible by you?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Since the API is installed together with their standard software (no seperate installer) and I've just double-checked that I didn't need to check any additional options in the installer to activate this, it should be installed. I am also the admin-user on my local desktop, so I should have all rights to installed objects. Here is a screenshot from within OleView:

knipsel.thumb.png.b14ce894dae9a02cd2e8dc13813e4af4.png

Thanks for your replies, guys, I'm sure it'll be something very stupid and simple somewhere...

Kudos!

Link to comment
Share on other sites

These files are shown in the SDK-directory of the CallCenter-app. I thought the DLL was registered, since it shows up in the OLE/COM Object Viewer, but now I see that the one referenced in OleView.exe is the one in the JustPhone-folder, not the one in the SDK subfolder. Any way to register such a COM interface/DLL myself manually? Once I get a grasp of that, I'll be on my way... I guess... #fingerscrossed

image.png.c1529fdc5f6a9aebdec0d5aa91b7f0b3.png

Link to comment
Share on other sites

Use

Quote

regsvr32 path of the .dll file with filename and extension

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Oh god. This gives me the error that the entry point to DLLRegisterServer wasn't found. I went looking for that error, but then they advised that the dll should be copied to the system path. However, copying the file to C:\Windows\System32 doesn't fix the error in AutoIt.

Link to comment
Share on other sites

I have tried to register the .dll using RegAsm.

RegAsm.exe "C:\Program Files (x86)\JustPhone\CallCenter\SDK\bin\RemotePhoneService.dll" /tlb:"RemotePhoneService.xml" /verbose

Result (in Dutch, sorry):

Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.8922
Copyright (C) Microsoft Corporation 1998-2004. Alle rechten voorbehouden.

Assembly is geëxporteerd naar C:\Program Files (x86)\JustPhone\CallCenter\SDK\bin\RemotePhoneService.xml en de typebibliotheek is geregistreerd

I get no errors on registration, it says it has been exported and the type library has been registered. However, from within my AutoIt script, the same errors occur. 🙄

Link to comment
Share on other sites

so, i think you need to have that dll and it's xml present in your app directory. Not sure if registering it will work wither. cannot register it with Regsvr32 so.... you need to have that stuff with your autoit source.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

LOL, I have it! you CAN register it, but you did not do it properly! lol do this

regasm RemotePhoneService.dll /tlb:RemotePhoneService.tlb

 

so in a vm i installed the product, then ran the .csproj sample, then copied that dll and xml to my host along with the sample i compiled, ran that command above on my host (note my host does not have callcenter installed) and ran the sample, just fine.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

I can give you my code, but it's irrelevant. Basically it is only one line and the check if it produces an error.

Local $oApplication = ObjCreate("JustRemotePhone.RemotePhoneService")
If @error Then
    MsgBox(0,"Error",@Error & @CRLF & @extended)
Else
    MsgBox(0,"Okay","Geslaagd!")
EndIf

I have registered the DLL again, I have tried by placing it in the same folder as my compiled AutoIt-script, all to no avail, nothing makes it work.

Edited by jantograaf
Typo
Link to comment
Share on other sites

you are right, they don't respond. let me try something. I am pretty sure you will be dealing with running .net code under autoit. I don't think ObjCreate is going to work on that DLL

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Thanks for looking into that. I don't mind 'how' to implement this, the key is that I just want it to work somehow since it would be a great opportunity to build something useful...

Right now, me and my 5 colleagues pick up the office support calls by answering the phone through this piece of windows software. But since we all use a cellphone with a virtual phone 'central', which does not offer an option to see who is currently in a call, getting that status through that 'API' would allow me to design a simple status screen which shows who is available and who isn't... That's the main target.

P.S.: long explanation, I know, but I always figure it's more useful to explain exactly what I'm  trying to achieve so we can find a good - or even alternative, out-of-the-box - solution...

Edited by jantograaf
Typo
Link to comment
Share on other sites

well, that's a .NET dll, and I can load it but running that BeginConnect method is failing in autoit.

the vba sample which works uses RemotePhoneServiceCOM.tlb which is registered to your system, you saw it in OLE Viewer

If I were you, I would use the VBA sample app or the C# one as a basis for this as it works properly with them

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

I know nothing about .NET but maybe the .NET UDF is the way to solve your problem: https://www.autoitscript.com/forum/topic/188158-net-common-language-runtime-clr-framework/

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

×
×
  • Create New...