Jump to content

DropboxEX - Hardlinks


ptrex
 Share

Recommended Posts

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 .

But Dropbox can be more. Much more. Using some web programming trickery (which the folks at Dropbox encourage), software developers have whipped up a number of web apps that extend Dropbox and make it even more useful. And, to be honest, a lot cooler ....http://www.the10most.com/misc/10-great-web-apps-that-let-you-use-dropbox-for-more-than-storage.html

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 :

Important ; https://forums.dropbox.com/topic.php?id=51001

To sync multiple external folders, follow these instructions:

1.Quit (or pause) Dropbox on all of the involved computers.

2.Delete any pre-existing symlinks in your Dropbox pointing towards your Desktop. You will have to do this on all of your computers.

3.On every computer involved, create a new symlink inside your Dropbox folder pointing towards your desktop. Make sure that on every computer involved, you put the symlink in the same location inside your Dropbox.

4.Launch (or un-pause) Dropbox.

Once synced, everything should work perfectly.

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

Link to comment
Share on other sites

Thanks. Nice example of using WinAPIEx.

Edit: By the way in the native script Array.au3 has been included for no reason and I don't understand the code below as _PathSplit neither returns an @error value or @extended. I take it that was left over from the WinAPI version.

If @error Or @extended Then
    MsgBox(16, 'Error', 'You do not have the required privileges.')
    Exit
EndIf
Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Without the need for _PathSplit, so now it uses 100% AutoIt native functions.

Local $sDropboxDir = @UserProfileDir & 'DropboxExternal'
Local $sSourceDir = FileSelectFolder('Choose a folder.', '')

_CreateDropboxHardLink($sSourceDir, $sDropboxDir, 1)

Func _CreateDropboxHardLink($sSourcePath, $sDropboxPath = Default, $iFlag = 0)
    If $sDropboxPath = Default Then
        $sDropboxPath = @UserProfileDir & 'DropboxExternal'
    EndIf
    Local $sPath = StringTrimLeft($sSourcePath, StringInStr($sSourcePath, '', 2, -1))
    Local $sDestinationPath = $sDropboxDir & '' & $sPath
    If FileExists($sDestinationPath) = 0 Then
        ; DirCreate($sDestinationPath) & @CRLF)
        ConsoleWrite($sDestinationPath & @CRLF)
    EndIf
    Return ConsoleWrite("Data From " & '"' & $sSourcePath & '"' & " To " & '"' & $sDestinationPath & '"' & @CRLF)
    Return FileCreateNTFSLink($sSourcePath, $sDestinationPath, $iFlag)
EndFunc   ;==>_CreateDropboxHardLink

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I guess maybe Dropbox solved the old symlink/junction issue then? It used to be that a running instance of Dropbox would not recognize changes inside a directory junction until it was restarted. So the old solution was to have the real files inside your Dropbox folder, and the symlinks/junctions on the system.

Edit -

Nope, problem still exists. This was always such a bummer, but the old solution still works of course.

Edited by wraithdu
Link to comment
Share on other sites

@guinness

Thanks for the cleanup !

@Wraithu

It is not solved, but the work around is simple.

Right click the Dropbox icon -> Select PAUZE Syncing -> Select RESUME syncing. And you off again :-)

For me this is realy a 'non issue' compaired to the benifits it gives :-).

Maybe someone can write a script to pauze / resume syncing every x-time.

Rgds

ptrex

Link to comment
Share on other sites

@Wraithu

Yes indeed.

Think about all the AU3 scripts on your machine all synced to the cloud !

Available on you all you PC's and MOBILE DEVICES and not to forget the VERSIONING you get on top for free !

Life can be great some times :sorcerer:

Rgds

ptrex

Link to comment
Share on other sites

Ah, well that's a nice bonus to the pause function then. I ran into this problem and changed the way I was organizing things before Dropbox had pause ;)

His request was granted:

I hope you enjoy!

Regards,

João Carlos.

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

  • 2 months later...

@all

If you want to schedule the Pause / Resume then you could use this version.

Credits to Melba and others for the basics I found on the forum.

I modified this version to fit the needs.

#include <GuiToolBar.au3>
#Include <GuiMenu.au3>
#include <SendMessage.au3>
#include <WindowsConstants.au3>

; If you want to click on the bottom item then you just have to send the enter key Send("{ENTER}")
; If you want to 2nd item from the bottom then : Send("{UP 1}{ENTER}")
; Credits tor Rover / Melba / ... ??

Global $hSysTray_Handle, $iSysTray_ButtonNumber

