FileRecycle only works from C:?
FileRecycle only works from C:?
This is a strange one, but I have a script that uses the FileRecycle command on any files I drop on a GUI. The script works perfectly when I run it off my C: but if I move the script to another partition (such as my I:) and run it it will fail to recycle files and just ignore the drag and drop. Any ideas? I tried running script as admin and the behavior was the same. Is there some permission I'm missing?
Re: FileRecycle only works from C:?
Hi,
You can display the path of the files to be recycled, so that you know what it is.
You can display the ErrorLevel from the command, so that you know what it is.
You can post your script in a reply below.
You can display the path of the files to be recycled, so that you know what it is.
You can display the ErrorLevel from the command, so that you know what it is.
You can post your script in a reply below.
Re: FileRecycle only works from C:?
Unfortunately it's a lot of code but I want to clarify that the issue is NOT the files I'm recycling...its the GUI itself (which calls FileRecycle) that seems to fail.
Here are some snippets:
Here are some snippets:
Code: Select all
Gui, 2: -Caption +E0x80000 +LastFound +OwnDialogs +Owner +AlwaysOnTop
Gui, 2: Show, NA
OnMessage(0x201, "WM_LBUTTONDOWN")
OnMessage(0x204, "WM_RBUTTONDOWN")
; Get a handle to this window we have created in order to update it later
hwnd2 := WinExist()
winId2 = ahk_id %hwnd2%
2GuiDropFiles:
Tooltip, Moving Files...
Loop, parse, A_GuiEvent, `n
{
; MsgBox, 4,, File number %A_Index% is:`n%A_LoopField% `n`nContinue?
FileRecycle, %A_LoopField%
if ErrorLevel ; i.e. it's not blank or zero.
MsgBox, % "Failed to Recycle " A_LoopField
}
Tooltip,
return
WM_RBUTTONDOWN(wParam, lParam)
{
X := lParam & 0xFFFF
Y := lParam >> 16
if A_GuiControl
Control := "`n(in control " . A_GuiControl . ")"
; ToolTip You left-clicked in Gui window #%A_Gui% at client coordinates %X%x%Y%.%Control%
Menu, MyMenu, Show
}
WM_LBUTTONDOWN(wParam, lParam)
{
global hwnd2
X := lParam & 0xFFFF
Y := lParam >> 16
if A_GuiControl
Control := "`n(in control " . A_GuiControl . ")"
; ToolTip You left-clicked in Gui window #%A_Gui% at client coordinates %X%x%Y%.%Control%
MouseGetPos, , , currentHwnd
WinGet, whwnd, ID, ahk_id %currentHwnd%
If (whwnd == hwnd2)
{
Run, explorer.exe shell:RecycleBinFolder
}
}
Re: FileRecycle only works from C:?
If you see the MsgBox "Failed to recycle...", then it may be an issue of access rights to the file.
Re: FileRecycle only works from C:?
You can see whether the FileRecycle line is reached. Your commented MsgBox could achieve that. If the command is reached, the file is not recycled, and no error occurs, then it seems possible that the drive's operating system has interfered. It's conceivable that an error might not be generated even with some kinds of access problems. A workaround is to move the file into a "trash" folder that you create and then manage later.
Re: FileRecycle only works from C:?
This post can be closed as I simply gave up and just run my script off the C: and have no issues.