Recycle Bin Button With Status

What do the button and script look like now?

Which archive are you downloading? There are two in the thread from two different people.

Which version of Opus?

Hopefully this will answer all your questions.



option explicit

' TestBin
' 
' 
' This is a script for Directory Opus.
' See [gpsoft.com.au/DScripts/redir ... ge=scripts](http://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts) for development information.
' 
' 
' 
' Called by Directory Opus to initialize the script
Function OnInit(initData)
	initData.name = "TestBin"
	initData.desc = "Updates the recycle bin button"
	initData.copyright = "goselito on 01/09/2014"
	initData.version = "1.1"
	initData.default_enable = True
End Function

' Called when a new Lister is opened
Function OnOpenLister(openListerData)
	Const RECYCLE_BIN = &Ha&
	Dim objShell
	Set objShell = CreateObject("Shell.Application")
	Dim objFolder
	Set objFolder = objShell.Namespace(RECYCLE_BIN)
	Dim colItems
	Set colItems = objFolder.Items
	Dim BinCount
	BinCount = 0
	Dim objItem
	For Each objItem in colItems
		if BinCount > 0 Then Exit For
		BinCount = BinCount + 1
	Next
	If BinCount > 0 Then
		dim objCmd : Set objCmd = DOpus.NewCommand
		'DOpus.Vars.Set ("Script.RecycleButton","isFull")
		objCmd.RunCommand("@set glob:RecycleButton=isFull") 
		'objCmd.RunCommand("@toggle:update") 
		Set objCmd = Nothing
	End If
End Function


That version of the script would only update the icon when a new lister opens.

Try the script in the root post, although I'm not sure if that's the best version of the multiple versions in this thread (the authors will have to tell you that, if there are still differences), it looks like it will update whenever a lister is made the active window, which is more often.

I did as Leo suggested and used the first posting in this thread and it works perfectly. Not sure why I read through all the other posts and concluded that I should use the "updated versions". Not clear why so many updates were offered in the first place. I'm just grateful to everyone that provides buttons and scripts. I can't write this stuff so I can't complain about why it can get so confusing. I do regret wasting Leo's time with dumb questions though. Thanks Leo!

I'm with you. There should be at least a version information and upload date whenever somebody fixes and enhances on things. Deciding what version to choose, if there are "latest" and "fixed" versions available which lack any description is not easy! o)

In the best case, snippets and uploads that are obsolete should also be removed and things to keep should move into the thread opening. Unfortunately not everyone seems to have fun maintaining their creations and threads.

I receive a script error when ever I start Directory Opus and open a new lister. Once I clear the script error, it doesn't return and the recycle bin works great. If I exit Directory Opus and restart it, The error returns. This is the error:
Script Output.txt (243 Bytes)

When I installed the script, I dragged the "testbin.vbs" into the preferences/tools/scripts box, but it didn't appear, however when I went to the script addons file, it was there.


This is the actual "testbin.vps" copied to a text file.
testbin.txt (889 Bytes)

I tried to figure out the problem on my own and I tried to contact the author, but I have had no success. I would very much like to learn how to work with scripts, but it might as well be written in ancient Sanskrit. Thanks for your attention.

Are you using Opus 11.13 or an earlier version?


:opusicon:

I assumed the posted script must work but having tried it, I get the same error, and I think there's a syntax error in the script. I'm not sure why "Call" is on either line near the bottom.

You may try this, I added the brackets which are needed when using "call" in vbs to fix the syntax error.
This is not tested and the current issue a bit weird actually, as how and why this worked before is quite unclear.

From my memory I'd say, there were some other issues which haven't been addressed, so be prepared for new issues or consider removing it from DO since the author does not show up anymore to maintain it.

option explicit

' TestBin
' 
' 
' This is a script for Directory Opus.
' See http://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts for development information.
' 
' 
' 
' Called by Directory Opus to initialize the script
Function OnInit(initData)
	initData.name = "TestBin"
	initData.desc = "Updates the recycle bin button"
	initData.copyright = "goselito on 01/09/2014"
	initData.version = "1.2"
	initData.default_enable = True
End Function

