It is currently March 29th, 2024, 1:57 am

Recycle Bin context menu

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Recycle Bin context menu

Post by balala »

Yincognito wrote: October 15th, 2020, 6:21 pm To be fair, there isn't much to thank me for either,
Much less me...
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Recycle Bin context menu

Post by mak_kawa »

Hi Yincognito and balala

I just thank you for taking time to talk with me, even if my aim wasn't achieved so far. :-)

BTW, as the FileView plugin has [!CommandMeasure SomeMeasure ContextMenu] command (and even Properties!), I assume that the plugin uses some API that calls context menu for file path. If so, RecycleManager measure also can use such API for the integrated RecycleBin and implement similar measure command? ... just my thought, but expect.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Recycle Bin context menu

Post by Yincognito »

mak_kawa wrote: October 15th, 2020, 10:00 pm Hi Yincognito and balala

I just thank you for taking time to talk with me, even if my aim wasn't achieved so far. :-)

BTW, as the FileView plugin has [!CommandMeasure SomeMeasure ContextMenu] command (and even Properties!), I assume that the plugin uses some API that calls context menu for file path. If so, RecycleManager measure also can use such API for the integrated RecycleBin and implement similar measure command? ... just my thought, but expect.
But isn't the context menu of the Recycle Bin desktop icon entirely different from the context menu of a $Recycle.Bin folder? :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Recycle Bin context menu

Post by Yincognito »

mak_kawa wrote: October 15th, 2020, 10:00 pmI just thank you for taking time to talk with me, even if my aim wasn't achieved so far. :-)
I think I may have the answer for you, mak_kawa - you know my motto, nothing is impossible. :sly: This will most likely work, as Rainmeter has the capability of doing everything required for this. 8-)

P.S. It won't open the context menu of Recycle Bin or its properties, but it will do pretty much everything available in the properties window.

EDIT:

I'll be a bit busy tomorrow, so I'll just show you how to do it:
- use either: mountvol /L (in either CMD or PowerShell), WMIC or a PowerShell command like:

Code: Select all

gwmi -class Win32_Volume -filter "NOT DriveLetter like ''" | select DriveLetter,DeviceID | sort DriveLetter | format-list
to get your drives' GUIDs (unique names enclosed between curly brackets). The string and extraction from it can be manipulated in PowerShell directly, or through a Substitute in the RunCommand measure used to run the command
- once you get the GUID, the registry path of the Recycle Bin settings for your drive will be:

Code: Select all

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\Volume\{GUID}
where you'll have the same settings that are available in the Recycle Bin Properties window, albeit under slightly different names, i.e. MaxCapacity and NukeOnDelete
- to be able to modify those settings, use a PowerShell code like (this sets the maximum storage size of Recycle Bin for C: drive to 5000 MB):

Code: Select all

$Size=5000
$Volume=mountvol C:\ /L 
$Guid=[regex]::Matches($Volume,'{([-0-9A-F].*?)}')
$RegKey="HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\Volume\"+$Guid.value
New-ItemProperty -Path $RegKey -Name MaxCapacity -Value $Size -PropertyType "dword" -Force
The code above already gets the C: GUID, but as I said, such info can be extracted through your RunCommand measure as well. Once you have the desired GUID, you can even build your own .REG file and execute it in a bang (try to export from those registry keys, to figure out the exact syntax), instead of having to write the PowerShell code for each drive - even though that won't be complicated either since only the drive letter, the desired value or the key name change.

All in all, if there is a "complicated" part, it's extracting the GUID(s) from the mountvol or gwmi output, but even that isn't that hard if carefully designing the regex. Naturally, you can even replicate the Recycle Bin Properties window in a small skin, if you like - some InputTexts and buttons should do the job, considering that you can already get the current values of those settings using some Registry measures, and the set part is clear.

If you want to implement this and encounter difficulties and such, feel free to use your constitutional right to reply on this forum, LOL. Oh, and yeah, now you can say thanks. The approach is not exactly as easy as envisioned with just a simple CLSID in a bang, but it isn't a whole lot complicated either, and it should work. Obviously, you should first make sure everything goes smooth by running whatever is needed to test this from CMD or PowerShell, and make a backup of the registry before attempting to modify it, just to be on the safe side.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Recycle Bin context menu

