happy2help Posted March 30, 2009 Share Posted March 30, 2009 Hi all,I hope someone can help me get started with this script.What i am doing nowI have an external hard drive with has a media player built in. it has no way of moving,copying or deleting any files within the player.I want to plug it in and list of all the files on the drive.I currently use if not exist h:\bank30.rom pause dir h:\*.avi /s/b/on > d:\lifeboxtemp.txt type d:\lifeboxtemp.txt | find /v "Videos" > d:\lifebox.txt rem type d:\lifeboxtemp.txt | find /v "Porn" > d:\lifebox.txtin a .bat file.this creates lifebox.txt so i can unplug the drive ant still edit the file.Then i use 2 shortcuts to lifebox.txt and del_lifebox.txt to cut from 1 file and paste into the other file as i want to delete the file from the drive.Then, next time i plug the drive in, i run the final file, "Delete from lifebox.au3" which has this script in it#include <File.au3> $filename = "d:\del_lifebox.txt" $file = FileOpen($filename, 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) ; FileDelete($line) If Not FileDelete($line) Then MsgBox(4096,"Error", " Error Deleting the avi file. error:" & @error) EndIf Wend FileClose($file) ;sleep(1000) ;If Not FileDelete($filename) Then ; MsgBox(4096,"Error", " Error Deleting log. error:" & @error) ;EndIf If Not _FileCreate($filename) Then MsgBox(4096,"Error", " Error Creating/Resetting log. error:" & @error) EndIfthis reads the del_lifebox.txt file and deletes the files listed within it.What i want to doI want to combine all the above commands to a single script that has a box with buttons that runs each part if i click them.One option is to read the contents of the drive and put it in a listbox which doesnt need the drive plugged in once its been scanned. I can then scan through the list at my leisure clicking on the left list and moving selected to the right list where it will be deleted next time the drive is plugged in. Link to comment Share on other sites More sharing options...
Valuater Posted March 30, 2009 Share Posted March 30, 2009 The next step is.... In SciTE, open "Koda Form Designer" you can create the buttons and the look you want for the GUI. ... THEN we can help you connect the dots 8) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 30, 2009 Moderators Share Posted March 30, 2009 happy2help,1. Get all files from your drive into an array - use a recursive file lister (I have attached my version if you wish to use that).2. Get that array into a list (listbox or listview) and choose the files to delete - look perhaps at GUICtrlCreateListView and _GUICtrlListView_GetHotItem.3. Delete the selected files from your drive - you have this code pretty much done.I hope that "helps [you] get started with this script".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...
happy2help Posted April 7, 2009 Author Share Posted April 7, 2009 happy2help, 1. Get all files from your drive into an array - use a recursive file lister (I have attached my version if you wish to use that). 2. Get that array into a list (listbox or listview) and choose the files to delete - look perhaps at GUICtrlCreateListView and _GUICtrlListView_GetHotItem. 3. Delete the selected files from your drive - you have this code pretty much done. I hope that "helps [you] get started with this script". M23 Where is your version? Can the array be put in a file for later use? and then retreived when i need it? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 8, 2009 Moderators Share Posted April 8, 2009 happy2help,Here is the recursive file search again.And for saving and reading arrays, look at _FileReadToArray and _FileWriteFromArray.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...
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