aphesia Posted June 27, 2013 Share Posted June 27, 2013 Hey there, I am working on a "note" app which sync via sftp. I am trying to display all contents of a folder in a tree view (and then I want to select one of the note.txt files in this folder and edit it). Anyway, I am currently stuck at displaying the folder content: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.1 Author: Script Function: Sync all notes.txt within a folder via sftp #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> #include <SFTPEx.au3> #include <Array.au3> $MainGUI = GUICreate("MyNotes", 984, 841, 259, 141) $Edit1 = GUICtrlCreateEdit("", 208, 72, 755, 729) GUICtrlSetData(-1, "Edit1") $TreeView = GUICtrlCreateTreeView(16, 72, 177, 729, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $ServerGroup = GUICtrlCreateGroup("Server", 16, 8, 195, 49) $ServerInput = GUICtrlCreateInput("ftp.com", 24, 24, 129, 21) $PortInput = GUICtrlCreateInput("1337", 160, 24, 45, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $UserGroup = GUICtrlCreateGroup("User", 218, 8, 145, 49) $UserInput = GUICtrlCreateInput("User", 226, 24, 129, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $PasswordGroup = GUICtrlCreateGroup("Password", 370, 8, 145, 49) $PasswordInput = GUICtrlCreateInput("Password", 378, 24, 129, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group4 = GUICtrlCreateGroup("Status", 522, 8, 145, 49) $Status = GUICtrlCreateLabel("Disconnected", 524, 31, 140, 17, $SS_CENTER) GUICtrlSetColor(-1, 0xFF0000) GUICtrlCreateGroup("", -99, -99, 1, 1) $ConnectButton = GUICtrlCreateButton("Connect", 682, 16, 137, 41) $SavesyncButton = GUICtrlCreateButton("Save / Sync", 826, 16, 137, 41) $mFile_Menu = GUICtrlCreateMenu("File") $mSettings_Item = GUICtrlCreateMenuItem("Einstellungen", $mFile_Menu) $mCheckUp_Item = GUICtrlCreateMenuItem("Update", $mFile_Menu) GUICtrlCreateMenuItem("", $mFile_Menu) $mExit_Item = GUICtrlCreateMenuItem("Exit", $mFile_Menu) $mHelp_Menu = GUICtrlCreateMenu("?") $mAbout_Item = GUICtrlCreateMenuItem("About", $mHelp_Menu) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $mExit_Item Exit Case $ConnectButton $sPath = 'psftp.exe' $hSession = _SFTP_Open($sPath) $sUsername = GUICtrlRead($UserInput) $sPassword = GUICtrlRead($PasswordInput) $sServerName = GUICtrlRead($ServerInput) $iServerPort = GUICtrlRead($PortInput) $hConnection = _SFTP_Connect ( $hSession, $sServerName , $sUsername , $sPassword , $iServerPort ) sleep(2000) Local $Array[10] _SFTP_ListToArray( $hConnection ) sleep(2000) _ArrayDisplay($Array) EndSwitch WEnd Link to comment Share on other sites More sharing options...
aphesia Posted June 29, 2013 Author Share Posted June 29, 2013 hmm no one? :/ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 29, 2013 Moderators Share Posted June 29, 2013 aphesia,Look at my ChooseFileFolder UDF (the link is in my sig) - it will do this for you. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mikell Posted June 29, 2013 Share Posted June 29, 2013 As _SFTP_ListToArray() returns an array, you should write $Array = _SFTP_ListToArray($hConnection) _ArrayDisplay($Array) Link to comment Share on other sites More sharing options...
careca Posted June 30, 2013 Share Posted June 30, 2013 Yes, and the code should be enclosed within code tags, and not plain text tags. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
aphesia Posted June 30, 2013 Author Share Posted June 30, 2013 As _SFTP_ListToArray() returns an array, you should write $Array = _SFTP_ListToArray($hConnection) _ArrayDisplay($Array) Thanks you , your UDF is really nice BUT: How to I tell your udf to use the sftp-folder as $sRoot ? Link to comment Share on other sites More sharing options...
mikell Posted July 1, 2013 Share Posted July 1, 2013 Not sure you need a treeview You can get your notes names list with _SFTP_ListToArray from the concerned remote folder and put the array into a list or listview, then select one note, use _SFTP_FileGet to get the .txt to a temp file and then edit it Link to comment Share on other sites More sharing options...
aphesia Posted July 6, 2013 Author Share Posted July 6, 2013 mikell: your way sounds even more complicated :S So I still wonder how to tell the udf that $sRoot is my sftp-folder Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now