GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Empty Recycle Bin (with icon matching state)

This is a simple button which empties the Recycle Bin, and where the button's icon changes to indicate if the Recycle Bin is empty or not.

It uses the Windows Recycle Bin icons from shell32.dll. (Icon IDs 31 and 32.)

The "full" icon is the button's default image. Within the command, the @icon modifier is used to override the icon when the recycle bin is empty.

  • RECYCLEBINEMPTY is a special condition built in to Opus for exactly this purpose. But you can also test for things like variables set by commands and scripts.

  • Remove the FORCE argument from the last line if you'd like to see a confirmation dialog before anything happens (assuming you have Windows set to confirm emptying the recycle bin).

  • Add the QUIET argument to the last line if you'd like to prevent any progress dialog while the recycle bin is being emptied.

  • Tip: When editing a button which uses @icon, hold Ctrl and click where it says @icon to open an image picker, so you don't have to manually work out the path and icon ID.

Download:

See also:

An older way of doing something similar was posted here:

4 Likes

Very cute! Interesting info, too.

(The .dcf ruins the show by differing slightly from the screenshot)

I think the only differences are the Large Icon and Show Label checkboxes. I must've changed those between saving the two files. :slight_smile:

To disable the button's action when the recycle bin is empty, add this line before the Delete command:

@disableif:Set RECYCLEBINEMPTY

Resulting in:

@icon:/system/SHELL32.dll#31,RECYCLEBINEMPTY
@disableif:Set RECYCLEBINEMPTY
Delete EMPTYRECYCLE FORCE

For usabilty, it is mainly a visual clue, because it only prevents emptying an empty recycle bin.

Adding to @Leo's tip about holding Ctrl and clicking the @icon line, you can also double-click the @icon line to open the image picker.

2 Likes

There is no need. The icon of the recycle bin is automatically set according to the status of the recycle bin. The status of the recycle bin can be easily seen from the icon. This is the biggest feature of this button.

It's nice with Windows 10 where the recycle bin icons are quite hard to tell apart. :slight_smile:

1 Like