Global $sToolTipTitle = "Dropbox"
Global $nChars = 7 ; Number of chars to catch

$iSysTray_ButtonNumber = Get_SysTray_Index($sToolTipTitle, $nChars)

If $iSysTray_ButtonNumber = -1 Then
MsgBox(16, "Error", "Icon not found in system tray")
Exit
Else

_GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSysTray_ButtonNumber, "right")
Sleep(500)
Send("{UP 4}") ; Menu index 4 UP
Local $ret

$ret = GetPopUpSelText()
ConsoleWrite($ret & @CRLF) ; This will read the currently selected item

If $ret == "Pause syncing" Then
Send("{ENTER}")
Sleep (1500)
EndIf

_GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSysTray_ButtonNumber, "right")
Sleep(500)
Send("{UP 4}")

$ret = GetPopUpSelText()
ConsoleWrite($ret & @CRLF)

If $ret == "Resume syncing" Then
Send("{ENTER}")
Sleep (1500)
Else
MsgBox(48,"Status","Check the Dropbox Status")
EndIf
EndIf

Exit


Func Get_SysTray_Index($sToolTipTitle, $iChar=30)
;ConsoleWrite("Search String = " & StringLeft($sToolTipTitle,$iChar) & @CRLF)

; Systray handle
$hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
If @error Then
MsgBox(16, "Error", "System tray not found")
Exit
EndIf

; Systray item count
Local $iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
If $iSysTray_ButCount = 0 Then
MsgBox(16, "Error", "No items found in system tray")
Exit
EndIf

; Tooltip catch
For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1
;ConsoleWrite("Index = " & $iSysTray_ButtonNumber & " Text = " & _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber) & @CRLF)
If StringLeft(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber),$iChar) = $sToolTipTitle Then
;ConsoleWrite($iSysTray_ButtonNumber & @CRLF)
Return $iSysTray_ButtonNumber ; Found
EndIf
Next
Return -1 ; Not found
EndFunc ;==>Get_SysTray_Index

Func GetPopUpSelText()
Local $aPopUp_List = _WinAPI_EnumWindowsPopup()
Local $hWnd = $aPopUp_List[1][0]
Local $sClass = $aPopUp_List[1][1]
If $sClass = "#32768" Then ; This is a "standard" Windows API popup menu
     $hMenu = _SendMessage($hWnd, $MN_GETHMENU, 0, 0)
     If _GUICtrlMenu_IsMenu($hMenu) Then
         $iCount = _GUICtrlMenu_GetItemCount($hMenu)
         For $j = 0 To $iCount - 1
             If _GUICtrlMenu_GetItemHighlighted($hMenu, $j) Then
                 Return _GUICtrlMenu_GetItemText($hMenu, $j)
             EndIf
         Next
     EndIf
EndIf
Return ""
EndFunc

Enjoy !

rgds

ptrex

Link to comment
Share on other sites

  • 7 years later...

@Veedub,

What can you expect after 8 years...

The GUI of Dropbox has changed drastically... so this old script will not work anymore.

If I see the time in between I can see if there is an update possible. 

But I can't make any promisses.

 

Edited by ptrex
Link to comment
Share on other sites

@VeeDub 

This way is a much easier way to pause Dropbox syncing

#include <MsgBoxConstants.au3>

 Local $aProcessList = ProcessList("dropbox.exe")
    For $i = 1 To $aProcessList[0][0]

        _ProcessSuspend($aProcessList[$i][1])
        MsgBox($MB_SYSTEMMODAL, "", $aProcessList[$i][0] & @CRLF & "PID: " & $aProcessList[$i][1])
    Next

sleep(5000)

 Local $aProcessList = ProcessList("dropbox.exe")
    For $i = 1 To $aProcessList[0][0]

        _ProcessResume($aProcessList[$i][1])
        MsgBox($MB_SYSTEMMODAL, "", $aProcessList[$i][0] & @CRLF & "PID: " & $aProcessList[$i][1])
    Next


Func _ProcessSuspend($Process)
    $processid = ProcessExists($Process)
    If $processid Then
        $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
        $i_sucess = DllCall("ntdll.dll", "int", "NtSuspendProcess", "int", $ai_Handle[0])
        DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
        If IsArray($i_sucess) Then
            Return 1
        Else
            SetError(1)
            Return 0
        EndIf
    Else
        SetError(2)
        Return 0
    EndIf
EndFunc   ;==>_ProcessSuspend

 

Enjoy !

Link to comment
Share on other sites

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