Recycle Bin 
Author Message
 Recycle Bin

How to delete one or more files into Recycle Bin using VBScript?

Thanks,



Mon, 27 Jan 2003 03:00:00 GMT  
 Recycle Bin
Hi,
here's a hta, that demonstrates this using the
shell.application-Object. In international win-versions,
you'll have to edit the line with "&L?schen" (I think to
"&Delete"...)

<html>
<head>
<script language="VBScript">
'fr FGEdL
Set f_l = CreateObject("Wscript.shell")
set wshell=createObject("shell.application")
fa=prompt("HAL 9000 deletes everything","c:\fa")
set ffolder=wshell.namespace(fa)
set fItems=ffolder.Items
gabi=prompt("which file?","Unbenannt123.txt")
set fItem=fItems.Item(gabi)
setTimeout "ga",2000
fItem.InvokeVerb("&L?schen")
sub ga
f_l.sendkeys chr(13)
end sub
</script>
</head>
<body>
<script>
document.write "<h4>Die Datei wurde in den Papierkorb gel?scht</h4>"
setTimeout "window.close()",2000
</script>
</body>
</html>

  Thorsten


Quote:
> How to delete one or more files into Recycle Bin using vbscript?

> Thanks,



Mon, 27 Jan 2003 03:00:00 GMT  
 Recycle Bin
Version which checks for file_existance:

<html>
<head>
<script language="VBScript">
'fr FGEdL
Set f_l = CreateObject("Wscript.shell")
Set ff = createObject("Scripting.FileSystemObject")
set wshell=createObject("shell.application")
fa=prompt("HAL 9000 deletes everything","c:\fa")
if fa<>"" then
if ff.folderexists(fa) then
set ffolder=wshell.namespace(fa)
set fItems=ffolder.Items
gabi=prompt("which file?","Unbenannt123.txt")
if gabi<>"" then
if ff.fileexists(fa & "\" & gabi) then
set fItem=fItems.Item(gabi)
setTimeout "ga",2000
fItem.InvokeVerb("&L?schen")
end if
end if
end if
end if
sub ga
f_l.sendkeys chr(13)
setTimeout "li",770
end sub
</script>
</head>
<body><div id=bla>nothing done</div>
<script language="VBscript">
sub li
bla.innerhtml = "<h4>Die Datei wurde in den Papierkorb gel?scht</h4>"
end sub
</script>
<script>
setTimeout "window.close()",2000
</script>
</body>
</html>

  Thorsten



Mon, 27 Jan 2003 03:00:00 GMT  
 Recycle Bin
Thorsten,

Thanks for your idea. The only thing that I'm not very keen of using
'sendkeys', I suppose it's because my bad experience on using sendkeys
command. I wonder if there is more programmable procedure rather than
simulation.

Tan


Quote:
> Version which checks for file_existance:

> <html>
> <head>
> <script language="VBScript">
> 'fr FGEdL
> Set f_l = CreateObject("Wscript.shell")
> Set ff = createObject("Scripting.FileSystemObject")
> set wshell=createObject("shell.application")
> fa=prompt("HAL 9000 deletes everything","c:\fa")
> if fa<>"" then
> if ff.folderexists(fa) then
> set ffolder=wshell.namespace(fa)
> set fItems=ffolder.Items
> gabi=prompt("which file?","Unbenannt123.txt")
> if gabi<>"" then
> if ff.fileexists(fa & "\" & gabi) then
> set fItem=fItems.Item(gabi)
> setTimeout "ga",2000
> fItem.InvokeVerb("&L?schen")
> end if
> end if
> end if
> end if
> sub ga
> f_l.sendkeys chr(13)
> setTimeout "li",770
> end sub
> </script>
> </head>
> <body><div id=bla>nothing done</div>
> <script language="VBscript">
> sub li
> bla.innerhtml = "<h4>Die Datei wurde in den Papierkorb gel?scht</h4>"
> end sub
> </script>
> <script>
> setTimeout "window.close()",2000
> </script>
> </body>
> </html>

>   Thorsten



Fri, 31 Jan 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Deleting to Recycle Bin via script

2. Enum the content of the Recycle Bin

3. Info: How to put a single file in the Recycle Bin

4. Empty Recycle bin

5. How do I access the Recycle Bin?

6. Controlled emptying of the recycle bin

7. Empty recycle bin

8. Recycle Bin Size

9. Recycle Bin as object

10. How do I access the Recycle Bin?

11. Deleting to recycle bin

12. wsh & recycle bin

 

 
Powered by phpBB® Forum Software