About This File

This .au3 file will take the trouble out of trying to gain your dropbox oauth_access_token and oauth_access_token_secret by doing it for you. when first run the program it will create an empty folder on your desktop. As you progress through the application it will create text files as needed. Be sure to follow each of the message box's instructions as it is vital that each step be completed before moving onto the next. Enjoy :)

User Feedback

You may only provide a review once you have downloaded the file.


  • 5

Share this review

Link to review
  • Similar Content

    • dgm5555
      Dropbox Uploader
      By dgm5555
      I'd like to create a dropbox uploader (and downloader) to provide a simple file sync without using the dropbox app.
      The following is my current code (cadged and modified from other posts and websites), but I can't even figure out how to get initial authorization. Can anyone help?
      NB I would be quite happy to use the oauth2 Generated access token if it bypassed a lot of this, but I'm not sure how to do this.
      (If you can't guess, I know virtually nothing about http calls)
      Alternatively if there is a working autoit dropbox up/downloader, I'm more than happy not to write my own (but couldn't find one)
      #include "WinHttp.au3" ; set the dropbox tokens ;to get the dropbox app_key and app_secret tokens, browse to https://www.dropbox.com/developers/apply?cont=/developers/apps and create a new app If $App_Key = "" Then $File = "" $App_Key = "" $App_secret = "" $Oauth_access_token = "" $Oauth_access_token_secret = "" ; this could possibly the personal Oauth2 Generated access token $App_folder = "" ; this is the name of your app - it's not currently needed in this code ; the folder where the uploaded file will be stored is: Dropbox/Apps/$App_folder EndIf Local $sURL = "https://api.dropbox.com/1/oauth/request_token " & _ "Authorization: OAuth oauth_version=""1.0"", oauth_signature_method=""PLAINTEXT"", " & _ "oauth_consumer_key=""" & $App_Key & """, " & _ "oauth_signature=""" & $App_secret & "&""" $hOpen = _WinHttpOpen() $FileHandle = FileOpen($File) $hConnect = _WinHttpConnect($hOpen, $sURL) $hRequest = _WinHttpOpenRequest($hConnect, "POST") _WinHttpReceiveResponse($hRequest) $sResult = "" Do $sResult &= _WinHttpReadData($hRequest) Until @error ;MsgBox(0, "", $sResult) ConsoleWrite($sResult & @CRLF) _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; response should be: ;oauth_token=<request-token>&oauth_token_secret=<request-token-secret> ;user will have to browse to the following and authorise the app ;https://www.dropbox.com/1/oauth/authorize?oauth_token=<request-token> ; you now need to generate an access token ; POST https://api.dropbox.com/1/oauth/access_token ; Header will be: ;Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="<app-key>", oauth_token="<request-token>", oauth_signature="<app-secret>&<request-token-secret>" ;reponse will be: ;oauth_token=<access-token>&oauth_token_secret=<access-token-secret>&uid=<user-id> ;now you can access the account and undertake actions ;eg get account info: ;GET https://api.dropbox.com/1/account/info ;Header: ;Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="<app-key>", oauth_token="<access-token>", oauth_signature="<app-secret>&<access-token-secret>" ; this function doesn't work, it will need to be modified to allow upload func upload($App_Key, $App_secret, $Oauth_access_token, $Oauth_access_token_secret, $File="") trayseticon("C:\Program Files\AutoIt3\Icons\cute panda.ico", -1) ; Get the file to upload Local $sDrive = "", $sDir = "", $sFilename = "", $sExtension = "" local $time=@HOUR & ":" & @MIN & ":" & @SEC local $Random = Random(0,32767,1) ; if a filename isn't passed to the function, then ask the user for one If $File = "" Then $File = fileopendialog("Pick something to upload", @desktopdir, "All (*.*)|Text files (*.txt)" ) EndIf ;message($File) ; Now open the file and load the data into memory local $array = _PathSplit($File,$sDrive, $sDir, $sFilename, $sExtension) ; get the file name and extension Local $i = UBound($array) - 1 local $sFile = fileopen($File,16) Local $data = fileread($sFile) local $size = @extended FileClose($File) ;set up the dropbox upload URL ;to get the dropbox tokens, browse to https://www.dropbox.com/developers/apply?cont=/developers/apps and create a new app ;$array[$i-1] is the file name of the file the user wants to upload and $array[$i] is the extension Local $sUrl = ("https://api-content.dropbox.com/1/files_put/dropbox"&"/"& $array[$i-1] & $array[$i] & _ '?oauth_consumer_key=' & $App_Key & _ " & oauth_token=" & $Oauth_access_token & _ " & oauth_signature_method=PLAINTEXT & oauth_signature=" & $App_secret & "%26" & $Oauth_access_token_secret & _ " & oauth_timestamp=" & $time & _ " & oauth_nonce=" & $RANDOM) ;Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", ;oauth_consumer_key="<app-key>", oauth_token="<access-token>", ;oauth_signature="<app-secret>&<access-token-secret>" msgbox(1,"URL",$sUrl) ; now attempt to upload the file with the generated dropbox URL Local $obj = ObjCreate("WinHttp.WinHttpRequest.5.1") ;message("here") $obj.Open("PUT", $sURL, False) If @error Then MsgBox(1,"ERROR","@1unable to upload" & " " &$array[$i-1] & $array[$i]) else ; message("request opened") $obj.SetRequestHeader("User-Agent", "User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0") ;$obj.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $obj.SetRequestHeader("Content-Length", $size) ; if _FindNetwork() = "xavier" Then ; $obj.SetProxy(2, "number") ; endif ; message($sFile) $obj.Send($data) ; send the file to uploaded $oReceived = $obj.ResponseText $oStatusCode = $obj.Status If $obj.Status <> $HTTP_STATUS_OK Then ; local $FindError = FindError($oStatusCode) ; message($oReceived) msgbox(0 , "Error", "@2" & $oStatusCode & " :unable to upload " & $array[$i-1] & $array[$i]) else msgbox(0 , "success", "uploaded " & $array[$i-1] & $array[$i]) endif trayseticon("C:\Program Files\AutoIt3\Icons\panda.ico", -1) endif endfunc  
    • ludocus
      Program blocks automated mouse movement, how to override?
      By ludocus
      Dear all,
      I'm creating this program where the goal is to automate some mouse -click and dragging on an external application.
      Now the problem is, this external application is blocking every automate mouse moves, clicks or anything related to using the mouse.
      So I figured autoit uses postmessage and user32.dll to move the mouse and that this application blocks these attempts.
      Now I'm wondering if there's a different way to move the mouse so it'll go undetected by this external app.
      Any other suggestions are welcome to.
      Thnx in advance
    • wakillon
      SharedLink2DirectLink v1.0.0.9
      By wakillon
      Using GoogleDrive for store my files, some days ago, i discover those nice messages :
      It is certain that if someone wants downloaded my files, such messages is not very encouraging !
      So, don't know which incompetent AV Google use, but i decided to try some other files hosters.
      I have made this script last year for GoogleDrive, but tired of false positives, i adapted it to OneDrive and Dropbox too. 
      Added the possibility to create a Html ShortcutRedirector as i use in my topics for download files.

      Buttons were made online with chimply.com the easy and free buttons generator !
      Source : SharedLink2DirectLink v1.0.0.9.au3.html
      Executable : SharedLink2DirectLink.exe.html
      Hope it can help someone ! 
    • adamchapman
      http getrequeststream
      By adamchapman
      I'm trying t upload a file to dropbox using the dropbox RESTful API. 
      In the last section on the page at http://cgeers.com/2012/03/11/dropbox-rest-api-part-5-file-upload/ , 
      the author uses a method "GetRequestStream"
      Everything I've done so far with the dropbox API has utilised a winhttp object, with the structure below:
      $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $URL, false) $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $authString = 'OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="'& $key & '", oauth_token="' & $accessToken & '", oauth_signature="' & $secret & '&' & $accessSecret & '"' $oHTTP.SetRequestHeader("Authorization",$authString) ; Performing the Request $oHTTP.Send() ; Download the body response if any, and get the server status response code. $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status Now I need a GetRequestStream() mehod, I'm not sure if there is a facility to do this.
      I've tried $oHTTP.GetRequestStream() but it just threw an error
      If anybody can offer some insight It would be a great help

    • adamchapman
      http post with header for oauth
      By adamchapman
      I've been trying all day to get a "request token" from the dropbox rest-api.
      Basically I'm trying to perform step 1 at https://www.dropbox.com/developers/blog/20/using-oauth-in-plaintext-mode:
      " 1. Make an API call for a request token:
      POST https://api.dropbox.com/1/oauth/request_token
      Your HTTP request should have the following header:
      Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="<app-key>", oauth_signature="<app-secret>&"
      The response body will be a url-encoded string:
      Parse out the request token and secret and save them somewhere."
      I'm really struggling with how to send the header properly. 
      Copying the example at http://brugbart.com/http-post-request-autoit, I have: 
      ; The data to be sent $sPD = 'Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="h9y2pwy1nbvzy5e", oauth_signature="imrgkd8i80c2b8g&"' ; Creating the object $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "https://api.dropbox.com/1/oauth/request_token", False) $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") ; Performing the Request $oHTTP.Send($sPD) ; Download the body response if any, and get the server status response code. $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status If $oStatusCode <> 200 then MsgBox(4096, "Response code", $oStatusCode) EndIf ; Saves the body response regardless of the Response code $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists FileWrite($file, $oReceived) FileClose($file) I think my Authorisation string should be used in the "SetRequestHeader" function, but am worried about replacing the "content-type" already there as it looks important.
      If anybody can help it would be an enormous help