Post by CodeCode »

There are only three options in the recycle bin menu, really: open, empty, and pin to taskbar - unless you have some other programs linked to it like CCleaner.

There is a lot of stuff about running batch files for each separate option, but not the native menu.

Perhaps creating a context menu that runs individual batch files for each option, named in kind just through rainmeter context menu...
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Recycle Bin context menu

Post by Yincognito »

CodeCode wrote: October 21st, 2020, 8:47 am There are only three options in the recycle bin menu, really: open, empty, and pin to taskbar - unless you have some other programs linked to it like CCleaner.

There is a lot of stuff about running batch files for each separate option, but not the native menu.

Perhaps creating a context menu that runs individual batch files for each option, named in kind just through rainmeter context menu...
Something like that, yeah. As far as I am aware of, one of the few ways of accessing the options from the Recycle Bin properties (i.e. the ones setting the size of the bin and such) is to build a skin simulating that properties window, and then modify those options by changing the registry keys I talked about earlier. Of course, one can do that through the skin's context menu as well.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Recycle Bin context menu

Post by CodeCode »

Yincognito wrote: October 21st, 2020, 12:15 pm Something like that, yeah. As far as I am aware of, one of the few ways of accessing the options from the Recycle Bin properties (i.e. the ones setting the size of the bin and such) is to build a skin simulating that properties window, and then modify those options by changing the registry keys I talked about earlier. Of course, one can do that through the skin's context menu as well.
Of course... Properties. I didnt include that one. Sorry. Looking around though and I did not see any reference to that in the batch file perspective so back to Yincognito's idea then.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Recycle Bin context menu

Post by Active Colors »

Yincognito wrote: October 15th, 2020, 6:21 pm To be fair, there isn't much to thank me for either, since the essence of the question (i.e. directly accessing the bin properties) has not been solved yet, despite our efforts.
CodeCode, Yincognito, balala, mak_kawa,
Sorry it took me so long.

Can you guys verify if it works for you on Windows 10/11? It works for me on Windows 7.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[BinProperties]
Measure=Plugin
Plugin=FileView
Path="C:\"
ShowDotDot=0
ShowFolder=0
ShowFile=0
UpdateDivider=-1

[MeterName]
Meter=String
X=0R
Y=0r
FontFace=Arial
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=12,13,12,12
AntiAlias=1
Text=Open Recycle Bin Properties
LeftMouseUpAction=[!CommandMeasure "BinProperties" "Properties shell:::{645FF040-5081-101B-9F08-00AA002F954E}"]
click to animate:
GIF 02-03-2022 13-21-23.gif

EDIT: I just figured out that it is also possible to open Properties dialogue windows with PowerShell. But let me know first if Rainmeter way works for you ;-)

Code: Select all

$o = new-object -com Shell.Application
$folder = $o.NameSpace("shell:RecycleBinFolder")
$folder.Self.InvokeVerb("Properties")
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Recycle Bin context menu

Post by balala »

Active Colors wrote: March 2nd, 2022, 12:17 pm Can you guys verify if it works for you on Windows 10/11? It works for me on Windows 7.
Yep, perfectly works on Windows 10. If needed, here are the system information, as provided by Rainmeter:

Rainmeter 4.5.7.3581 (64-bit)
Language: English (1033)
Build time: 2021-12-09 15:10:57
Windows 10 Pro 2009 64-bit (build 19044) - English (1033)
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Recycle Bin context menu

Post by Yincognito »

Active Colors wrote: March 2nd, 2022, 12:17 pm CodeCode, Yincognito, balala, mak_kawa,
Sorry it took me so long.

Can you guys verify if it works for you on Windows 10/11? It works for me on Windows 7.
[...]
Yes, both the skin and the PS code work for me on Win 10. Setting the FileView's Path option to another value like "D:\" doesn't seem to make any difference (or maybe it's not supposed to) when it comes to what is selected in the bin properties window. I also like the shorter one-line (new-object -com Shell.Application).NameSpace("shell:RecycleBinFolder").Self.InvokeVerb("Properties") version when it comes to PS, but that's just me.

Nice find, even after all this time. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth