It is currently March 19th, 2024, 2:05 pm

FileView plugin 2.1

Plugins and Addons popular with the Community
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5364
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: FileView plugin 2.1

Post by eclectic-tech »

Sounds good!

Have a great holiday weekend!
User avatar
Virginityrocks
Posts: 478
Joined: February 26th, 2011, 10:22 pm

Re: FileView plugin 2.1

Post by Virginityrocks »

It's very blizzare.

It seems that the download folder hangs for about 3 seconds per scroll, and the recent folder has a relatively minor 0.2 second delay per scroll, but all other folders scroll butter-smooth.

This only happens after shutting down or restarting the computer. Once a page has been scrolled in fileview, it doesnt have a delay. But that first access is a real killer.

It's just weird that this problem is so evident with the downloads folder. Right now I'm working on making some changes to my suite, including removing the ability to scroll the downloads folder altogether.

Hopefully there's a fix to this strange problem someday.
User avatar
Cariboudjan
Posts: 258
Joined: May 12th, 2019, 8:55 am

Re: FileView plugin 2.1

Post by Cariboudjan »

Brian wrote: December 23rd, 2012, 10:27 am The FileView plugin in now included in with Rainmeter as of version 2.5.

It's usage can be found here: http://docs.rainmeter.net/manual-beta/plugins/fileview

-Brian


FileView always displays the Internet Explorer icon for .url shortcuts, even though not only is Internet Explorer not even installed on my PC, but my default browser is Chrome/Edge/Firefox/etc.

The icon displays the Edge icon in Explorer, but the IE icon in FileView.
Untitled.png

Also, long shot, but would it be possible for the FileView plugin to access/use icons of files in Rainmeter without needing to save a separate .ico file to the skin's folder? The need to save the files to the hard drive seems to significantly slow down Rainmeter where using the file names only without icons is very quick.
User avatar
Brian
Developer
Posts: 2672
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: FileView plugin 2.1

Post by Brian »

Hmmm. It seems somewhere along the line Microsoft has changed the registry key for the default program associated with opening a hyperlink with the shell (at least with Windows 10).

It used to be located here: HKEY_CLASSES_ROOT\http\shell\open\command

I will investigate this and fix it soon (hopefully).

Cariboudjan wrote: October 6th, 2020, 1:32 pm Also, long shot, but would it be possible for the FileView plugin to access/use icons of files in Rainmeter without needing to save a separate .ico file to the skin's folder? The need to save the files to the hard drive seems to significantly slow down Rainmeter where using the file names only without icons is very quick.
Unfortunately no. The Image meter and our plugin interface is not designed to pass information like this. We may explore the ability to use a non-image file with the Image meter (so you can use icons defined within an executable, or just use the icon associated with the file), but this is just one of many thoughts without any plans.

-Brian
User avatar
Cariboudjan
Posts: 258
Joined: May 12th, 2019, 8:55 am

Re: FileView plugin 2.1

Post by Cariboudjan »

Using the icon directly from the file would be nice.
User avatar
Brian
Developer
Posts: 2672
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: FileView plugin 2.1

Post by Brian »

It's not that simple. .url files are a special shortcut file that has the ability to define which icon it wants to display. It can even use an icon from an executable if it wants. Fileview already takes this into consideration. If the icon is not defined, it normally would use the icon from the default browser, but finding the default browser has obviously changed over the years since this part of Fileview was coded.

Stay tuned.

-Brian
User avatar
Brian
Developer
Posts: 2672
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: FileView plugin 2.1

Post by Brian »

Cariboudjan wrote: October 6th, 2020, 1:32 pm FileView always displays the Internet Explorer icon for .url shortcuts, even though not only is Internet Explorer not even installed on my PC, but my default browser is Chrome/Edge/Firefox/etc.
I believe this issue is fixed with the latest beta.

-Brian
User avatar
Cariboudjan
Posts: 258
Joined: May 12th, 2019, 8:55 am

Re: FileView plugin 2.1

Post by Cariboudjan »

Thank you!
User avatar
Cariboudjan
Posts: 258
Joined: May 12th, 2019, 8:55 am

Re: FileView plugin 2.1

Post by Cariboudjan »

I just had another thought...

What if FileView saves the icons to a folder based on filetype (eg. png, bmp, jpg) etc.
These files are saved to the folder permanently once created. They are titled PNG.ico, BMP.ico, JPG.ico, etc.
When the plugin runs again, before creating the icon, it first checks if the icon associated with that file type already exists in the folder.
If it does exist, it uses the existing file and skips the file create/write process. This would save a ton of unnecessary processing time creating/writing files to the disk that have already been created (eg. overwriting the same folder icon over and over again each time FileView is scrolled)

If the filetype is an EXE, URL or other filetype that may have different icons associated to them, in these cases, it saves the file as its filename. (eg. ExpressVPN.ico, YouTube.ico, Photoshop.ico). If that filename already exists in the folder, it uses that icon and skips the file creation process.

