Search the Community
Showing results for tags 'Api'.
-
Hello guys. I recently saw some posts that Windows 10 provides OCR API. So I decided to create a UDF. What's UWPOCR? UWPOCR UDF is a simple library to use Universal Windows Platform Optical character recognition API. Features. Get Text From Image File. Get Text From GDI+ Bitmap. Easy to use. Usage: #include "..\UWPOCR.au3" _Example() Func _Example() Local $sOCRTextResult = _UWPOCR_GetText(FileOpenDialog("Select Image", @ScriptDir & "\", "Images (*.jpg;*.bmp;*.png;*.tif;*.gif)")) MsgBox(0,"",$sOCRTextResult) EndFunc Get Words Rect(Example): More examples here. Check UWPOCR UDF on GitHub. Saludos
-
1. Description. Automate communication with Gmail API using oAuth 2.0 security. 2. Requirements. Google Gmail account. Finished Authorization process. Look here 3. Possibilities. ;======================================================================================================================== ; Date: 2018-02-12, 11:46 ; ; Bug Fixs: 2018-02-17, 7:31 -> Fixed problems with adding items to array and minor bugs. ; ; Description: UDF for using Gmail API interface. This UDF requires oAuth.au3 and Gmail account. ; ; Function(s): ; gmailUsersGetProfile() -> Information about your account. ; gmailUsersLabelsList() -> Get all available labels ids. ex. "INBOX", "UNREAD" ; gmailUsersLabelsGet() -> Get information about specific label id. ; gmailUsersMessagesBatchDelete() -> Delete many messages emails by id. ; gmailUsersMessagesBatchModify() -> Set status for many messages ex. "INBOX", "UNREAD" ; gmailUsersMessagesDelete() -> Totaly delete email from ur account. ; gmailUsersMessagesGet() -> Get all information about specific email. ; gmailUsersMessagesList() -> Get list of last ~100 emails. ; gmailUsersMessagesModify() -> Modify single message. ; gmailUsersMessagesTrash() -> Put email in trash. ; gmailUsersMessagesUntrash() -> Restore email from trash. ; gmailUsersMessagesSend() -> Send email to single or group recipients. ; gmailUsersMessagesAttachmentsGet() -> Download attachment by id. ; ; Author(s): Ascer ;======================================================================================================================== 4. Downloads. oAuth.au3 Gmail API.au3 5. Examples. Sending emails
- 54 replies
-
- gmail
- send emails
-
(and 3 more)
Tagged with:
-
About AutoIt-API-WS AutoIt-API-WS is a light weight web server with expressive syntax, with the sole purpose of wrapping your existing AutoIt app with little to no effort. With AutoIt-API-WS you can send and receive data between any application or framework, as long they can handle HTTP requests, which is an industry standard today. Like my other communcations UDF AutoIt-Socket-IO AutoIt-API-WS is heavily inspired from the big boys, but this time its Laravel and Ruby on Rails. Features Highlights No external or internal dependencies required RESTful mindset when designed Expressive syntax Small codebase Heavy use of Michelsofts Dictionary object Limitations Not complient with any RFC, so something important could be missing. Time will tell! One persons slow loris attack will kill the process forever. Example of implemetnation (With screenshots) This is a basic cRud operation with the RESTful mindset in use. #include "API.au3" #include <Array.au3> _API_MGR_SetName("My APP DB adapter") _API_MGR_SetVer("1.0 BETA") _API_MGR_SetDescription("This adapter allows you to get this n that") _API_MGR_Init(3000) _API_MGR_ROUTER_GET('/users', CB_GetUsers, 'string sortBy', 'Get all users, sortBy can be either asc or desc. asc is default') _API_MGR_ROUTER_GET('/users/{id}', CB_GetUsersById, 'int id*', 'Get user by id') While _API_MGR_ROUTER_HANDLE() WEnd Func DB_GetUsers() Local $userA = ObjCreate("Scripting.Dictionary") Local $userB = ObjCreate("Scripting.Dictionary") $userA.add('id', 1) $userA.add('name', 'TarreTarreTarre') $userA.add('age', 27) $userB.add('id', 2) $userB.add('name', @UserName) $userB.add('age', 22) Local $aRet = [$userA, $userB] Return $aRet EndFunc Func CB_GetUsers(Const $oRequest) Local $aUsers = DB_GetUsers() If $oRequest.exists('sortBy') Then Switch $oRequest.item('sortBy') Case Default Case 'asc' Case 'desc' _ArrayReverse($aUsers) EndSwitch EndIf Return $aUsers EndFunc Func CB_GetUsersById(Const $oRequest) Local Const $aUsers = DB_GetUsers() Local $foundUser = Null For $i = 0 To UBound($aUsers) -1 Local $curUser = $aUsers[$i] If $curUser.item('id') == $oRequest.item('#id') Then $foundUser = $curUser ExitLoop EndIf Next If Not IsObj($foundUser) Then Return _API_RES_NotFound(StringFormat("Could not find user with ID %d", $oRequest.item('#id'))) EndIf return $foundUser EndFunc When you visit http://localhost:3000 you are greeted with this pleasent view that will show you all your registred routes and some extra info you have provided. When you visit http://localhost:3000/users the UDF will return the array of objects as Json And here is an example of http://localhost:3000/users/1 More examples can be found here (NEWEST 2020-09-21) Autoit-API-WS-1.0.3-beta.zip OLD VERSIONS Autoit-API-WS-1.0.0-beta.zip Autoit-API-WS-1.0.1-beta.zip
-
I can TCP/IP in AutoIt, hence, make a HTTP deamon. Now, how can I HTTPS to use SSL !?? Well, Apache has this "mod_proxy.so" module that can let me have SSL and what not is in Apache. All that is needed is to tell Apache what I wanna do by editing httpd.conf . # Implements a proxy/gateway for Apache. # 1. Open /Applications/XAMPP/etc/httpd.conf # 2. Enable the following Modules by removing the # at the front of the line. # - LoadModule rewrite_module modules/mod_rewrite.so # - LoadModule proxy_module modules/mod_proxy.so # - LoadModule proxy_http_module modules/mod_proxy_http.so # # 3. Copy and Paste below to the bottom of httpd.conf # <IfModule mod_proxy.c> ProxyRequests On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyVia Off ProxyPreserveHost Off ProxyPass /home/ http://127.0.0.1:84/home/ ProxyPassReverse /home/ http://127.0.0.1:84/home/ SetEnv proxy-nokeepalive 1 # ..since we are not using "keep-alive", we are using "close" </IfModule> ...et voila I'm using XAMPP ( https://www.apachefriends.org/download.html ) and this is my solution to avoid coding in PHP, as I feel more comfortable coding in AutoIt. A "muli-thread or concurrency" can be done by forking the socket ( https://www.autoitscript.com/forum/topic/199177-fork-udf-ish/ ) but responses are under 20 ms., so I feel fine with a single thread. I modified an example ( attached below ), so can try out the concept. PS: I am not an Apache guru. I just discovered this and it opens a world of possibilities. In my case, I'm thinking of an API to query SQLite PS2: I'm not gonna make Poll but do click like if you do 201673-json-http-post-serverlistener.au3
-
1. Description. oAuth 2.0 is security system implemented by Google a few years ago. You are able to connect into your Google accounts and manage documents. In this UDF i show you how to pass first authorization process., this allow you to automate most of functions using API interface. 2. Requirements. Google account. oAuth.au3 Download 3. Possibilities ;============================================================================================================ ; Date: 2018-02-10, 14:21 ; ; Description: UDF for authorize your app with oAuth 2.0 Google. ; ; Function(s): ; oAuth2GetAuthorizationCode() -> Get Code for "grant". ; oAuth2GetAccessToken() -> Get "access_token" and "refresh_token" first time. ; oAuth2RefreshAccessToken() -> Get current "access_token" using "refresh_token". ; ; Author(s): Ascer ;============================================================================================================ 4. Enable your Google API. 4.1. Video Tutorial not mine! YouTube 4.2 Screenshots from authorization process (Polish language) Go to https://console.developers.google.com/apis/dashboard and accept current rules. Next create an new project Enter name of you new project and click Create Google will working now, please wait until finish. Next go to enable your API interface, we make if for Google Take "Gmail" in search input and after click in found result. Click Enable interface, Google will working now. Create your login credentials Select Windows Interface (combobox), User credentials (radio) and click button what is need bla bla Type name of a new client id for oAuth 2.0 and click Create a new Client ID. Next configure screen aplication, type some name and click Next. Google will working now. Last step on this website is download source with your credentials in *Json format. Now you received a file named client_id.json, it's how it look in Sublime Text: 5. Coding. Now we need to call a some function to get access code. #include <oAuth.au3> Local $sClientId = "167204758184-vpeues0uk6b0g4jrnv0ipq5fapoig2v8.apps.googleusercontent.com" Local $sRedirectUri = "http://localhost" oAuth2GetAuthorizationCode($sClientId, $sRedirectUri) Function will execute default browser for ask you to permission. Next Google ask you to permission for access to your personal details by application Autoit Now you can thing is something wrong but all is ok, you need to copy all after code= . It your access code. Let's now ask Google about our Access Token and Refresh Token #include <oAuth.au3> Local $sClientId = "167204758184-vpeues0uk6b0g4jrnv0ipq5fapoig2v8.apps.googleusercontent.com" Local $sClientSecret = "cWalvFr3WxiE6cjUkdmKEPo8" Local $sAuthorizationCode = "4/AAAPXJOZ-Tz0s6mrx7JbV6nthXSfcxaszFh_aH0azVqHkSHkfiwE8uamcabn4eMbEWg1eAuUw7AU0PQ0XeWUFRo#" Local $sRedirectUri = "http://localhost" Local $aRet = oAuth2GetAccessToken($sClientId, $sClientSecret, $sAuthorizationCode, $sRedirectUri) If Ubound($aRet) <> 4 then ConsoleWrite("+++ Something wrong with reading ResponseText." & @CRLF) Exit EndIf ConsoleWrite("Successfully received data from Google." & @CRLF) ConsoleWrite("access_token: " & $aRet[0] & @CRLF) ConsoleWrite("expires_in: " & $aRet[1] & @CRLF) ConsoleWrite("refresh_token: " & $aRet[2] & @CRLF) ConsoleWrite("token_type: " & $aRet[3] & @CRLF) Important! When you received error 400 and output says: Invalid grant it means that your previous generated access_code lost validity and you need to generate new calling previus code. When everything is fine you should received a 4 informations about your: access_token, expires_in, refresh_token and token_type. Access_Token time is a little short so you need to know fuction possible to refresh it (tell Google that he should generate a new Token for you) #include <oAuth.au3> Local $sRefreshToken = "1/ba8JpW7TjQH3-UI1BvPaXhSf-oTQ4BmZAbBfhcKgKfY" Local $sClientId = "167204758184-vpeues0uk6b0g4jrnv0ipq5fapoig2v8.apps.googleusercontent.com" Local $sClientSecret = "cWalvFr3WxiE6cjUkdmKEPo8" Local $sRedirectUri = "http://localhost" Local $aRet = oAuth2RefreshAccessToken($sRefreshToken, $sClientId, $sClientSecret) If Ubound($aRet) <> 3 then ConsoleWrite("+++ Something wrong with reading ResponseText." & @CRLF) Exit EndIf ConsoleWrite("Successfully received data from Google." & @CRLF) ConsoleWrite("access_token: " & $aRet[0] & @CRLF) ConsoleWrite("expires_in: " & $aRet[1] & @CRLF) ConsoleWrite("token_type: " & $aRet[2] & @CRLF) 6. Finish words If you followed all this above steps im sure that you received all informations required for coding your Google API (Gmail, Dropbox, YouTube, Calender etc. See next thread: [UDF] Gmail API - Email automation with AutoIt!
-
hello guys, please i need your help am trying to work with CreateWindowEx api, i created the window with it controls, also i setup the call back function i'am using WinMSGLoop to focus with the keyboard. here i have a problem, i hope that you can help me. on the controls i used the UDF that comme with the autoit, such as _GUIButton_Create, _GUIListBox_Create.... but i can't find a STATIC control UDF, for that i used this local $h_ssrvlbl = _WinAPI_CreateWindowEx(0, "STATIC", "الخادم", BitOr($WS_VISIBLE, $WS_CHILD, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN), 250, 10, 100, 20, $hWnd) as you can see here, there is an arabic text, so here is the problem, the arabic text isn't show normally, what is the problem here? also i have an other question about keyboard focus, when i used WinMSGLoop, it worked, but if i press alt+tab to switch windows or focus an other window and return back to my window, the focus of control is kill. can any one help me to solve that please? my code will be as file here with the include files i hope can any one help me here thanks in advance speed Test win.zip
-
Recently I was working on TeamVierwer API . I had a little break, and wanted to check out another platform. Here is the result of my attempt: #include "GHAPI.au3" _GHAPI_AccessToken('b3e8.....de..........bdc3a0c.....bd27c6f') _GHAPI_GetUser("users/mLipok") _GHAPI_GetUserOrganizations("users/mLipok") _GHAPI_RootEndpoints() and GHAPI.au3 #include-once #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 #Tidy_Parameters=/sort_funcs /reel #Region GHAPI.au3 - Header ; #INDEX# ======================================================================================================================= ; Title .........: GHAPI UDF ; AutoIt Version : 3.3.10.2++ ; Language ......: English ; Description ...: This is an UDF for for communicate with https://api.github.com via GitHub RESTful API ; Author(s) .....: mLipok ; Modified ......: ; =============================================================================================================================== #cs Title: GHAPI UDF Filename: GHAPI.au3 Description: This is an UDF for for communicate with https://api.github.com via GitHub RESTful API Author: mLipok Modified: Last Update: 2017/05/23 Requirements: AutoIt 3.3.10.2 or higher #ce #EndRegion GHAPI.au3 - Header #Region GHAPI.au3 - Include #include <array.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #EndRegion GHAPI.au3 - Include #Region GHAPI.au3 - Declarations Global $oErrorHandler = ObjEvent("AutoIt.Error", "_GHAPI_ErrFunc") Global $__g_sGitHubAPI_BaseUrl = "https://api.github.com" ; URL of the GitHub API Global $__g_sGitHubAPI_Version = "v3" ; Put the current API version in here Global Enum _ $GHAPI_ERR_SUCCESS, _ $GHAPI_ERR_GENERAL, _ $GHAPI_ERR_COMERROR, _ $GHAPI_ERR_STATUS, _ $GHAPI_ERR_COUNTER Global Enum _ $GHAPI_EXT_DEFAULT, _ $GHAPI_EXT_PARAM1, _ $GHAPI_EXT_PARAM2, _ $GHAPI_EXT_PARAM3, _ $GHAPI_EXT_COUNTER Global Enum _ $GHAPI_RET_SUCCESS, _ $GHAPI_RET_FAILURE, _ $GHAPI_RET_COUNTER #EndRegion GHAPI.au3 - Declarations #Region GHAPI.au3 - API Functions Func _GHAPI_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 ;==>_GHAPI_ErrFunc Func _GHAPI_AccessToken($sParam = Default) ; https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ ; https://github.com/settings/tokens Local Static $sAccessToken = '' If $sParam <> Default Then $sAccessToken = $sParam Return $sAccessToken EndFunc ;==>_GHAPI_AccessToken Func _GHAPI_GetUser($sUser) Local $oHTTP = __GHAPI_HTTP_Open("GET", $sUser) Local $oJSON = __GHAPI_HTTP_Send($oHTTP) If @error Then Return SetError(@error, @extended, False) #forceref $oJSON EndFunc ;==>_GHAPI_GetUser Func _GHAPI_GetUserOrganizations($sUser) Local $oHTTP = __GHAPI_HTTP_Open("GET", $sUser & '/orgs') Local $oJSON = __GHAPI_HTTP_Send($oHTTP) If @error Then Return SetError(@error, @extended, False) #forceref $oJSON EndFunc ;==>_GHAPI_GetUserOrganizations Func _GHAPI_RootEndpoints() Local $oHTTP = __GHAPI_HTTP_Open("GET", '') Local $oJSON = __GHAPI_HTTP_Send($oHTTP) If @error Then Return SetError(@error, @extended, False) #forceref $oJSON EndFunc ;==>_GHAPI_RootEndpoints #EndRegion GHAPI.au3 - API Functions #Region GHAPI.au3 - INTERNAL Functions Func __GHAPI_HTTP_Open($sMethod, $sCommand, $sURLParameters = '') Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") Local $sURL = $__g_sGitHubAPI_BaseUrl & "/" & $sCommand & $sURLParameters ;~ __GHAPI_DebugOut("> $sURL=" & $sURL & @CRLF) $oHTTP.Open($sMethod, $sURL, False) If @error Then Return SetError(@error, @extended, Null) $oHTTP.setRequestHeader("Authorization", "Bearer " & _GHAPI_AccessToken()) ; Accept: application/vnd.github.v3+json $oHTTP.setRequestHeader("Accept", "application/vnd.github." & $__g_sGitHubAPI_Version & "+json") ; User-Agent: Awesome-Octocat-App $oHTTP.setRequestHeader("User-Agent", "AutoIt UDF") Return $oHTTP EndFunc ;==>__GHAPI_HTTP_Open Func __GHAPI_HTTP_Send(ByRef $oHTTP, $sSendParameter = Default) If $sSendParameter = Default Then $oHTTP.Send() Else $oHTTP.Send($sSendParameter) EndIf ConsoleWrite('+' & $oHTTP.Status & @CRLF) ConsoleWrite('>' & $oHTTP.StatusText & @CRLF) ConsoleWrite($oHTTP.ResponseText & @CRLF) ConsoleWrite(@CRLF) If @error Then Return SetError(@error, @extended, $GHAPI_RET_FAILURE) ;~ Return SetError($GHAPI_ERR_SUCCESS, $oJSON.Size, $oJSON) EndFunc ;==>__GHAPI_HTTP_Send #EndRegion GHAPI.au3 - INTERNAL Functions #Region GHAPI.au3 - HOWTO / DOCS / HELP #CS https://developer.github.com/v3/ https://developer.github.com/v3/guides/ https://developer.github.com/program/ https://github.com/contact?form%5Bsubject%5D=New+GitHub+Integration https://developer.github.com/ http://stackoverflow.com/questions/28796941/github-api-authentication-with-msxml2-xmlhttp #CE #EndRegion GHAPI.au3 - HOWTO / DOCS / HELP REMARKS: This is just a modest start up and not a whole fully workable UDF, just so for a try, but maybe someone will be useful Regards, mLipok EDIT 1: If you need to make it workable just ask about specyfic feature. EDIT 2: Some changes in using word "GitHub" - to meet this rules: https://github.com/logos
-
Hi all, Recently my work swapped from Cisco CTIOS to Finesse. This completely threw me off as I had been automating the Win32 application and I had never done IUIAutomation before. As such I've been messing around with the API and will be adding code as I figure it out. While I do have Supervisor access, I will likely not be adding functions for those features yet. Currently Available Functions: User API - Query and Set User Info Dialog API - Query and Set Call and other Dialog Info Queue API - Query Assigned Queues Team API - Query Users in a Team Changelog: Download: Support: Support for this UDF can be obtained in my Discord Server
-
goodmorning autoit team today am comming with some winhttp problems, i hope that you can help me to solve them. the first problem is when opening a request my forums api allow me to delete any post using the api key all functions work, i mean post / get but when i tried to use the delete verb it's gave me an html 404 error here is what am tried #include "WinHttp.au3" ; Open needed handles Global $hOpen = _WinHttpOpen() Global $hConnect = _WinHttpConnect($hOpen, "xxxxxxxx.com") ; Specify the reguest: Global $hRequest = _WinHttpOpenRequest($hConnect, "Delete", "/vb/Api/posts/10447/?hard_delete=true", default, default) _WinHttpAddRequestHeaders($hRequest, "XF-Api-Key:xxxxx") _WinHttpAddRequestHeaders($hRequest, "XF-Api-User:xxxxx") ; Send request _WinHttpSendRequest($hRequest) ; Wait for the response _WinHttpReceiveResponse($hRequest) Global $sHeader = 0, $sReturned = 0 ; If there is data available... If _WinHttpQueryDataAvailable($hRequest) Then $sHeader = _WinHttpQueryHeaders($hRequest, $WINHTTP_QUERY_CONTENT_DISPOSITION) ;Or maybe: ; $sHeader = _WinHttpQueryHeaders($hRequest, BitOR($WINHTTP_QUERY_RAW_HEADERS_CRLF, $WINHTTP_QUERY_CUSTOM), "Content-Disposition") Do $sReturned &= _WinHttpReadData($hRequest) Until @error msgBox(64, "", $sReturned) endIf ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) and here is the error message <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>403 Forbidden</title> </head><body> <h1>Forbidden</h1> <p>You don't have permission to access /vb/Api/posts/10447/ on this server.<br /> </p> </body></html> i hope you can help me thanks in advance
-
Hi mates, well this is my first contribution. a simple UDF to use Virustotal API v2.0 The response return is not parsed|splitted. requires >WinHttp UDF Functions List: Update: Now a Only Function using a flags for respective mode. VT() Use respective flag($Type) VT(ByRef $aAPI, $Type, $sResource, $sAPIkey,$Comments="") flags($Type) $fReport = retrieve a scan report on a given file $fScan = submit a file for Scanning $fRescan = Rescan files in VirusTotal's file store $uReport = retrieve a scan report on a given URL $uScan = submit a URL for Scanning $Comment = Make a commnet on files and URLs Example: #include <Crypt.au3> #include "VT.au3" Example() Func Example() _Crypt_Startup() Local $sFilePath = @WindowsDir & "\Explorer.exe" Local $bHash = _Crypt_HashFile($sFilePath, $CALG_MD5) _Crypt_Shutdown() Local $hVirusTotal = VT_Open() Local $APIkey='Your API key' ConsoleWrite(VT($hVirusTotal, $fReport, '20c83c1c5d1289f177bc222d248dab261a62529b19352d7c0f965039168c0654',$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $fScan, $sFilePath,$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $fRescan, hex($bHash),$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $uReport, "http://www.virustotal.com",$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $uScan, "http://www.google.com",$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $Comment, hex($bHash) ,$APIkey,"Hello Word | Hola Mundo") & @CRLF) VT_Close($hVirusTotal) ; EndFunc ;==>Example Saludos VT.au3
- 51 replies
-
- Virustotal
- POST
- (and 4 more)
-
Has anyone successfully developed integration with the E*TRADE API in AutoIt? If so, then would you be willing and able to share some of your AutoIt code to do so with me? and/or help me successfully develop an AutoIt interface with the E*TRADE API? Please also Reply at: http://blog.thevcf.com/forums/topic/etrade-api/#post-4032 Thank You and Have a Great Day! - Michael S. DeVries
-
Hello friends, i have a working curl command that show informations about my account on binance.com, but_it dont work with autoit code without curl.exe. I want to do it without curl, because the whole process much Slower_ with StdoutRead (I want get the response in variable.) My Curl command in Autoit: This 2 are works, but_ i would like to do it without curl.exe $apikey="XYZ" sCommand = @ScriptDir & '\curl.exe -k -H "X-MBX-APIKEY: ' & $apikey & '" -X GET "https://api.binance.com/api/v3/account?' & $request the same in .bat file curl.exe -k -H "X-MBX-APIKEY: XYZ" -X GET "https://api.binance.com/api/v3/account?timestamp=1514917812000&signature=85bdee77e53cd521e1d5229fbfb459d53799c42b3fa4596d73f1520fad5f965a" (I use curl with -k option which allows curl to make insecure connections, because there is problem with the sites certificate, (cURL error 60)) I tried many variations, this is the latest... I cant get the same response. curl $error message (I changed ): {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."} autoit version $error message (Response code:400): Mandatory parameter 'timestamp' was not sent, was empty/null, or malformed. $request = $query & '&signature=' & $signature $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", "https://api.binance.com/api/v3/account", False) $oHTTP.SetRequestHeader("X-MBX-APIKEY", $apikey) $oHTTP.Send($request) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status If $oStatusCode <> 200 then MsgBox(4096, "Response code", $oStatusCode) EndIf thanks
-
Hi, I was wondering if someone can help me to create an AutoIT script which can create a ticket in a TopDesk environment. The API is wel documented, but i have not enough knowlegde at this moment to get this up from the ground. If someone could help me or if i could hire / pay someone to help me with this, that would be great. Information about the API can be found here: https://developers.topdesk.com/ Is there a place where i maybe can hire AutoIT professionals to help me with this? On freelancer.com is an option, but there are alot of people responding which doesn't know a thing about AutoIT.
- 1 reply
-
- api
- freelancer
-
(and 1 more)
Tagged with:
-
Hi All i am currently trying to add a function to my project that can send SMS, i have gone with Twilio for the sms service that use a REST API. I have never worked with an API before, and could use some help. I can get my function working with using cURL.exe and copy past command from the website with the following code. And thats great unfortunately i am have issue with character like æøå when sending a SMS appears like a box or ?. this does not happen if i do it from the website so it looks like a Unicode issue in curl.exe. I have done some searching on the forum and understand that i should be able to implement this curl command with the WinHTTP UDF from @trancexx so i don't need a third part exe and it might fix my charater issue. Unfortunately i really don't understand how i am to change curl commands to the WinHTTP and i was hoping some good maybe give me an example i could learn from. Thanks in advanced i have removed the AuthToken number from the script. _SendSMS("00000000","SomeOne","SMS body info") Func _SendSMS($SendTo,$SendFrom,$Msgtxt) $AccountSID = "ACbb765b3180d5938229eff8b8f63ed1bc" $AuthToken = "Auth Token number" $Data = '"https://api.twilio.com/2010-04-01/Accounts/'&$AccountSID&'/Messages.json"'& _ '-X POST \ --data-urlencode "To=+45'&$SendTo&'" \ --data-urlencode "From='&$SendFrom&'" \ --data-urlencode "Body='&$Msgtxt&'" \ -u '&$AccountSID&':'&$AuthToken&'' ShellExecute(@ScriptDir&"\curl.exe","-k "&$Data) ;~ curl 'https://api.twilio.com/2010-04-01/Accounts/ACbb765b3180d5938229eff8b8f63ed1bc/Messages.json' -X POST \ ;~ --data-urlencode 'To=+4500000000' \ ;~ --data-urlencode 'From=Reception' \ ;~ --data-urlencode 'Body=Test Body' \ ;~ -u ACbb765b3180d5938229eff8b8f63ed1bc:[AuthToken] EndFunc
-
Dear master, hello, I got the speech API from Google. But I could not find how to use. Could you help me with a simple example? "https://speech.googleapis.com/v1/speech:recognize?key=MyKey"
-
Hi Guys, I have been trying to write the API calls to Coinigy.com in AutoitScipt. I have managed to solve most of them put are having trouble with the ones that require parameters to be passed. The source to the API calls can be found here: http://docs.coinigy.apiary.io/#reference/market-data/market-data/data-{type:history} Example code from this site: curl --include \ --request POST \ --header "Content-Type: application/json" \ --header "X-API-KEY: " \ --header "X-API-SECRET: " \ --data-binary " { \"exchange_code\": \"GDAX\", \"exchange_market\": \"BTC/USD\", \"type\": \"history\" }" \ ' https://api.coinigy.com/api/v1/data ' This data one is really annoying me. I have the following so far: #include <Array.au3> #include <string.au3> #include <MsgBoxConstants.au3> #Region Coinigy Const Global $sCoinigyAPIUrl = "https://api.coinigy.com/api/v1/" #EndRegion Coinigy Const #Region keys Global Const $sCoinigyAPIKey = "" ; just removed my APIKey Global Const $sCoinigyAPISecret = "" ; just removed my APISecret #EndRegion keys $sResults = CoinigyQueryPrivate("data", "exchange_code=GDAX&exchange_market=BTC/USD&type=history") ; Trade history, asks and bids for any supported exchange/market ConsoleWrite("Market Data: " & $sResults & @CRLF & @CRLF) Func CoinigyQueryPrivate($sMethod, $sParameters) Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $sCoinigyAPIUrl & $sMethod, False) $oHTTP.SetRequestHeader("X-API-KEY", $sCoinigyAPIKey) $oHTTP.SetRequestHeader("X-API-SECRET", $sCoinigyAPISecret) ; $oHTTP.Send(Binary($sParameters)) ; tried this as well $oHTTP.Send($sParameters) Local $sReceived = $oHTTP.ResponseText Return $sReceived EndFunc ;==>CoinigyQueryPrivate If I do other queries that don't require Parameters they work perfectly. I am just totally stumped by the parameter passing queries. I have tried everything and I still can't get it to go. Would really appreciate some help. If you want to try for yourself live, Coinigy.com give a free 30 trial.... Please help... Thanks in advance.
-
Skype UDF v1.2 Introduction :Skype4COM represents the Skype API as objects, with :methodspropertieseventscollectionscachingSkype4COM provides an ActiveX interface to the Skype API. Develop for Skype in a familiar programming environment, such as Visual Studio or Delphi, using preferred scripting languages such as VBScript, PHP, or Javascript. Requirements : Skype 3.0+ must be installedWindows 2000, XP+ Update : Version 1.2 Fixed _Skype_ProfileGetHandle function Version 1.1 Fixed _Skype_ChatGetBookmarked function Added missing _Skype_ChatGetTopic function Version 1.0 Fixed _Skype_ChatGetAll function Version 0.9 Fixed Mute value returned by the _Skype_OnEventMute callback function Version 0.8 Error ObjEvent is set if none already set Version 0.7 Changed _Skype_GetChatActive to _Skype_GetChatAllActive Version 0.6 Added _Skype_GetCache Added _Skype_SetCache Changed Skype_Error function Minor bugs fixed Version 0.5 Fixed _Skype_ChatCreate Version 0.4 Fixed _Skype_ChatGetMessages Fixed "Skype - SciTE.au3" script Version 0.3 Minor changes Updated Skype in AutoIt example Version 0.2 Fixed _Skype_ChatAddMembers Various bugs fixed _Functions list : (346) Example GUI : Notes : Skype's access control must be accepted manually :After running the example script, click on the "Allow access" button of SkypeThis version is NOT complete If you are running on a 64 bits OS, add this line to your script : #AutoIt3Wrapper_UseX64=n Attachments :Pack (UDF + ExampleGUI)Version 1.2 : Skype-UDF_1.0.0.2.zip Examples : (put them into the "Example folder")-Answers to incomming calls even if you are already in a call : Auto Answer.au3-Shows how to use the OnMute event : Mute Event.au3 Happy coding
-
So I have been bashing my head in for a couple days and have searched both AutoIT forums and Thwack Forums for an answer. I understand this could be hard to help sense I can't provide a server for someone to help me test against. I am trying to use the WinHTTP.au3 to connect with Solarwinds Orion SDK thru REST/JSON api calls. Here is the documentation that they provide. https://github.com/solarwinds/OrionSDK/wiki/REST I have been trying just to make a basic connection but for some reason cannot get past the authorization process with WinHTTP. Here is my test code. #Region Includes #include <log4a.au3> #include "WinHttp.au3" #EndRegion Global $sAddress = "https://usandl0213:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+NodeID+FROM+Orion.NODES" Global $array_URL = _WinHttpCrackUrl($sAddress) ;~ Row|Col 0 ;~ [0]|https ;~ [1]|2 ;~ [2]|usandl0213 ;~ [3]|17778 ;~ [4]| ;~ [5]| ;~ [6]|/SolarWinds/InformationService/v3/Json/Query ;~ [7]|?query=SELECT+NodeID+FROM+Orion.NODES Global $hOpen = _winhttpOpen() If @error Then _log4a_Fatal("Error intializing the usage of WinHTTP functions") Exit 1 EndIf Global $hConnect = _winhttpConnect($hOpen, $array_URL[2]) If @error Then _log4a_Fatal("Error specifying the initial target server of an HTTP request.") _WinHttpCloseHandle($hOpen) Exit 2 EndIf Global $hRequest = _WinHttpOpenRequest($hConnect, _ "GET", _ "/SolarWinds/InformationService/v3/Json/Query?query=SELECT+NodeID+FROM+Orion.NODES", _ "HTTP/1.1") If @error Then _log4a_Fatal(MsgBox(48, "Error", "Error creating an HTTP request handle.") _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) Exit 3 EndIf _WinHttpAddRequestHeaders($hRequest, "Authorization: Basic YXV0b2l0X2xvZ2luOnRlc3Q=") _WinHttpAddRequestHeaders($hRequest, "User-Agent: curl/7.20.0 (i386-pc-win32) libcurl/7.20.0 OpenSSL/0.9.8l zlib/1.2.3") _WinHttpAddRequestHeaders($hRequest, "Host: usandl0213:17778") _WinHttpAddRequestHeaders($hRequest, "Accept: */*") _WinHttpSendRequest($hRequest) If @error Then MsgBox(48, "Error", "Error sending specified request.") Close_request() Exit 4 EndIf ; Wait for the response _WinHttpReceiveResponse($hRequest) If @error Then MsgBox(48, "Error", "Error waiting for the response from the server.") Close_request() Exit 5 EndIf Global $sChunk, $sData ; See what's returned If _WinHttpQueryDataAvailable($hRequest) Then Global $sHeader = _WinHttpQueryHeaders($hRequest) ;~ ConsoleWrite(@crlf) ConsoleWrite($sHeader & @CRLF) ; Read While 1 $sChunk = _WinHttpReadData($hRequest) If @error Then ExitLoop $sData &= $sChunk WEnd ConsoleWrite($sData & @CRLF) ; print to console Else MsgBox(48, "Error", "Site is experiencing problems.") EndIf Close_request() Func Close_request() ; Close open handles and exit _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) EndFunc I am definitely connecting to the server but get a 401 Unauthorized response. Output of above script: Header: HTTP/1.1 401 Unauthorized Cache-Control: private Date: Thu, 27 Jul 2017 15:31:21 GMT Content-Length: 1668 Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.5 Set-Cookie: ASP.NET_SessionId=lgwin2qsbbrip2mxg01fot05; path=/; HttpOnly Set-Cookie: TestCookieSupport=Supported; path=/ Set-Cookie: Orion_IsSessionExp=TRUE; expires=Thu, 27-Jul-2017 17:31:21 GMT; path=/ WWW-Authenticate: Negotiate WWW-Authenticate: NTLM X-UA-Compatible: IE=9 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET X-Same-Domain: 1 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Body: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><link rel="stylesheet" type="text/css" href="/orion/js/jquery-1.7.1/jquery-ui.css.i18n.ashx?l=en-US&v=42660.90.L&csd=%23b0b9c5;%23d2ddec;%2392add1;" /> <link rel="stylesheet" type="text/css" href="/orion/styles/orionminreqs.css.i18n.ashx?l=en-US&v=42660.90.L&csd=%23b0b9c5;%23d2ddec;%2392add1;" /> <link rel="stylesheet" type="text/css" href="/webengine/resources/steelblue.css.i18n.ashx?l=en-US&v=42660.90.L&csd=%23b0b9c5;%23d2ddec;%2392add1;" /> <link rel="stylesheet" type="text/css" href="/orion/ipam/res/css/sw-events.css.i18n.ashx?l=en-US&v=42660.90.L&csd=%23b0b9c5;%23d2ddec;%2392add1;" /> <script type="text/javascript" src="/orion/js/orionminreqs.js.i18n.ashx?l=en-US&v=42660.90.L"></script> <script type="text/javascript" src="/orion/js/modernizr/modernizr-2.5.3.js.i18n.ashx?l=en-US&v=42660.90.L"></script> <script type="text/javascript" src="/orion/js/jquery-1.7.1/jquery-1.7.1.framework.min.js.i18n.ashx?l=en-US&v=42660.90.L"></script> <script type="text/javascript">(function(){var de=$(document.documentElement); de.addClass('sw-is-locale-en'); $.each(jQuery.browser,function(k,v){if(v===true){ de.addClass('sw-is-'+k); de.addClass('sw-is-'+k+'-'+parseInt(jQuery.browser.version)); }}); })();</script> <script type="text/javascript">SW.Core.Loader._cbLoaded('jquery');</script> <script type="text/javascript">SW.Core.Date._init(0,-14400000);</script> <title> </title></head> <body> <script> window.location = 'Login.aspx'; </script> </body> </html> To me this looks like it if it is still looking for my credentials. I did verify that things work as expected using Chrome and REST test client. I do get certificate errors in IE if I try to go directly. Bypass certificate issues and page will try to save out to .json file Looking for any help.
- 8 replies
-
- winhttp
- solarwinds
-
(and 1 more)
Tagged with:
-
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 ; ================================================================================ 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 You can download it here: I'm using TeamViewer_Example.ini to store my secret tokens/keys. [Settings] AccessToken= [OAuth2] ClientID= ClientSecret= authorizationCode=
-
I posted this the other day, but thought I would post in a separate topic instead. #include <MsgBoxConstants.au3> ; ---- Start of Person Class ; Stored in the 'object' to verify it's our 'object' and not some random array Global Const $PERSON_GUID = '4197B285-6AB1-489B-8585-08C852E33F3D' ; Friendly names for 0, 1, 2 and 3 Global Enum $PERSON_AGE, $PERSON_NAME, $PERSON_ID, $PERSON_MAX ; Constructor Func Person($sName, $iAge) Local $hPerson[$PERSON_MAX] ; Set the GUID, so as the verification will work $hPerson[$PERSON_ID] = $PERSON_GUID Person_SetAge($hPerson, $iAge) Person_SetName($hPerson, $sName) ; Return the Person 'object' Return $hPerson EndFunc ;==>Person ; Getter for the age property Func Person_GetAge(ByRef $hPerson) Return _Person_IsObject($hPerson) ? $hPerson[$PERSON_AGE] : Null EndFunc ;==>Person_GetAge ; Setter for the age property Func Person_SetAge(ByRef $hPerson, $iAge) ; If not a valid 'object' or integer then return If Not _Person_IsObject($hPerson) Or Not IsInt($iAge) Then Return ; Set the age $hPerson[$PERSON_AGE] = $iAge EndFunc ;==>Person_SetAge ; Getter for the name property Func Person_GetName(ByRef $hPerson) Return _Person_IsObject($hPerson) ? $hPerson[$PERSON_NAME] : Null EndFunc ;==>Person_GetName ; Setter for the name property Func Person_SetName(ByRef $hPerson, $sName) ; If not a valid 'object' then return If Not _Person_IsObject($hPerson) Then Return ; Set the name $hPerson[$PERSON_NAME] = $sName EndFunc ;==>Person_SetName ; ToString() for the 'object' Func Person_ToString(ByRef $hPerson) Return _Person_IsObject($hPerson) ? StringFormat('Name: %s, Age: %i', $hPerson[$PERSON_NAME], $hPerson[$PERSON_AGE]) : Null EndFunc ;==>Person_ToString ; Check if it's a valid 'object' and not some random array. "NTERNAL ONLY! Func _Person_IsObject(ByRef $hPerson) Return UBound($hPerson) = $PERSON_MAX And $hPerson[$PERSON_ID] == $PERSON_GUID EndFunc ;==>_Person_IsObject ; ---- End of Person Class Example() Func Example() ; Store the Person 'object', which is just a glorified array Local $hP1 = Person('John', 30) ; Display the 'object' MsgBox($MB_SYSTEMMODAL, 'Person 1', Person_ToString($hP1)) ; Create a new person ; Store the Person 'object', which is just a glorified array Local $hP2 = Person('James', 36) ; Display the 'object' MsgBox($MB_SYSTEMMODAL, 'Person 2', Person_ToString($hP2)) ; Set the age for Person 2 Person_SetAge($hP2, 45) ; Display the 'object' MsgBox($MB_SYSTEMMODAL, 'Person 2 - Revised', Person_ToString($hP2)) EndFunc ;==>Example
-
Hey guys, I'm looking to implement an accurate voice recognition method in my program. I tried to understand the Microsoft SAPI API, read their online documentation and found it very confusing and unclear. (Like seriously, it's so bad and vague, but that's just my opinion). I have also tried using UTTER UDF, but could not get a grasp either, because you know, that's an extension UDF to Microsoft SAPI. Let's face it, the Google Speech Recognition is much more accurate than Microsoft SAPI (by far). Right now, I am determined to just use the Google Speech API. I have dug deep in regards to implementing the Google Speech API in AutoIT and I haven't found even one post about it. I suppose it's because the Google Speech API was only recently made available to the public. In case you don't know what I'm talking about, here's the link to google api. On that page, notice that there is language support for various languages such as Java, C#, and PHP. However, there's no support for AutoIT. So my question is; how can I go about implementing the Google Speech API into my AutoIT program? Is it even possible? Cheers guys!
- 1 reply
-
- recognition
-
(and 2 more)
Tagged with:
-
Version 1.0.0
644 downloads
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 -
I've run into the problem where multiple script processes writing to a log file at the same time can interfere with one another. That is, file writes using FileWriteLine are not atomic, so a line of text from one process can have fragments of text from other processes mixed in with it. Exclusive file-locking should take care of the problem. Looking through the standard UDFs, I see that _WinAPI_LockFile is available, but according to the MSDN documentation it doesn't block - it returns immediately if the lock can't be obtained - and there doesn't seem to be a UDF for the LockFileEx function. I considered writing my own UDF for LockFileEx, but some aspects (e.g., creating the OVERLAPPED structure and its members) look too complex for the amount of time I have available. I think approximating LockFileEx using LockFile could solve my problem, but I'd like to keep it simple while still working reliably. I'm not confident that (e.g.) a simple retry loop to simulate blocking will be adequate. Any suggestions for a simple way to achieve exclusive file-locking with blocking?
-
Hello, I will put it as simple as possible Why this code runs perfectly on 32bit and it fails on 64bit? Local $hWND = WinGetProcess("[CLASS:LSS_app]") ConsoleWrite($hWND & @LF) Local $hModuleList = _WinAPI_EnumProcessModules($hWND) If @error Then ConsoleWrite("Error: " & @error & @LF) For $i = 0 To $hModuleList[0][0] - 1 ;~ If StringInStr($hModuleList[$i][1], "sysCap64.dll") Then ConsoleWrite($hModuleList[$i][0] & @LF) ;~ EndIf Next As the title says EnumProcessModules returns error 10 which I have no clue what it is. It must be something with autoit or my lack of coding because a similar code in C# will work like a charm on both x86 and x64 Process[] Processes = Process.GetProcessesByName("winLSS64Cap"); Process nProcess = Processes[0]; Handle = OpenProcess(0x10, true, (uint)nProcess.Id); for(int i = 0; i < nProcess.Modules.Count; i++) { Console.WriteLine(nProcess.Modules[i].ModuleName); }
-
I'm trying to use Sendspace API for download and upload, until now i only have learned to get token, login and get session key. My next step is upload a file. But i have no idea how to do this part. ; try to upload something ; Specify the reguest to upload.getInfo: Local $hRequest = _WinHttpOpenRequest($hConnect, Default, "/rest/?method=upload.getinfo&session_key=" & $SessonKey & "&speed_limit=0") ; Send request Local $handle = _WinHttpSendRequest($hRequest) ; Wait for the response Local $WaitRS = _WinHttpReceiveResponse($hRequest) ; Read Data Local $sData = _WinHttpReadData($hRequest) MsgBox(0, "Upload Data", $sData) _filewrite($sData) ; Get all info needed from $sData $URL = _StringBetween($sData, "<upload url=", "progress") $sURL = $URL[0] $MaxFileSize = _StringBetween($sData, "max_file_size=", "progress") $sMaxFileSize = $MaxFileSize[0] $Upload_Identifier = _StringBetween($sData, "upload_identifier=", "&") $sUpload_Identifier = $Upload_Identifier[0] $ExtraInfo = _StringBetween($sData, "extra_info=", "/>") $sExtraInfo = $ExtraInfo[0] ;All well done until here ;Fill in form $XML = '<form method="post" action="' & $sURL & 'enctype="multipart/form-data">' & @CRLF $XML &= '<input type="hidden" name="MAX_FILE_SIZE" value=' & $sMaxFileSize & '>' & @CRLF $XML &= '<input type="hidden" name="UPLOAD_IDENTIFIER" value=' & $sUpload_Identifier & '>' & @CRLF $XML &= '<input type="hidden" name="extra_info" value=' & $sExtraInfo & '>' & @CRLF $XML &= '<input type="file" name=' & "C:\Users\Arlen\Desktop\premisa mrotal.txt" & '>' & @CRLF $XML &= '</form>' MsgBox(0,"", $XML) ; Now how do i send it? Is it correct? _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) sendspace_api_guide.pdf