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 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 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 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 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 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 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

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

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 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-02-09 - Version 1.4.1.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 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

  • Similar Content

    • By PeterVerbeek
      This topic give you access to an AutoIt functions library I maintain which is called PAL, Peter's AutoIt Library. The latest version 1.19 contains 194 functions divided into these topics:
      window and screen mouse and GUI GUI controls logics and mathematics string, xml string and file string dialogues and progress bars data lists: lists, stacks, shift registers and key maps (a.ka. dictionaries) miscellaneous: logging/debugging, process and system info A lot of these functions were created in the development of Peace, Peter's Equalizer APO Configuration Extension, which is a user interface for the system-wide audio driver called Equalizer APO.
    • By Ho3ein
      Hello again, i have a code that changes username to favorite, my problem is how to use ObjEvent() function to catch errors, i've red Help File and Forum's Topics but i can't understand too much😐

      Here is a code (I've copied this codes from a user of AutoIt Forum):
       
      $sOldUser = "Administrator" $sNewUser = "Admin" $oUser = ObjGet("WinNT://" & @ComputerName & "/" & $sOldUser & ",user") $oComputer = ObjGet("WinNT://" & @ComputerName) $oNewUser = $oComputer.MoveHere($oUser.ADsPath, $sNewUser) Thanks for your care, I'm new to AutoIt and days should be passed with my coding and practicing to don't bother you :)❤
    • By topgundcp
      Hi, 
      This is my very first post in this forum and am also new with Autoit programming so be easy on me.
      Below is the code that I am trying to get the index of the item selected. No problem getting the text.
      Case $listEdition   ; handle of the list             local $index=0             $item=GUICTRLRead($listEdition)    ; This will return the text in the list             ; ==============   The loop below always fails  ==================             ; Meaning _GUICtrlListView_GetItemSelected($listEdition, $i) always return FALSE. WHY ???????              For $i = 0 To $editionArray[0] - 1   ; The content of the list in an array where editionArray[0] contains total count of items                 If _GUICtrlListView_GetItemSelected($listEdition, $i) Then                     $index = $i                     exitloop                 EndIf              Next              ;===================================================             ConsoleWrite( "Select Edition:     " & $item & "  index: " & $index & @CR) ....... Please look at the comments in the code & the pix attached.
      _GUICtrlListView_GetItemSelected($listEdition, $i) always returns FALSE.
      Another problem is on the list. It also populate  the total count of items from the Array. How can I skip this item from populating to the list ?.
      Please advise and thanks

    • By n0ktar
      is it possible to make a wall chams in rainbow six siege using autoit scripts? tell me please and how . 
    • By Rskm
      Hi, I am using excel as input media for my program. The excel file (i tried with .xls, .xlsx and .xlsm format) has inputs which the autoit script reads during the run and performs few calculations. Some times (not always), after the run, when i try to open the excel file manually, the file doesnt open at all in excel. see the screenshot attached. However, if the execute the autoit script, the scripts still reads the existing data from that excel and performs the calcs. I copied the excel file to another computer and there too, it doesnt open.  So, after this, i cannot edit the excel forever (if i need to change any inputs). It is only this particular file that got affected. other excel files works normal.  What could be the problem here.  please help as this is a new challenge for me during my program development. 

×
×
  • Create New...