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 (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
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
 
Tutorials:

ADO - 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 (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
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
 
Tutorials:

ADO - 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 (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
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
 
Tutorials:

ADO - 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

I've gotten it to work from within MS Access. However, Access uses VBA, where you have to explicitly reference the wanted class...

image.png.d34aa531008766472b964674286f143a.png

Share this post


Link to post
Share on other sites
Posted (edited)

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
Posted (edited)

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
Posted (edited)

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
Posted (edited)

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
Posted (edited)

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 (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
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
 
Tutorials:

ADO - 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 2Toes
      Hey there,
      I have a program that I'm working on, and I have a button that's supposed to stop a running function, when it's pressed.
      However, I cannot get that to work.
      I put together a sample script that is set up in the same way:
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Opt("GUIOnEventMode", 1) Global $Form1 = GUICreate("Form1", 290, 106, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Global $btnStart = GUICtrlCreateButton("Start", 24, 24, 99, 49) GUICtrlSetOnEvent($btnStart, "_Start") Global $btnStop = GUICtrlCreateButton("Stop", 152, 24, 99, 49) GUICtrlSetOnEvent($btnStop, "_Stop") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 ;~ $nMsg = GUIGetMsg() ;~ Switch $nMsg ;~ Case $GUI_EVENT_CLOSE ;~ Exit ;~ EndSwitch WEnd Func _Start() Global $bStartFlag = True $num = 1 While $bStartFlag ConsoleWrite($num & @CRLF) Sleep(1000) $num += 1 WEnd ConsoleWrite("Exited loop.." & @CRLF) EndFunc Func _Stop() Global $bStartFlag = False EndFunc Func _Exit() Exit EndFunc  
      With the code above, while the _Start() func is running, the Stop button doesn't do anything.
      I even threw a MsgBox into the _Stop() func, to see if the script was at least accessing the _Stop() func. But that showed that the _Stop() func is not being accessed at all while the _Start() func is running.
      I'm sure this is a simple solution that I'm just over looking. But I can't figure out what that solution is lol.
      Any help here would be greatly appreciated!
      Thank you in advance!  
    • By nooneclose
      Hello everyone, I am wondering if and how it is possible to connect my AutoIt script to a different email in my outlook. I have two different accounts when I open outlook. The first which my script always connects to is my own email while the second is a group email account. How or can I make the script connect to the second one and access its inbox instead of mine? This is all work related so no funny business here. 
      Global $oOutlook = _OL_Open() ; Store all the Unread emails into an array Global $aItems = _OL_ItemFind($oOutlook, "*\Outlook-UDF-Test", $olMail, _ "[UnRead]=True", "Subject", "Maintenance Request from Eagle's Nest", "EntryID,Subject", "", 1) ; Display the array of unRead emails If IsArray($aItems) Then ;_ArrayDisplay($aItems, "OutlookEX UDF: _OL_ItemFind - Unread mails") Else MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", _ "Could not find an unread mail. @error = " & @error & ", @extended: " & @extended) EndIf ; Get the number of unread emails Global $numberOfUnRead = UBound($aItems, $UBOUND_ROWS) - 1 ;MsgBox("", "Number of Unread emails", $numberOfUnRead) ConsoleWrite("Number of unread emails: " & $numberOfUnRead & @CRLF) I might be missing some code in the post but my code works It's just so long I don't want to post all 2300+ lines. 
      Thank you for the help I greatly appreciate this community. 
    • By TheDcoder
      Hello everyone, it has been a while since I have been involved in a serious AutoIt-related project discussion in the forums here, so it feels good to be back at it
      First a little backstory, a few months back (or a year ago) I made the switch to Linux from Windows... there were several reasons as to why I was motivated to do it, but the main things was Windows 10 was getting out of hand, it didn't offer enough freedom out of the box (restrictive settings, greedy defaults etc.) and had several issues with all kinds of software, many of them mysteriously hard to fix.
      I did have Linux installed as my secondary operating system for few years at that point and I began to see me regularly use it more than Windows, so one day I went ahead and said "fork it", I have stuck to Linux from that point on as my primary operating system.
      Windows is still installed in my computer and I also have a virtual machine with the latest version of Windows 10 on it, primarily because I still use Windows to write software using AutoIt as part of my job (freelance).
      I was pretty sad about the fact that I could no longer use AutoIt to make stuff for myself (since it doesn't run on Linux), I missed sharing code with the community here, this was a great hobby for me as AutoIt is what got me start with programming (even though I had tried several times to get into other languages before, those attempts were never as successful as what I have done in AutoIt).
      In Linux there is no language which is similar to AutoIt unfortunately, there are a few things which come close but are not on par with AutoIt's ease of use. As some of you may know, I have recently started working on other projects using the C language, it is a great step I have taken and I am learning a lot... but it is still not easy to create quick scripts or programs in C, due to the amount of configuration and dedication it takes to make a C program, also it is not ideal for sharing as multiple source files are involved. And on top of that you still have to deal with platform-specific APIs since C is a low-level language.
      (Getting back to core of this topic's subject)
      To solve this issue and to sharpen my programming skills, I could start working on an alternate cross-platform implementation of the AutoIt language which should be backwards compatible with the current AutoIt v3 on C
      The primary aim in the beginning is to implement all the basic functions (File, String, Numbers etc.)  in AutoIt so that it is possible to make basic and fundamental scripts which would work in both Windows and Linux
      The main features would be:
      Cross-platform (Linux and Windows with the possibility supporting of Mac) Backward compatible with AutoIt 3 Byte-code based interpreter instead of source interpreter Easy to use (just like the current AutoIt) The advantage of having a byte-code based interpreter is that it makes the interpreter lighter and faster since it doesn't have to deal with parsing the source code, this would also open the door for some compile time optimizations... another bonus thing for those who don't like their source code present inside the compiler binaries is that it should be impossible to get hands on the original source code, this of course does not mean that decompilation can be stopped... it merely means that anyone decompiling would have to reconstruct the code from the byte-code.
       
      We can later on implement GUI related functions and maybe even automation related functions if the project gets enough traction
      I am adding a poll to keep track of people who are willing to invest in this project or would like to see it come into existence. Welcome any comments, suggestions etc.
      Obviously I will have a lot to learn and my work might interfere with this at times, but with enough interest I can see myself working on this to deliver a very basic prototype which could be used with basic scripts.
       
    • By FordsFinest
      I have a macro that works well on 95% of computers. However, I am running into an issue on a couple computers where the _GUICtrlTreeView_ClickItem clicks the wrong item (an item or two below the correct one). Both the ExpandItem and SelectItem command work fine, just the click item is off on these computers (and only their user names). I'm not sure if some temp file somewhere is causing an issue or what. Note, using ONLY selectitem results in inconsistent focusing (item appears focused but the next command won't always work correctly). Hence my need to use the clickitem command.
      Any help would be appreciated.
      _GUICtrlTreeView_Expand($hWnd, $Array2[$i]) ;Expand $model Sleep(250) _GUICtrlTreeView_SelectItem($hWnd, $Array2[$i]) ;Select $model Sleep(150) _GUICtrlTreeView_ClickItem($hWnd, $Array2[$i]) ;Click $model Sleep(150) EndIf  
    • By nacerbaaziz
      hello all, and welcome to this tool
      the NB-Password_generator is a small tool which allow you to create a strong passwords
      with this tool you can create a random passwords using :
      1. capital letters
      2. small letters
      3. numbers
      4. symbols
      be sure that you can check any option that  you want and uncheck what you don't want to use
      this tool allow you to create a password from 6 letters to 150 lettersNB-Password_generator.zip
      at the end please accept my greetings
      am waiting for your commants
×
×
  • Create New...