As FileView is used, all of the common icons become stored in this folder. It then uses the existing icons whenever possible, and only creates a new icon when one does not already exist.

So the process would be:

1. Get the filenames of all of the icons in the icon folder.
2. Get the first file's extension.
3. Check if that extension is an EXE or URL
---- a. If true, check if icon exists in the folder that has a filename equal to that file's filename
--------- i. If true, do nothing.
--------- ii. If false, create an icon titled that file's filename.
---- b. If false, check if an icon exists in the folder that has a filename equal to that file's extension
--------- i. If true, do nothing.
--------- ii. If false, create an icon titled that file's extension.
4. Repeat from step 2 with the second, third, fourth file until all of the files are checked.

I would then use a meter in Rainmeter as such:

[IconName1]
Plugin=FileView
Path=[mPath]
Type=Icon
Index=1
IconMode=1 (Some kind of setting for FileView to use this method instead of the current method?)

[Meter]
Meter=Image
ImageName=#@#IconFolder\[IconName1].ico (Icon name might equal PNG if a non-EXE non-URL extension, or equal the file name of the EXE or URL file)


I'm already testing this with a PowerShell script I'm working on...

Use the script in Windows PowerShell ISE and create a folder in C:\ called "Temp" if it doesn't already exist. It gets the icons of all of the existing processes with window titles, saves those icons to the C:\Temp\ folder and each time it is run, it skips the icon creation process if the icon already exists. (It first stores all of the file names in C:\Temp\ in an array, then checks that array if it contains a value of the application name). The Rainmeter skin I'm working on then references this folder to find its associated icon for that process.

In some preliminary tests it seems this method significantly improves speed and would theoretically have much faster loading and scrolling times in FileView when icons are used.

Code: Select all

Function Get-Icon {

    [cmdletbinding(
        DefaultParameterSetName = '__DefaultParameterSetName'
    )]
    Param (
        [parameter(ValueFromPipelineByPropertyName=$True)]
        [ValidateNotNullorEmpty()]
        [string]$Path,
        [parameter(ParameterSetName = 'Bytes')]
        [switch]$ToBytes,
        [parameter(ParameterSetName = 'Bitmap')]
        [switch]$ToBitmap,
        [parameter(ParameterSetName = 'Base64')]
        [switch]$ToBase64
    )
    Begin {
        If ($PSBoundParameters.ContainsKey('Debug')) {
            $DebugPreference = 'Continue'
        }
        Add-Type -AssemblyName System.Drawing
    }
    Process {
        $Path = Convert-Path -Path $Path
        Write-Debug $Path
        If (Test-Path -Path $Path) {
            $Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($Path)| 
            Add-Member -MemberType NoteProperty -Name FullName -Value $Path -PassThru
            If ($PSBoundParameters.ContainsKey('ToBytes')) {
                Write-Verbose "Retrieving bytes"
                $MemoryStream = New-Object System.IO.MemoryStream
                $Icon.save($MemoryStream)
                Write-Debug ($MemoryStream | Out-String)
                $MemoryStream.ToArray()   
                $MemoryStream.Flush()  
                $MemoryStream.Dispose()           
            } ElseIf ($PSBoundParameters.ContainsKey('ToBitmap')) {
                $Icon.ToBitMap()
            } ElseIf ($PSBoundParameters.ContainsKey('ToBase64')) {
                $MemoryStream = New-Object System.IO.MemoryStream
                $Icon.save($MemoryStream)
                Write-Debug ($MemoryStream | Out-String)
                $Bytes = $MemoryStream.ToArray()   
                $MemoryStream.Flush() 
                $MemoryStream.Dispose()
                [convert]::ToBase64String($Bytes)
            }  Else {
                $Icon
            }
        } Else {
            Write-Warning "$Path does not exist!"
            Continue
        }
    }
}

# -------

[Diagnostics.Process[]]$processArray = Get-Process | Where-Object {$_.mainWindowTitle}
$processNum = $processArray.Count

$counter = 0;
$iconList = @(Get-ChildItem -Path 'C:\Temp\*.png')
    
while($counter -lt $processNum)
{
    $appTitle = $processArray.MainWindowTitle[$counter]
    $appName = $processArray.ProcessName[$counter]
    $appPath = $processArray.Path[$counter]

    if ($iconList -notcontains '$appName')
    {
        $iconName = 'C:\Temp\' + $appName + '.png'
        $format = [System.Drawing.Imaging.ImageFormat]::Png
        (Get-Icon -Path $appPath -ToBitmap).Save($iconName,$format)
    }

    $counter += 1
}
Untitled.png
The above ExpressVPN icon is only generated the first time the script encounters an application called "ExpressVPN" and then never again.
Post Reply