Jump to content

Connecting with a VBA/COM or .NET API


Recommended Posts

Alright, this is not going to be easy, that's for sure. I am indeed able to load the library, but after that I'm completely in the dark as well...

Local $oCallCenter = _CLR_LoadLibrary("C:\Program Files (x86)\JUstPhone\Callcenter\SDK\bin\RemotePhoneService.dll")
MsgBox(0,"Result","$oCallCenter: " & IsObj($oCallCenter) & @CRLF)

Local $oApplication = _CLR_CreateObject($oCallCenter,"JustRemotePhone.RemotePhoneService.Application")
MsgBox(0,"Result","$oApplication: " & IsObj($oApplication) & @CRLF)

The first result is 1, since the library is loaded. The second, however, stays 0, and I've tried a lot of possible variations on that classname...

Link to comment
Share on other sites

I think the thread for the NET UDF is the best place to get more help.
If they can't help then I don't know who else 😯

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

11 hours ago, jantograaf said:

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!

 

According to the OleView image above, the object name should be "JustRemotePhone.RemotePhoneService.ApplicationFactory".  What I usually look for when trying to figure out what the object name should be, is the ProgID or the VersionIndependentProgID if it has one. 

The following example appears to successfully create the application object for me.  If you change "ApplicationFactory" back to just "Application" and run the example, you will see that it fails with an invalid class string error (as I think was stated earlier).

 

#include <Constants.au3>

example()

Func example()

    Local $oComErr, $oApp

    $oComErr = ObjEvent("AutoIt.Error", "com_error_handler")

    $oApp = ObjCreate("JustRemotePhone.RemotePhoneService.ApplicationFactory")
    If @error Then Exit MsgBox($MB_ICONERROR, "ERROR", $oComErr.WinDescription)

    MsgBox($MB_ICONINFORMATION, "INFO", "Application object successfully created!")

EndFunc

Func com_error_handler($oError)
    Return
EndFunc

 

Edited by TheXman
Link to comment
Share on other sites

Yeah, I can connect the ApplicationFactory-object as well, without any issues, but this ApplicationFactory-object is mentioned nowhere in RemotePhone's API. So, I contacted them to see what possibilities there are to get this to work. If I find out more, I'll post it here...

Greetings!

Link to comment
Share on other sites

Hello. my two cents...

#include <MsgBoxConstants.au3>


Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") ;Register AutoIt Error handler
Global $oObject = ObjCreate("JustRemotePhone.RemotePhoneService.ApplicationFactory") ;Create Main object

ConsoleWrite("-oObject: " & IsObj($oObject) & @CRLF)
Global $oApplication = $oObject.CreateApplication("AutoIt Client") ;Create Application


If Not IsObj($oApplication) Then
    Exit MsgBox($MB_ICONERROR, "Error", "Unable to Create 'Remote Phone Call' Instance")
EndIf

Global $sNumber = InputBox("Add a number to be Called", "Phone Number", "")

If Not $sNumber Then Exit MsgBox($MB_ICONINFORMATION, "Error", "Phone Number  is Emtpy Script will Exit.")


$oApplication.BeginConnect(True) ;Begin Connection

;You probably will need to grant accest to the application at this point.
Global $oPhone = $oApplication.Phone ;Create Phone Object
ConsoleWrite("-oPhone: " & IsObj($oPhone) & @CRLF)


;Call
$oPhone.Call($sNumber)


$oApplication.BeginDisconnect() ;End Connection

; User's COM error function. Will be called if COM error occurs
Func _ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

 

PD: Can't load syntaxhighlighter Cuz My Connection is too slow. So I'll update it later.

 

Saludos

Edited by Danyfirex
Updated code tag
Link to comment
Share on other sites

Edited: Browser sent info twice 😤.

 

Saludos

Edited by Danyfirex
Browser sent info twice.
Link to comment
Share on other sites

  • 1 year later...

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