Jump to content
jantograaf

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

Share this post


Link to post
Share on other sites

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
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 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
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 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
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.

Share this post


Link to post
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. 🙄

Share this post


Link to post
Share on other sites

does it work with their samples? i will install it to a vm with autoit and try any samples, including yours.


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

what code would you like me to test? gimme... gimme gimme i'll grab your stuff above and give it a go, after i test the C# sample

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
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

 

Share this post


Link to post
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

 

Share this post


Link to post
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

Share this post


Link to post
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

 

Share this post


Link to post
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

Share this post


Link to post
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

 

Share this post


Link to post
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 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By shelly
      I have to press tab to reach a selected button then double click on that
      Here's my script but its not working:
      WinActivate("Policy Decisions -- Webpage Dialog","")
      Sleep(3000)
      Send("{TAB}")
      Send("{TAB}")
      Send("{TAB}")                    // at this point its working according to my need  but double click is not working
      Mouseclick("Left",510, 320, 2, 0)

    • By TheDcoder
      See this thread for info:
    • By nooneclose
      Why can I not click on either of my input fields?
      #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 730, 437, 192, 124) ;GUISetFont(14, 800, 0, "MS Sans Serif") GUISetBkColor(0xC0DCC0) Global $Label1 = GUICtrlCreateLabel("Enter your Password. UserName is auto filled", 62, 40, 604, 41, $SS_CENTER) GUICtrlSetFont(-1, 26, 800, 0, "MS Sans Serif") Global $Label2 = GUICtrlCreateLabel("User Name:", 120, 130, 604, 31, $SS_LEFT) GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif") Global $Label3 = GUICtrlCreateLabel("Password:", 135, 210, 604, 31, $SS_LEFT) GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif") Global $Input1 = GUICtrlCreateInput(@UserName, 274, 130, 185, 32) GUICtrlSetFont(-1, 14, 800, 1, "MS Sans Serif") Global $Input2 = GUICtrlCreateInput("Password", 274, 210, 185, 32, $ES_PASSWORD) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") Global $OK = GUICtrlCreateButton("OK", 274, 270, 185, 57) GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK Global $UserName = GUICtrlRead($Input1) Global $PassWord = GUICtrlRead($Input2) ExitLoop EndSwitch WEnd ; Delete the GUI window GUIDelete()  
    • By cruisepandey
      Hi, 
      I have a string like this : 
      Global $Msga = "urrent directory is /send.  (Submission of file with log number 29381077284 is confirmed)";
      I want to extract the number 29381077284  from the string. I did StringSplit to split based on "(" and then use space to reach there, But it's not a good choice. 
      Can anyone help me with regular expression to find the number from String using AutoIT. TIA
    • By nooneclose
      I want wanting to run multiple tests on my company website. Sadly the process I want to automate requires opening a File Explorer to add an attachment. Is there a way in to automate a Chrome opened File Explorer?
      (I am using webdriver to automate the other 99% of the process just fine. But when I have it click on attach file and chrome opens a file explorer I do not know how to handle it.) 
      Any help would be greatly appreciated. 
×
×
  • Create New...