Guest AX5 Posted December 27, 2009 Share Posted December 27, 2009 (edited) Hiho all...Howe do i make so Button1 and list1 is coupled so when i choose a folder i see the files in list1 and button3 to Move the selected file in List1 to another dir. and remove to remove selected file in List 1 This is my script$Form1 = GUICreate("Demo Manager", 427, 296, 231, 155) $Button1 = GUICtrlCreateButton("Choose a folder", 272, 88, 113, 33, $WS_GROUP) $Button3 = GUICtrlCreateButton("Move", 272, 168, 113, 33, $WS_GROUP) $Button4 = GUICtrlCreateButton("Remove", 272, 208, 113, 33, $WS_GROUP) $Label1 = GUICtrlCreateLabel("Select a file", 115, 42, 60, 15) $List1 = GUICtrlCreateList("List here", 32, 72, 225, 201) $Pic1 = GUICtrlCreatePic("img/bg.jpg", 0, 0, 427, 296, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $var = FileSelectFolder("Choose a folder.", "") Case $Button2 Case $Button3 Case $Button4 FileDelete("") EndSwitch WEnd Edited December 27, 2009 by AX5 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 27, 2009 Moderators Share Posted December 27, 2009 AX5,Howe do i make so Button1 and list1 is coupled so when i choose a folder i see the files in list11. Use FileListToArray to list the files in the chosen folder - GUICtrlSetData will get the names into the list (once they are correctly formatted - you will need a loop ).and button3 to Move the selected file in List1 to another dir. and remove to remove selected file in List 1FileMove and FileDelete/FileRecycle will be a great help here!Dog eaten your help file over Xmas? 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...
Guest AX5 Posted December 27, 2009 Share Posted December 27, 2009 AX5,1. Use FileListToArray to list the files in the chosen folder - GUICtrlSetData will get the names into the list (once they are correctly formatted - you will need a loop ).FileMove and FileDelete/FileRecycle will be a great help here!Dog eaten your help file over Xmas? M23Thx for the helpt but can u show me howe to connect them first button ? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 27, 2009 Moderators Share Posted December 27, 2009 AX5, Seven months a member here and you cannot do this yourself? Case $Button1 List_Folder_Contents() ;..... Func List_Folder_Contents() ; Choose folder $sFolderPath = FileSelectFolder("Choose a folder", "M:\") If $sFolderPath = "" Then Return ; No folder chosen ; Clear list GUICtrlSetData($List1, "|") ; List contents into array $aFile_Array = _FileListToArray($sFolderPath, "*", 1) ; If no files found If @error Then GUICtrlSetData($List1, "|No files found!") Return EndIf ; Move found files into list For $i = 1 To $aFile_Array[0] GUICtrlSetData($List1, $aFile_Array[$i]) Next EndFunc Have fun with the other buttons! 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...
Guest AX5 Posted December 27, 2009 Share Posted December 27, 2009 Im geting error on script button1 expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Demo Manager", 427, 296, 231, 155) $Button1 = GUICtrlCreateButton("Choose a folder", 272, 110, 113, 33, $WS_GROUP) $Button3 = GUICtrlCreateButton("Move", 272, 168, 113, 33, $WS_GROUP) $Button4 = GUICtrlCreateButton("Remove", 272, 208, 113, 33, $WS_GROUP) $Label1 = GUICtrlCreateLabel(" File Display", 115, 52, 60, 15) $List1 = GUICtrlCreateList("List here", 32, 72, 225, 201) $Pic1 = GUICtrlCreatePic("img/background.jpg", 0, 0, 427, 296, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Case $Button1 List_Folder_Contents() Func List_Folder_Contents() ; Choose folder $sFolderPath = FileSelectFolder("Choose a folder", "M:\") If $sFolderPath = "" Then Return ; No folder chosen ; Clear list GUICtrlSetData($List1, "|") ; List contents into array $aFile_Array = _FileListToArray($sFolderPath, "*", 1) ; If no files found If @error Then GUICtrlSetData($List1, "|No files found!") Return EndIf ; Move found files into list For $i = 1 To $aFile_Array[0] GUICtrlSetData($List1, $aFile_Array[$i]) Next EndFunc Case $Button3 Case $Button4 FileDelete("") EndSwitch WEnd don't understand the error Link to comment Share on other sites More sharing options...
Developers Jos Posted December 27, 2009 Developers Share Posted December 27, 2009 Put the Func at the end of your script, not inside the Select case! Also answer the PM I send because I am still waiting an a good explanation. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Guest AX5 Posted December 27, 2009 Share Posted December 27, 2009 afther EndSwitch ? Link to comment Share on other sites More sharing options...
Developers Jos Posted December 27, 2009 Developers Share Posted December 27, 2009 afther EndSwitch ?Stop asking and start trying/learning/reading ... it is not kiddies garden here! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Guest AX5 Posted December 27, 2009 Share Posted December 27, 2009 lol i have tryed and i get only errors Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 28, 2009 Moderators Share Posted December 28, 2009 (edited) AX5,You do it like this: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Demo Manager", 427, 296, 231, 155) $Button1 = GUICtrlCreateButton("Choose a folder", 272, 110, 113, 33, $WS_GROUP) $Button3 = GUICtrlCreateButton("Move", 272, 168, 113, 33, $WS_GROUP) $Button4 = GUICtrlCreateButton("Remove", 272, 208, 113, 33, $WS_GROUP) $Label1 = GUICtrlCreateLabel(" File Display", 115, 52, 60, 15) $List1 = GUICtrlCreateList("List here", 32, 72, 225, 201) $Pic1 = GUICtrlCreatePic("img/background.jpg", 0, 0, 427, 296, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 List_Folder_Contents() Case $Button3 Case $Button4 FileDelete("") EndSwitch WEnd Func List_Folder_Contents() ; Choose folder $sFolderPath = FileSelectFolder("Choose a folder", "M:\") If $sFolderPath = "" Then Return ; No folder chosen ; Clear list GUICtrlSetData($List1, "|") ; List contents into array $aFile_Array = _FileListToArray($sFolderPath, "*", 1) ; If no files found If @error Then GUICtrlSetData($List1, "|No files found!") Return EndIf ; Move found files into list For $i = 1 To $aFile_Array[0] GUICtrlSetData($List1, $aFile_Array[$i]) Next EndFuncNow before you post again, you need to get a much better handle on some of the basics of AutoIt, because you patently have no idea of how to use it. Try the excellent tutorials that you will find here and here. There are even video tutorials on YouTube if you prefer watching to reading.A little time spent studying now will pay benefits in the long run - believe me! M23Edit:Apologies - you need to add another #include file (File.au3) to get _FileReadToArray to work. I have amended the code above. Edited December 28, 2009 by Melba23 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...
Guest AX5 Posted December 29, 2009 Share Posted December 29, 2009 Thx M22 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