Jump to content

Script Locking Dirs for Deletion


Go to solution Solved by Melba23,

Recommended Posts

I would like to know what am I doing wrong in here. First of all script is made to be used with total commander and its manual drop down menu. I am using it to easier play movies and tv series from my hard drive, exit from player and if I dont like them to delete them. Problem is that when I play a folder it somehow get locked (and all previous folders). Only when i exit script they can be deleted. Now, I need to make something clear in here.

- I am playing video files that are packed in multi volumes. (vlc supports that kind of play so its enough to start "vlc.exe e:0autoitsomemovieinside.rar" and it will play the file. This is just to explain what script has to do, has nothing to do with failure of a script.

- I am using TOTAL COMMANDER feature to copy full path to a file we want to play in vlc player. It wont work on your system just consider that $line contains full path to a file which in this case should be "e:0autoitsomemovieinside.rar"

- I am running win XP SP3

I hope I explained my problem well. I guess its just a little something but I am not that experienced to get aware what it is. Did try to find it on forum but not much luck. I even did try some unlock scripts from a forum and real applications for unlocking but not much luck. Thanks in advance.

-------------------------------------------------------------------

EDIT:

Just to add, all files inside folder are deleted but folder itself aint (in this case e:0autoit)...

#include <string.au3>
#include <file.au3>
HotKeySet("^{F12}", "escape")
HotKeySet("{F1}", "play")
HotKeySet("{F2}", "close")
HotKeySet("{F3}", "del")
GUISetIcon("vlc.ico")
TraySetIcon("vlc.ico",-1)
Global $line
Global $path

Do
Sleep(2000)
Until 2 = 12
Exit

Func play()
Send("!s") ; opens a S&tart menu from total commander (custom made start menu by end user - me)
Sleep(100)
Send("f") ; starts a command that will take full path and directory from total commander where pointer shows and put it in a clipboard
Sleep(100)
$path=ClipGet()  ; path to a dir which has .rar file to be played, for example "e:\0\autoit\"
$dir = FileFindFirstFile($path & "*.rar")  
$file = FileFindNextFile($dir) ; find first file inside selected dir (in this case "somemovieinside.rar")
$line=("e:\Sys\Prg\vlc\vlc.exe " & $path & $file) ; pack whole info of a file to be played ready for vlc.exe player
SplashTextOn("",$line,(@DesktopWidth),56,-1,(@DesktopHeight - 120),1,"Verdana",10,600)
Run($line) ; start vlc player with full path to the file that we want to play
Sleep(2000)
SplashOff()
EndFunc

Func close() ; this func closes video player
Send("!{F4}")
Sleep(100)
FileClose($line)
EndFunc


Func del() ; this func should delete whole folder that contains a movie with files. it do delete files but not a folder. it stays locked until script is closed.
ProcessClose("vlc.exe")  ; this is extra, i was thinking vlc is locking files but it aint
ProcessWaitClose("vlc.exe"); this is extra, i was thinking vlc is locking files but it aint
SplashTextOn("DELETING",$path,(@DesktopWidth),56,-1,(@DesktopHeight - 120),1,"Verdana",10,600)
;DirRemove($path,1) <------------------------------ I put this to sleep so if someone run it not to delete half of drive or so
Sleep(1500)
SplashOff()
Sleep(100)
EndFunc


Func escape()
Exit
EndFunc
Edited by Fr33b0w
Link to comment
Share on other sites

  • Moderators
  • Solution

Fr33b0w,

You do not appear to be closing the search handle returned from the FileFindFirstFile call (as the Help file says you should). Try doing so and see if that solves the problem. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Fr33b0w,

I take it that my suggestion worked - glad I could help. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...