Search the Community
Showing results for tags 'dropbox'.
-
Hello, I'm trying to write a script to allow pause / resume of Dropbox syncing; so that Dropbox syncing can be scheduled. So the idea is that the script will emulate what a user would normally do by clicking on Dropbox on the System Tray and then the script will toggle the sync operation If Dropbox currently syncing, will pause If syncing currently paused, will resume I'm writing this script for Windows 10 I am able to open Dropbox from the System Tray, but I can't figure out how to enumerate the controls. I would have been happy with the "simple" approach of using the Autoit Window Info tool to manually identify the values for the control. But unfortunately as soon as I click on the Finder Tool the Dropbox window closes. I then tried enumerating the controls with my script. I have experimented with a couple of scripts that others have shared, which while they don't error; don't return any values for the Controls. So at the moment I'm stuck and I'm after some ideas Is there a way to use a Windows Viewer tool with an app like Dropbox that doesn't remain visible? (I had a quick look but could not find a solution) If I need to enumerate the controls myself, here is my current script. I'm using _EnumChildWindows from here #include <Array.au3> #include <GuiToolBar.au3> #include <_EnumChildWindows.au3> Local $hSysTray_Handle Local $hWnd="",$hControl=0,$sTitle=0,$sClass=0,$aEnumList Local $hNumber1Button=-1,$hNumber4Button=-1,$hPlusButton=-1,$hEqualButton=-1 $sSearchtext='Dropbox' $iButton=Get_SysTray_IconText($sSearchtext) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iButton, "left", False, 1) ; MsgBox (64,'Searched Button','Button: '&$iButton&@CRLF&'Instance: '&@extended) If WinActivate($hSysTray_Handle, "") Then ; MsgBox($MB_SYSTEMMODAL, "", "Dropbox Window activated") ; Check Dropbox status - Either: ; 'Up to date' (i.e. syncing) ; 'Syncing paused' (paused) $hWnd = $hSysTray_Handle ; Important to wait for the window to fully 'create' itself before getting child windows! ; Note that other processes that become activated somewhere between WinWait and this will cause WinWaitActive() to wait for manual activation ;WinWaitActive($hWnd) ; bad idea in busy environment Sleep(3000) WinActivate($hWnd) ; this seems to be a better alternative, the window seems fully created after this is called in my tests ; Parameters to function ;$hControl=HWnd(0x########) ;$sTitle="^(\d|\+|=)$" ; PCRE - gets controls with numbers, + or = sign only (problem: no instance #'s!) ;$sClass="Button" $aEnumList=_EnumChildWindows($hWnd,$hControl,$sTitle,$sClass) ;,2) for RegExp Title If @Error Then Exit ; Find specific items [Certain versions of Calc won't return any text] For $i=1 to $aEnumList[0][0] Switch $aEnumList[$i][4] Case "1" $hNumber1Button=$aEnumList[$i][0] ConsoleWrite("'1' Advanced Mode Name (in current state): [CLASS:Button; INSTANCE:"&$aEnumList[$i][3]&"]"&@CRLF) Case "4" $hNumber4Button=$aEnumList[$i][0] ConsoleWrite("'4' Advanced Mode Name (in current state): [CLASS:Button; INSTANCE:"&$aEnumList[$i][3]&"]"&@CRLF) Case "+" $hPlusButton=$aEnumList[$i][0] ConsoleWrite("'+' Advanced Mode Name (in current state): [CLASS:Button; INSTANCE:"&$aEnumList[$i][3]&"]"&@CRLF) Case "=" $hEqualButton=$aEnumList[$i][0] ConsoleWrite("'=' Advanced Mode Name (in current state): [CLASS:Button; INSTANCE:"&$aEnumList[$i][3]&"]"&@CRLF) EndSwitch Next ; Add Headers $aEnumList[0][0]="Handle" $aEnumList[0][1]="Classname" $aEnumList[0][2]="Control ID" $aEnumList[0][3]="Iteration" $aEnumList[0][4]="Title/Text" ; Bring the window forward WinActivate($hWnd) ; Perform a simple calculation to show interaction If $hNumber1Button<>-1 Then ControlClick($hWnd,"",$hNumber1Button,"primary",3) ControlClick($hWnd,"",$hNumber4Button) Sleep(1000) ControlClick($hWnd,"",$hPlusButton) Sleep(1000) ControlClick($hWnd,"",$hNumber4Button,"primary",2) ; double click, but that's fine Sleep(1000) ControlClick($hWnd,"",$hEqualButton) EndIf ; And Display ALL Enumerated Windows _ArrayDisplay($aEnumList,"Enumerated controls for App") Else MsgBox($MB_SYSTEMMODAL + $MB_ICONERROR, "Error", "Dropbox Window not activated") EndIf Func Get_SysTray_IconText($sSearch) For $i = 1 To 99 ; Find systray handles $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:' & $i & ']') ; ConsoleWrite ("Handle: " & $hSysTray_Handle & @CRLF) If @error Then ;MsgBox(16, "Error", "System tray not found") ExitLoop EndIf ; Get systray item count Local $iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) ConsoleWrite("iSysTray_ButCount: " & $iSysTray_ButCount & @CRLF ) If $iSysTray_ButCount = 0 Then ;MsgBox(16, "Error", "No items found in system tray") ContinueLoop EndIf Local $aSysTray_ButtonText[$iSysTray_ButCount] ; Look for wanted tooltip For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1 ConsoleWrite("iSysTray_ButtonNumber: " & $iSysTray_ButtonNumber & " Button_Text: " & _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber) & @CRLF ) If $sSearch= StringLeft(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber),StringLen($sSearch)) Then ConsoleWrite("Button Text: " & $sSearch & " Handle: " & $hSysTray_Handle & " Button Number: " & $iSysTray_ButtonNumber & @CRLF) Return SetError(0, $i, $iSysTray_ButtonNumber) EndIf Next Next Return SetError(1, -1, -1) EndFunc ;==>Get_SysTray_IconText Thanks, VW
-
DropboxEX - Hardlinks Dorpbox is getting more and more versatile ! Most of you know it as a file sharing tool for different OS's and Mobile platforms . By the way I use 8 / 9 and 10, just amazing, but that's a different story. Anyhow the feature that is missing is, can I sync files and folders which are outside of the Dropbox area. And not to use a seperate sync tool that copies / duplicates all the files ? The answer was given here : Ok let's see what we can do with AutoIT to help a hand. I created 2 versions to create hard links to the dropbox folder called EXTERNAL. 1 version is using native AutoIT commands The second version is using the _WinAPI commands. ( Downside on this one is that you needs full administrator rights :-( Not so elegant of course ! ) Enjoy, ptrex DropboxEx Folder Sync.au3 DropboxEx Folder Sync_WinAPI.au3
-
Hello, the following script is running quite nicely for a friend of mine doing a year of work and travel to have a backup at home for all the pics and movies taken with her mobile phone, The facts: At home: a VMWARE virtual machine with dropbox installed for her DB account On-the-Road: One mobile phone, Camera Uploads are activated for her dropbox account, one Laptop. The idea is to have a copy of *ALL* pictures and movies taken with the mobile phone *OUTSIDE* the dropbox folder, so that the DB Max Size is never exceeded. The script is running at home and doing this: Copy all content from the "Camera Upload Folder" within the dropbox folder to some folder *OUTSIDE* the DB folder Move all content from the "Camera Upload Folder" do some other folder *INSIDE* the DB folder to indicate, that the backup copies at home were done successfully Dropbox is also installed on the Laptop she has with her. So on the Laptop she checks from time to time the destination folder inside the dropbox folder and moves the pics / movies on the laptop to some other folder outside the dropbox as well. By that final step the images are moved out of the dropbox on the mobile phone as well, so that there is always space left to sync more pics / movies. As moving pics / movies out of the dropbox folder on the laptop doesn't touch the copies in the mobile phone's "Gallery", she has all the pics / movies at all three locations: Mobile Phone Laptop VM at home The folder names propably are different for non-German localized Windows and Dropbox, just modify them to meet your localization. DBox-Sync.au3
-
I've finally come up with a simple solution for dragging & dropping a URL. It's not perfect, but it does the job. Mostly just a tweak of some Help file examples. Thanks also to AutoBert, for his StringRegExp and example that set me on the right path. I have seen this requested for many times, so enjoy! It goes without saying, that any improvements are welcome. Dropbox For URLs.au3 #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> Global $hGui, $g_hRichEdit Example() Func Example() Local $cnt, $URL, $val, $text Local $iMsg, $state = $WS_CAPTION + $WS_POPUP + $WS_CLIPSIBLINGS + $WS_SYSMENU $hGui = GUICreate(StringTrimRight(@ScriptName, 4), 160, 100, -1, -1, $state, $WS_EX_TOPMOST) $g_hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 140, 80, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) GUISetState(@SW_SHOW) _GUICtrlRichEdit_SetEventMask($g_hRichEdit, $ENM_LINK) _GUICtrlRichEdit_AutoDetectURL($g_hRichEdit, True) $cnt = 0 While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($g_hRichEdit) ExitLoop Case Else If $cnt = 20 Then $text = _GUICtrlRichEdit_GetText($g_hRichEdit) If $text <> "" Then $val = StringRegExp($text, "(?s)((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)", 2) If UBound($val) > 0 Then $URL = $text ClipPut($URL) ;MsgBox(0, "URL", $URL, 0, $hGui) Else _GUICtrlRichEdit_SetText($g_hRichEdit, "Only URL's are supported!") ;MsgBox(0, "Not URL", "Only URL's are supported!", 0, $hGui) EndIf Sleep(600) _GUICtrlRichEdit_SetText($g_hRichEdit, "") EndIf $cnt = 0 Else $cnt = $cnt + 1 EndIf EndSelect WEnd EndFunc ;==>Example GUIDelete($hGui) Exit I also wanted a version that would work with an earlier version of AutoIt (v3.3.0.0), to use with updates for some older scripts (programs). The following works fine on my Win XP laptop, but fails (also when compiled) on my Win 7 Netbook. I found a RichEdit example in the GUICtrlCreateEdit function (Example 2) in the AutoIt v3.3.0.0 Help file, and modified that to suit my script. Failure is no doubt due to 'MSCOMCT2.OCX' missing from the System32 folder, at the very least. Any solution to getting the following to work on Win 7 would be greatly appreciated. Perhaps a different '.OCX' file etc. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> Global $oMyError RichEditExample() Exit ; Rich edit control EXAMPLE using GUICtrlCreateObj ; Author: Kåre Johansson ; AutoIt Version: 3.1.1.55 ; Description: Very Simple example: Embedding RICHTEXT object ; Needs: MSCOMCT2.OCX in system32 but it's probably already there ; Date: 3 jul 2005 Func RichEditExample() Local $cnt, $DropBoxGUI, $GUIActiveX, $msg, $oRP, $state, $text, $URL, $val $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $oRP = ObjCreate("RICHTEXT.RichtextCtrl.1") If @error Then Return $state = $WS_CAPTION + $WS_POPUP + $WS_CLIPSIBLINGS + $WS_SYSMENU $DropBoxGUI = GUICreate(StringTrimRight(@ScriptName, 4), 160, 100, -1, -1, $state, $WS_EX_TOPMOST) $GUIActiveX = GUICtrlCreateObj($oRP, 0, 0, 140, 80) GUICtrlSetPos($GUIActiveX, 5, 5, 150, 90) $cnt = 0 With $oRP; Object tag pool .OLEDrag() .Font = 'Arial' .Text = @CRLF & @CRLF & " Drag & Drop a URL here." .SelBold = True .BackColor = 0xff00 ;.FileName = @ScriptDir & '\RichText.rtf' ;$oRP.AboutBox() ;$oRP.SelBold = False ;$oRP.SelItalic = False ;$oRP.SelUnderline = False ;$oRP.SelFontSize = 8 ;$oRP.SaveFile(@ScriptDir & "\RichText.rtf", 0) EndWith GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUIDelete($DropBoxGUI) ExitLoop Case Else If $cnt = 20 Then $text = $oRP.Text If $text <> "" Then If $text = @CRLF & @CRLF & " Drag & Drop a URL here." Then Sleep(2000) Else $val = StringRegExp($text, "(?s)((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)", 2) If UBound($val) > 0 Then $URL = $text ClipPut($URL) ;MsgBox(0, "URL", $URL, 0, $hGui) Sleep(600) Else With $oRP .Text = "Only URL's are supported!" EndWith ;MsgBox(0, "Not URL", "Only URL's are supported!", 0, $hGui) Sleep(1500) EndIf EndIf With $oRP .Text = "" .SelBold = False EndWith EndIf $cnt = 0 Else $cnt = $cnt + 1 EndIf EndSelect WEnd EndFunc ;==>RichEditExample Func MyErrFunc() MsgBox(0, "AutoItCOM Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext , 5) ; Will automatically continue after 5 seconds Local $err = $oMyError.number If $err = 0 Then $err = -1 SetError($err) ; to check for after this function returns EndFunc ;==>MyErrFunc And a slower embedded IE based version. This has an error in latest AutoIt, but works fine in v3.3.0.0. #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> Local $DropboxGUI, $GUIActiveX, $loaded, $loops, $oBody, $oIE, $sHTML, $timeout, $urlpage _IEErrorHandlerRegister() $oIE = _IECreateEmbedded() $DropboxGUI = GUICreate("URL Dropbox", 140, 140, -1, -1, _ $WS_OVERLAPPED + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_SYSMENU, $WS_EX_TOPMOST) $GUIActiveX = GUICtrlCreateObj($oIE, 5, 5, 125, 100) $oBody = _IETagNameGetCollection($oIE, "body", 0) _IEDocInsertHTML($oBody, "", "afterbegin") $loaded = _IEPropertyGet($oIE, "locationurl") $urlpage = $loaded $loops = 0 $sHTML = "" $sHTML &= "<HTML>" & @CR $sHTML &= "<HEAD>" & @CR $sHTML &= "<TITLE>Drag And Drop Example</TITLE>" & @CR $sHTML &= "</HEAD>" & @CR $sHTML &= "<BODY>" & @CR $sHTML &= "</BODY>" & @CR $sHTML &= "</HTML>" _IELoadWaitTimeout(1) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ; Quit, Close or Exit window GUIDelete($DropboxGUI) ExitLoop Case Else ;;; If $loops = 10 Then $loops = 0 $loaded = _IEPropertyGet($oIE, "locationurl") If $loaded <> $urlpage Then _IEAction($oIE, "stop") _IEDocWriteHTML($oIE, $sHTML) If $loaded = "res://ieframe.dll/navcancl.htm" Then $loaded = "" $urlpage = $loaded _IEBodyWriteHTML($oIE, '<p style="WORD-WRAP: normal; WORD-BREAK: break-all; FONT-SIZE: 8px">' & $loaded & '</p>') EndIf Else $loops = $loops + 1 EndIf EndSelect WEnd Exit
-
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 !
-
Version 1.0
1,081 downloads
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- 3 comments
- 1 review
-
- Dropbox
- oauth access token
- (and 3 more)
-
Hello everyone! I present to you a way to automate DropBox, at least syncing... Sample: Donwload: DropBoxControl_(RedirectLink).html Usage: Ctrl + Q to exit. Ctrl + Pause to Pause/Resume DropBox! It can also use the following: #AutoIt3Wrapper_Run_Before="%scitedir%DropBoxControl.exe" /Pause #AutoIt3Wrapper_Run_After="%scitedir%DropBoxControl.exe" /ResumeJust copy the executable into the folder of the editor! I hope you enjoy! Regards, João Carlos.
-
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) Thanks #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
-
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
-
- winhttphttp
- dropbox
-
(and 1 more)
Tagged with:
-
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: oauth_token=<request-token>&oauth_token_secret=<request-token-secret> 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
-
im currently in the process of making a raided file store at home using freenas or openmediavault, or something similar. i had an idea of making my own dropbox like storage, where i can put a file into a specified folder, and it would automatically upload to my file storage. i would prob use some kind of encrypted ftp, but am unsure how well this will work with autoit. i have done some autoit, but this maybe beyond my scope, lol. but basically... i think the script would always be running, and check to see if the file already exists, and if not transfer it, and it could either check when a change was detected, or maybe check every ten minutes or something. or maybe if there is an dtp functuon a,ready, set a default override existing file to "no" just curious if anyone had any ideas, its going to be a while before i finish my system