Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Recycle Bin empty, icon changed correctly, and delete confirmation dialog closed

Reply
 
Old 03-04-2009   #1 (permalink)
dp


 
 

Recycle Bin empty, icon changed correctly, and delete confirmation dialog closed

I found this was a tough (read finicky) nut to crack so thought I would post
my solution here. Credit to mr_unreliable, et al.

On Windows XP SP3, the only way I found I could get the Recycle Bin emptied,
icon changed correctly, and the delete confirmation dialog closed was to
invoke the Open verb instead of Empty Recycle &Bin. I then perform a few
SendKeys calls to navigate through the appropriate menu items, close the
dialog, and finally the Recycle Bin window.

This script is used as part of a clean up batch file. Delete confirmation
dialog is required.

Set objShell = CreateObject("Shell.Application")
Set WSHShell = CreateObject("WScript.Shell")
Const CLSID = "::{645FF040-5081-101B-9F08-00AA002F954E}"
Set objRecycleBin = objShell.Namespace(0).ParseName(CLSID)

objRecycleBin.InvokeVerb "Open"
WScript.Sleep(50)
WSHShell.SendKeys("%F")
WScript.Sleep(50)
WSHShell.SendKeys("B")
WScript.Sleep(50)
WSHShell.SendKeys("Y")
WScript.Sleep(50)
WSHShell.SendKeys("%{F4}")



My System SpecsSystem Spec
Old 03-17-2009   #2 (permalink)
Alex K. Angelopoulos


 
 

Re: Recycle Bin empty, icon changed correctly, and delete confirmation dialog closed

When was the original discussion on this? I'm having trouble finding it in
Google, and I wanted to see what issues you guys had run across - I'm
working on a theory about what happens with particular verb invocations from
scripts and why. :/

"dp" <dp@xxxxxx> wrote in message
news:l96dnQmShNPXBjPUnZ2dnUVZ_sHinZ2d@xxxxxx
Quote:

> I found this was a tough (read finicky) nut to crack so thought I would
> post my solution here. Credit to mr_unreliable, et al.
>
> On Windows XP SP3, the only way I found I could get the Recycle Bin
> emptied, icon changed correctly, and the delete confirmation dialog closed
> was to invoke the Open verb instead of Empty Recycle &Bin. I then perform
> a few SendKeys calls to navigate through the appropriate menu items, close
> the dialog, and finally the Recycle Bin window.
>
> This script is used as part of a clean up batch file. Delete confirmation
> dialog is required.
>
> Set objShell = CreateObject("Shell.Application")
> Set WSHShell = CreateObject("WScript.Shell")
> Const CLSID = "::{645FF040-5081-101B-9F08-00AA002F954E}"
> Set objRecycleBin = objShell.Namespace(0).ParseName(CLSID)
>
> objRecycleBin.InvokeVerb "Open"
> WScript.Sleep(50)
> WSHShell.SendKeys("%F")
> WScript.Sleep(50)
> WSHShell.SendKeys("B")
> WScript.Sleep(50)
> WSHShell.SendKeys("Y")
> WScript.Sleep(50)
> WSHShell.SendKeys("%{F4}")
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Recycle Bin icon will not show empty without manual screen refresh.? Vista General
Can I disable "Empty recycle bin" confirmation? Vista General
Recycle Bin icon always looks empty? Vista General
CHANGE RECYCLE BIN ICON - EMPTY FULL HOW? Vista General
recycle bin icon does not empty Vista performance & maintenance


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46