[GH-ISSUE #344] [Suggestion] 'Open Output Folder' button could focus output file or folder #286

Closed
opened 2026-02-26 12:21:05 +03:00 by kerem · 23 comments
Owner

Originally created by @sunflyfairy on GitHub (Dec 15, 2022).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/344

When I press the 'Open Output Folder' button ,I suggest that the file or folder just created can be selected, the normal code is like below.

            import os
            filepath = r"C:\Users\user_name\Desktop\python\pythonProject\output\project_name"
            folder = os.path.dirname(filepath)
            filename = filepath.split('\\')[-1]
            os.popen("explorer /select," + folder + "\\" + filename)
Originally created by @sunflyfairy on GitHub (Dec 15, 2022). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/344 When I press the 'Open Output Folder' button ,I suggest that the file or folder just created can be selected, the normal code is like below. ``` import os filepath = r"C:\Users\user_name\Desktop\python\pythonProject\output\project_name" folder = os.path.dirname(filepath) filename = filepath.split('\\')[-1] os.popen("explorer /select," + folder + "\\" + filename) ```
kerem 2026-02-26 12:21:05 +03:00
Author
Owner

@brentvollebregt commented on GitHub (Dec 15, 2022):

Which input does this relate to? These buttons usually help you find your data and files - making it create folders for you seems a bit pointless? Maybe I'm thinking about this the wrong way.

<!-- gh-comment-id:1352850022 --> @brentvollebregt commented on GitHub (Dec 15, 2022): Which input does this relate to? These buttons usually help you find your data and files - making it create folders for you seems a bit pointless? Maybe I'm thinking about this the wrong way.
Author
Owner

@sunflyfairy commented on GitHub (Dec 16, 2022):

   After it create a  file or folder, the button  'Open Output Folder' can open the output folder, but  it will not activate output folder and select the file or folder just created.If you modify the code like above, it will do that. It will a bit convenient when there are many files in the folder.
<!-- gh-comment-id:1353935907 --> @sunflyfairy commented on GitHub (Dec 16, 2022): After it create a file or folder, the button 'Open Output Folder' can open the output folder, but it will not activate output folder and select the file or folder just created.If you modify the code like above, it will do that. It will a bit convenient when there are many files in the folder.
Author
Owner

@brentvollebregt commented on GitHub (Dec 16, 2022):

Your issue description first said "Open Folder" and now says "Open Output Folder" - this is very confusing. Are you able to add a screenshot with the button you are talking about circled please?

<!-- gh-comment-id:1354302264 --> @brentvollebregt commented on GitHub (Dec 16, 2022): Your issue description first said "Open Folder" and now says "Open Output Folder" - this is very confusing. Are you able to add a screenshot with the button you are talking about circled please?
Author
Owner

@sunflyfairy commented on GitHub (Dec 21, 2022):

image
I'm sorry, I made a mistake at first time. it's this button as above. when I press the button, the output folder will not activate.
It's just my suggest, thanks.

<!-- gh-comment-id:1360631273 --> @sunflyfairy commented on GitHub (Dec 21, 2022): ![image](https://user-images.githubusercontent.com/87637658/208796587-eb024756-404b-492f-a8ac-869f225ba773.png) I'm sorry, I made a mistake at first time. it's this button as above. when I press the button, the output folder will not activate. It's just my suggest, thanks.
Author
Owner

@brentvollebregt commented on GitHub (Dec 21, 2022):

Are you saying the output folder that this button typically opens is not being created after your script is packaged?

<!-- gh-comment-id:1360858077 --> @brentvollebregt commented on GitHub (Dec 21, 2022): Are you saying the output folder that this button typically opens is not being created after your script is packaged?
Author
Owner

@sunflyfairy commented on GitHub (Dec 30, 2022):

The code in utils.py line 31 is : os.startfile(folder_directory, 'explore')
My suggestion is :

    folder = os.path.dirname(folder_directory)
    filename = folder_directory.split('\\')[-1]
    os.popen("explorer /select," + folder + "\\" + filename) 
<!-- gh-comment-id:1367754759 --> @sunflyfairy commented on GitHub (Dec 30, 2022): The code in utils.py line 31 is : **os.startfile(folder_directory, 'explore')** My suggestion is : ``` folder = os.path.dirname(folder_directory) filename = folder_directory.split('\\')[-1] os.popen("explorer /select," + folder + "\\" + filename) ```
Author
Owner

@brentvollebregt commented on GitHub (Dec 30, 2022):

@sunflyfairy that is not compatible with Mac or Linux.

<!-- gh-comment-id:1367761220 --> @brentvollebregt commented on GitHub (Dec 30, 2022): @sunflyfairy that is not compatible with Mac or Linux.
Author
Owner

@sunflyfairy commented on GitHub (Dec 30, 2022):

Can you only modify it on windows?
I see you have a judge on line 30.

<!-- gh-comment-id:1367772906 --> @sunflyfairy commented on GitHub (Dec 30, 2022): Can you only modify it on windows? I see you have a judge on line 30.
Author
Owner

@brentvollebregt commented on GitHub (Jan 4, 2023):

I'm starting to see the issue here - is that button not working for you at all? When pressing it, it should open the output directory which was created automatically (if the button is showing).

What OS are you on? Potentially this only works on Windows now that I look at the docs.

Looking at the existing code properly now and I see the OS checks are already there. Are you saying os.startfile(folder_directory, 'explore') is not working on Windows?

<!-- gh-comment-id:1370467836 --> @brentvollebregt commented on GitHub (Jan 4, 2023): ~I'm starting to see the issue here - is that button not working for you at all? When pressing it, it should open the output directory which was created automatically (if the button is showing).~ ~What OS are you on? Potentially this only works on Windows now that I look at the docs.~ Looking at the existing code properly now and I see the OS checks are already there. Are you saying `os.startfile(folder_directory, 'explore')` is not working on Windows?
Author
Owner

@sunflyfairy commented on GitHub (Jan 5, 2023):

I use win10 and it works well. when you press the button, it will open the folder , but the folder won't be activated.
If you can modify it as my code in windows, the output folder will activate and the folder you created will be selected.
This will be helpful when there are many files or folders in output folder.

<!-- gh-comment-id:1371566238 --> @sunflyfairy commented on GitHub (Jan 5, 2023): I use win10 and it works well. when you press the button, it will open the folder , but **the folder won't be activated.** If you can modify it as my code in windows, the output folder will activate and the folder you created will be selected. This will be helpful when there are many files or folders in output folder.
Author
Owner

@brentvollebregt commented on GitHub (Jan 5, 2023):

What do you mean it won't be "activated"? You mean the file explorer window will not open? You just said it works well on Windows so I'm confused.

<!-- gh-comment-id:1371579750 --> @brentvollebregt commented on GitHub (Jan 5, 2023): What do you mean it won't be "activated"? You mean the file explorer window will not open? You just said it works well on Windows so I'm confused.
Author
Owner

@sunflyfairy commented on GitHub (Jan 5, 2023):

It can open the output folder, but it is not the currently activate window.

<!-- gh-comment-id:1371606558 --> @sunflyfairy commented on GitHub (Jan 5, 2023): It can open the output folder, but it is not the currently activate window.
Author
Owner

@brentvollebregt commented on GitHub (Jan 5, 2023):

I see, so when you press the "Open Output Folder" button, it opens a windows explorer window in the correct directory but it's not focused? (I assume the opened window is flashing in the taskbar). Is this the issue?

<!-- gh-comment-id:1372803888 --> @brentvollebregt commented on GitHub (Jan 5, 2023): I see, so when you press the "Open Output Folder" button, it opens a windows explorer window in the correct directory but it's not focused? (I assume the opened window is flashing in the taskbar). Is this the issue?
Author
Owner

@github-actions[bot] commented on GitHub (Feb 5, 2023):

This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment on this issue or it will be closed in 5 days.

<!-- gh-comment-id:1416892660 --> @github-actions[bot] commented on GitHub (Feb 5, 2023): This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment on this issue or it will be closed in 5 days.
Author
Owner

@sunflyfairy commented on GitHub (Feb 6, 2023):

Yes, it's the issue. And if there are many folders or files in the output Folder, I will cost a few minutes to find the one just created.

<!-- gh-comment-id:1418303927 --> @sunflyfairy commented on GitHub (Feb 6, 2023): Yes, it's the issue. And if there are many folders or files in the output Folder, I will cost a few minutes to find the one just created.
Author
Owner

@brentvollebregt commented on GitHub (Feb 6, 2023):

Yes, it's the issue

If the explorer window isn't focused, Windows will flash its icon yellow on the taskbar by default. You can click on the taskbar item and the folder will be open.

And if there are many folders or files in the output Folder, I will cost a few minutes to find the one just created.

This sounds like a completely different concern? You want the output file or folder to be highlighted when the Windows explorer window is opened?

Always happy to look at a PR with your recommended fix 👍

<!-- gh-comment-id:1418392328 --> @brentvollebregt commented on GitHub (Feb 6, 2023): > Yes, it's the issue If the explorer window isn't focused, Windows will flash its icon yellow on the taskbar by default. You can click on the taskbar item and the folder will be open. > And if there are many folders or files in the output Folder, I will cost a few minutes to find the one just created. This sounds like a completely different concern? You want the output file or folder to be highlighted when the Windows explorer window is opened? Always happy to look at a PR with your recommended fix 👍
Author
Owner

@sunflyfairy commented on GitHub (Feb 6, 2023):

You can test my code, then you will see the effect.
Thanks for your feedback.

<!-- gh-comment-id:1418414736 --> @sunflyfairy commented on GitHub (Feb 6, 2023): You can test my code, then you will see the effect. Thanks for your feedback.
Author
Owner

@brentvollebregt commented on GitHub (Feb 6, 2023):

@sunflyfairy I have created the branch feature/344-highlight-output-file-in-windows with the changes. Pull that down, run it and see if it does what you're expecting.

<!-- gh-comment-id:1418444649 --> @brentvollebregt commented on GitHub (Feb 6, 2023): @sunflyfairy I have created the branch [feature/344-highlight-output-file-in-windows](https://github.com/brentvollebregt/auto-py-to-exe/tree/feature/344-highlight-output-file-in-windows) with the changes. Pull that down, run it and see if it does what you're expecting.
Author
Owner

@brentvollebregt commented on GitHub (Feb 12, 2023):

@sunflyfairy did the changes do what you expected? If so, I can merge them in for everyone.

<!-- gh-comment-id:1426954857 --> @brentvollebregt commented on GitHub (Feb 12, 2023): @sunflyfairy did the changes do what you expected? If so, I can merge them in for everyone.
Author
Owner

@sunflyfairy commented on GitHub (Feb 14, 2023):

Thanks, I just got back to the office today. I download the #344,then the program is not responding.
image

<!-- gh-comment-id:1428964733 --> @sunflyfairy commented on GitHub (Feb 14, 2023): Thanks, I just got back to the office today. I download the #344,then the program is not responding. ![image](https://user-images.githubusercontent.com/87637658/218613957-98ce609c-17c3-4a4e-b4cd-65eadef63236.png)
Author
Owner

@brentvollebregt commented on GitHub (Feb 14, 2023):

Two days ago that branch would have worked but now it's facing the same issue as https://github.com/brentvollebregt/auto-py-to-exe/issues/364.

I have just rebased the branch to include the fix.

<!-- gh-comment-id:1429092766 --> @brentvollebregt commented on GitHub (Feb 14, 2023): Two days ago that branch would have worked but now it's facing the same issue as https://github.com/brentvollebregt/auto-py-to-exe/issues/364. I have just rebased the branch to include the fix.
Author
Owner

@sunflyfairy commented on GitHub (Feb 14, 2023):

I have just tested it. It is just what I want, thanks.

<!-- gh-comment-id:1429239207 --> @sunflyfairy commented on GitHub (Feb 14, 2023): I have just tested it. It is just what I want, thanks.
Author
Owner

@brentvollebregt commented on GitHub (Feb 20, 2023):

This was added in v2.30.0 within 6df771eb8e

<!-- gh-comment-id:1436539379 --> @brentvollebregt commented on GitHub (Feb 20, 2023): This was added in v2.30.0 within 6df771eb8e4a104bab25337e0628ae53c0352ffe
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/auto-py-to-exe#286
No description provided.