Jump to content

TeamViewer.au3 UDF 1.0.0

   (0 reviews)

About This File

This is TeamViewer.au3 UDF for TeamViewer API.

 

; #INDEX# ========================================================================
; Title .........: TeamViewer.au3
; AutoIt Version : 3.3.10.2++
; Language ......: English
; Description ...: A collection of function for use with TeamViewer API
; Author ........: mLipok
; Modified ......:
; URL ...........:
; URL ...........: https://www.teamviewer.com/
; URL ...........: https://www.teamviewer.com/en/integrations/
; URL ...........: https://integrate.teamviewer.com/en/develop/api/get-started/
; URL ...........: https://downloadeu1.teamviewer.com/integrate/TeamViewer_API_Documentation.pdf
; Remarks .......: This UDF was created based on TeamViewer_API_Documentation.pdf v 1.4.1
; Remarks .......: This UDF is using Free Chilkat component look here https://www.autoitscript.com/forum/files/file/433-chilkat-udf/
; Remarks .......: Documentation is "work in progress"
; Date ..........: 2017/02/08
; Version .......: 0.1.1 BETA - Work in progress
; ================================================================================

 

I'm using TeamViewer_Example.ini to store my secret tokens/keys.

[Settings]
AccessToken=

[OAuth2]
ClientID=
ClientSecret=
authorizationCode=

 

in TeamViewer_Example.au3 you can see few examples:

Func _Example()

    ; If not exist then create new INI file from template
    If Not FileExists('TeamViewer_Example.ini') Then FileCopy('TeamViewer_Example — Template.ini', 'TeamViewer_Example.ini')

    ; Read Access Token from INI
    Local $sTV_AccessToken = IniRead('TeamViewer_Example.ini', 'Settings', 'AccessToken', '')
    If $sTV_AccessToken = '' Then
        ; Your Access Token, can be left empty when OAuth (below) is configured.

        ; ClientId = <----------------- Create an app in your TeamViewer Management Console and insert the client ID to the INI
        ; ClientSecret = <------------- Insert your client secret to the INI
        ; AuthorizationCode = <-------- Visit https://webapi.teamviewer.com/api/v1/oauth2/authorize?response_type=code&client_id=YOUR$i_ClientIdHERE
        ;                               Login, grant the permissions (popup) and put the code shown in the AuthorizationCode variable to the INI

        Local $sTVOAuth_ClientID = IniRead('TeamViewer_Example.ini', 'OAuth2', 'ClientID', '')
        Local $sTVOAuth_ClientSecret = IniRead('TeamViewer_Example.ini', 'OAuth2', 'ClientSecret', '')

        _IECreate('https://webapi.teamviewer.com/api/v1/oauth2/authorize?response_type=code&client_id=' & $sTVOAuth_ClientID)
        ; Local $sTVOAuth_AuthorizationCode = IniRead('TeamViewer_Example.ini', 'OAuth2', 'authorizationCode', '')
        Local $sTVOAuth_AuthorizationCode = InputBox('AuthorizationCode', 'Please provide TV OAuth2 AuthorizationCode')
        If @error Then Return

        If $sTVOAuth_ClientID Then $sTV_AccessToken = _TVAPI_RequestOAuth2_AccessToken($sTVOAuth_ClientID, $sTVOAuth_ClientSecret, $sTVOAuth_AuthorizationCode)
    EndIf

    If $sTV_AccessToken Then _TVAPI_AccessToken($sTV_AccessToken)

    If _TVAPI_Ping() = True Then ; ping API to check connection and $sTV_AccessToken
        _Example_TeamViewer__1_Devices_SaveToFile()
;~      _Example_TeamViewer__2_Devices_ChangeDetails()
;~      _Example_TeamViewer__3_Devices_GetDevicesSingleID()
;~      _Example_TeamViewer__4_Reports_GetAllConnections()
;~      _Example_TeamViewer__5_Users_GetUserInfomation()
;~      _Example_TeamViewer__6_Groups_ListGroups()
;~      _Example_TeamViewer__7_Devices_AddDeleteDevice()
    Else
        MsgBox(0, '_TVAPI_Ping', "$v_Token or connection problem.")
    EndIf
EndFunc   ;==>_Example

 

SUPPORT TOPIC IS HERE:

 

TeamViewer_Example — Template.ini


User Feedback

Recommended Comments

There are no comments to display.

×
×
  • Create New...