If I click "Open last capture location" twice, please do not open duplicate Explorer windows

Description

If I click "Open last capture location" twice, please do not open duplicate Explorer windows.

Instead, please reuse previous Explorer window of the same last capture folder if it exists.

Environment

Windows Server 2012 R2

Activity

Show:

Ken Lam July 21, 2021 at 7:22 AM

After looking at \src\Greenshot.Base\Core\ExplorerHelper.cs, now I understand the "Open last capture location" function needs to select the last captured file, not just opening the parent folder.

In such case, it seems the following solution should do the job: open or reuse an explorer window to open the last capture folder, and select the file:

https://stackoverflow.com/questions/8182494/how-can-i-set-an-existing-explorer-exe-instance-to-select-a-file/44043951#44043951

Ken Lam July 21, 2021 at 3:00 AM
Edited

I see that Greenshot is written in C#. I had experience about that before.

If you want to make Windows reuse the same explorer window when possible, then you can change the follow code (which will create duplicate Explorer windows if run several times):

System.Diagnostics.Process.Start("explorer.exe", directoryFullPath);

to this (which won’t create duplicate Explorer windows):

System.Diagnostics.Process.Start(directoryFullPath);

(outdated, sorry I didn’t notice Greenshot will select the file also, so it’s not that simple. But there’s another solution, please see my newer comment)

Ken Lam July 21, 2021 at 2:44 AM

  1. Sometimes I need to take multiple screenshots and save them silently. I don’t want the image editor to pop up every time to take a screenshot. I want to take multiple screenshots and edit them later.

  2. After taking several screenshots, I finally decide to have a look on them. Correct me if I am wrong: the only way which Greenshot allows me to browse all my previously taken screenshots, is through the "Open last capture location" function (or double clicking the Greenshot icon).

  3. Throughout this timeline:
    - I took 3 screenshots
    - I clicked "Open last capture location"
    - I did some edits
    - I took another 5 screenshots
    - I clicked "Open last capture location" again
    - I did some edits
    - I took another 2 screenshots
    - I clicked "Open last capture location" again
    - I did some edits
    I have opened several explorer windows of the same last capture location, which are duplicates.
    That’s why it’s better to reuse previous Explorer window of the same last capture folder, if it exists.

Robin Krom July 20, 2021 at 7:56 PM
Edited

Some information for another time, when I might work on this. Here is an example of talking to the explorer, quite complex and I don’t know if this still works good when people have an explorer replacement like Directory Opus. https://devblogs.microsoft.com/oldnewthing/20040720-00/?p=38393

Robin Krom July 20, 2021 at 7:53 PM

Not directly an easy feature to implement, but I will consider this.

I would love to hear some background on why you open the last capture location, or open your screen shots in the explorer at all. Maybe there are some new features coming which would cover your usage, so please help us understand.

Details

Assignee

Reporter

Components

Priority

Created July 20, 2021 at 4:51 AM
Updated July 21, 2021 at 7:22 AM