' Called when a new Lister is opened
Function OnActivateLister(ActivateListerData)
	Const RECYCLE_BIN = &Ha&
	Dim objShell
	Set objShell = CreateObject("Shell.Application")
	Dim objFolder
	Set objFolder = objShell.Namespace(RECYCLE_BIN)
	
	If objFolder.Items.Count > 0 Then
		Call DOpus.vars.Set("Script.RecycleButton", "isFull")
	Else
		Call DOpus.vars.Delete("Script.RecycleButton")
	End If
End Function

I removed the offending script and installed tbone's script and I can report that it works perfectly. No errors show anymore and the script appears on the script box as it should. Even better in fact, because now I can use the delete key on my keyboard and the icon shows the change where before it didn't work. Thank you. It might not seem important, but I use Dopus every day and I really want all aspects of Dopus to work perfectly and IT DOES! I suggest that you sir, (tbone) might consider repacking the original download which includes the bin icons. Further, I suggest that the forum administrator delete this entire post so that tbone can add the revision to a new one without all the BS and mistakes. Forgive me if I'm taking this too far, but while adding this script is a simple change to make to the program, I find it useful and interesting. All this discussion is undoubtedly discouraging for the casual user who might want to give it a go. Cheers! :thumbsup:

Since this thread and content seems abandoned, overhauled and refined versions of the RecycleBin button, belonging script and iconset have been uploaded (in the german forum this time). RecycleBin fans should take a look, if german is hard to read for you, try the auto-translated version at the bottom. Thanks! o)


https://www.haage-partner.de/forum/viewtopic.php?f=45&p=22730

------ (not french, but english colors?! o)
https://translate.google.de/translate?act=url&hl=de&ie=UTF8&sl=de&tl=en&u=https://www.haage-partner.de/forum/viewtopic.php%3Ff%3D45%26p%3D22730&sandbox=0&usg=ALkJrhjPveNx6vQQmGDdivYVHE-IOwI-DA

I've been using this script for a while, but I've grown increasingly frustrated with how unresponsive it is. Especially if there's a lot of files in the recycle bin, it may take 3 or more attempts for it to launch the "empty recycle bin" dialog. But other times it doesn't seem to work regardless.

I'm not finding a more up to date version of a script like this here, and unfortunately the thread @tbone linked is gone.

Is there a simple modern way to do this? I know Leo posted a simple recycle bin button in 2019, but it doesn't have the functionality to enter the recycle bin, which I like to have.

The command to go to the recycle bin is simply go /trash

You can use that with the @icon line in my button from the other thread, if you want the same icon behavior but clicks to take you into the recycle bin instead of empty it.

Or use a three-button to go into the recycle bin on left click and empty it on right click, if that's what you want.

Oh, that's simple enough. Thanks. Unfortunately I guess it loses the dynamic icon, but I can live with it.

If you want a dynamic trashcan icon with a single button that can both empty the recycle bin and go to the recycle bin, @keydown is your friend. Try something like this:

Set button image to full trashcan icon of choice

@keydown:none
@icon:[insert empty recycle bin image path here]
@ifset:RECYCLEBINEMPTY
@confirm The recycle bin is empty!
@ifset:else
Delete EMPTYRECYCLE
@keydown:Ctrl
Go /trash
1 Like

You can have both, as I said:

You can use that with the @icon line in my button from the other thread, if you want the same icon behavior but clicks to take you into the recycle bin instead of empty it.

I'm confused, sorry. We're talking about a three button layout, yes? Where left click clears recycle bin and right click goes to recycle bin (or vice versa). I'm not seeing the way to do the dynamic icon in this situation. Am I missing something? I thought according to this thread you couldn't: Dynamic icon for three button

Maybe not as a three-button, in that case. But you could go with the @keydown version Chuck suggested. Depending on exactly what you want, which I'm not sure of.


Not sure if I should make my own post for this but here is just a very slight upgrade on Leo's original. Basically it displays your bin status, and if you click on the bin instead of emptying it, it opens the bin within dopus instead of windows explorer. Then if you click the arrow on the side of the button the option within will force empty the bin.

Recycle_Live_Status_Menu_With_View_and_Delete.dcf (971 Bytes)