LesFerch / WinSetView

Globally Set Explorer Folder Views
MIT License
1.01k stars 43 forks source link

Not working for View of USB connected (Android) SmartPhone #6

Closed tobwz closed 3 years ago

tobwz commented 3 years ago

When I connect an Android Smartphone through USB cable and USB debug connection to my notebook it appears as drive in Windows Explorer.

When I click on it it has the same odd column view as before (=NOT as all general view folders).

So your Script seems not to work here.

Can you fix it?

LesFerch commented 3 years ago

Is your phone connecting as a USB mass storage device (usually only possible with older phones) or as a media device? See this article for explanation... https://superuser.com/questions/1157661/how-to-mount-an-android-smartphone-as-a-drive-in-windows

LesFerch commented 3 years ago

I just did some checking on this. Any device, such as an external HD or flash drive, that mounts as mass storage, will have the same global Explorer views you choose. Modern phones, however, mount in a more restrictive format, like an iPod, with no direct access to the file system. Although some of the display options are the same, such as the View by menu, others are quite different, like the column heading options: image Since there's no entry in the FolderTypes registry key for these kinds of devices, the global view can't be applied. The best I could do is add a special entry for phones, like I did for "This PC" and "Network". That's something I'll consider for a future version (along with other special views, such as the Recycle bin). So there's nothing to fix, but it's a possible extra feature for the future.

tobwz commented 3 years ago

Setting up a "special entry" for Smartphone as you suggested is acceptable.

As long as it remember automatically my customized view. That means e.g. get rid of "Type" column. Selected columns, column order and column widths should automatically be re-established as soon as a smartphone is newly connected to notebook.

When will this feature be available?

LesFerch commented 3 years ago

It's a difficult addition. I'll keep it in mind if I design a new UI. Now, the weather is nice and I have a house to renovate, so I'll look at it again in the Winter.

LesFerch commented 3 years ago

Any custom view settings for special folders, such as smartphones or the Recycle Bin, has to be done by capturing the settings. See "CaptureCustom.vbs" in the WinSetView v2 readme for more details.

tobwz commented 3 years ago

Properties Smartphone folder

tobwz commented 3 years ago

@LesFerch

Your suggested solution in readme with "CaptureCustom.vbs" does not work.

You wrote: "Next, set This PC, Network, Recycle Bin, and Control Panel to your desired views"

BUT: Users cannot set a Smartphone folder to their desired view. There is no corresponding drop down.

Have a look at the previously attached snapshot Properties dialog of a smartphone folder is almost empty

I think the best and easiest would be to detect such "special" smartphone folders.

Most possible they have no BagMRU or missing some other options of "normal" hard disk Win folders. Or maybe WinSetView could check if a folder is a smartphone folder by analyzing the topmost drive type.

Setting ONE folder view for ALL smartphone folder should be acceptable or even desireable.

Again: Keep in mind, I can access (read+write) to these folders without problems. I can manually set an individual (Details) view for these folders too.

The problem is that this manually set view is reset or forgotten beyond USB cable disconnect from smartphone

LesFerch commented 3 years ago

I can set a view for my Pixel 3a as shown in the screen shot I posted above. This is saved in the Bags key and is captured by CaptureCustom.vbs. To understand your situation better, I need to see what you're seeing. How did you create the screen shot above?

LesFerch commented 3 years ago

@tobwz I want to look into this further, but I need more details. It appears from your screenshot that you're running Windows 7, but I can't tell how you got that view of you phone's file system. Certainly, folder properties are not the place to find File Explorer view options. You need to be looking at the File Explorer screen and the view options for the current device or folder. It looks like you've got the Xiaomi Mi 9 Lite mounted as removable storage (as opposed to a media device). If true, that's unusual for a modern phone, but I'm kind of guessing a bit here. Please show a full (i.e. the whole File Explorer window) screen shot and describe how you got to that view and I will try to replicate at my end. I have a Windows 7 VM set up for testing.

tobwz commented 3 years ago

@LesFerch

yes, you are right: I am running on this computer Win7.

The procedure is simple:

I connected my Android 10 Smartphone via USB-C cable to the desktop computer and selected "File Transfer" mode (on Android). This is a must. Otherwise I cannot copy files to and from Smartphone.

Next I go to Windows Explorer. The smartphone Xiaomi MI 9 appears as a new drive (or device). As depicted in the snapshot above I opened the internal storage and right click on a folder inside (e.g. data). Then the "Properties" dialog appears - with NO further drop down to select View type.

I tried the same procedure on my Win10 notebook and FileExplorer. Exactly the same here. So the problem is WinOS independent.

LesFerch commented 3 years ago

@tobwz Why would you expect a "View" drop down when you right-click and select "Properties" on a folder? You get a View menu when you right-click the white space of an open folder or click the View menu dropdown in the File Explorer tool bar.

tobwz commented 3 years ago

@LesFerch: Hmm, the suggested method with the "View" context menu shows NO selectable view for smartphones/special items. When I click on the "properties" context menu (after right-clicking on free space) I can see in "Customize" tab the appropriate place for setup of a new view. Have a look at the following snapshot:

selecting view

LesFerch commented 3 years ago

@tobwz The list of folder types in that drop down never expands. It always has just those five folder types. You seem to be wanting to set the view for a folder type that corresponds to phones in file transfer mode. No such folder type exists, nor can new folder types be defined. The best you can do is save the view for each phone that you connect. That view is simply set as I already described using File Explorer and can be captured using CaptureCustom.vbs. The benefit of capturing the views is that you can then rerun WinSetView at any time and not lose your custom set phone views and you can also transfer your views to a new user, new computer, or restore views after resetting the OS.

LesFerch commented 3 years ago

@tobwz Just to clarify, you will have to set the view for each subfolder on the phone before capturing all those views with CaptureCustom.vbs. File Explorer, unfortunately, does not have a method to set all subfolders to the same view. It only has the Apply to Folders method to set all folders of the same type, which is not applicable in this case (and I'm sure you observed that "Apply to Folders" is grayed out for the phone). Microsoft should have defined a different folder type for phones (and for This PC and Network). Instead, they are special virtual folders under the "General Items" folder type category. As such, they do not get the benefit of Apply to Folders and also get the negative of being affected by changes to the General Items folder type (see Apply to folders "bug" in the readme). It's really aggravating. I would do something about it if I could. I'll report the issue to Microsoft, but since it's been this way since Windows 7, I wouldn't hold my breath for a fix.

LesFerch commented 3 years ago

@tobwz I have good news! I found a way to have the General Items view also apply to all virtual folders, including connected devices, such as your smartphone. The view setting will apply to all subfolders on the phone! I'm working on adding an Option item for this. In the meantime, just create a WinSetViewCustom.reg file in the WinSetView AppData folder containing these lines:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{5C4F28B5-F869-4E84-8E60-F11DB97C5CC7}]
"Mode"=dword:00000004
"LogicalViewMode"=dword:00000001
"GroupView"=dword:00000000

The above will give you detail view and no grouping for all General Items (generic) folders AND all virtual folders that fall under the Generic category (e.g. This PC, Network, and any MTP device). If you want a different view, such as List, let me know.

LesFerch commented 3 years ago

@tobwz Option has been added: image

tobwz commented 3 years ago

@LesFerch:

I had now time to check your new version v2.11 Unfortunately it does NOT work (at least on Windows 7).

I started *.hta as suggested and set the options and "Global" columns as depicted in the following snapshot. Then I clicked on "Submit" button (I observed for some milliseconds some red text in PowerShell/CmdPrompt window if this matters but couldn't read).

If your tool does not work on Win7 I expect a warning popup: "WinSetView works only on Win10".

Then I connected my smartphone via USB cable and opened Windows Explorer:

First observation: The default View is "Tiles" although I prefer "Details View". How can I let Windows Explorer show by default "Details View" (for connected drives)?

Next I switched manually to "Details View" and went to "pictures" folder on my smartphone.

It still shows these fucking "Type" and "created" columns although I de-selected them in your HTA form.

Why?

image

LesFerch commented 3 years ago

@tobwz Thanks for testing. I'll look at this in detail when I get back home later this evening. In the meantime, I just wanted to provide this information...

1) The fact that your phone still opened up in Tiles view indicates that this feature may not work in Windows 7 or maybe it's related to the PowerShell error that flashed by. I will try to test with a Windows 7 VM, but I may run into difficulty getting the phone to mount in the VM. I'll update when I know more.

2) I'm surprised you saw an error flash on the screen in the PowerShell console. The tool is designed for Windows 7 and above and runs without error on my Windows 7 VM, which has just the default PowerShell 2.0 installed. To see that error, please download the latest version and hold the Alt key down when clicking Submit.

3) It's only expected to pick up the Details view setting from General Items. Column selections will not carry over to the phone. There's no way to set the default columns displayed in details view for a phone because it's a virtual folder with it's own unique set of columns. The columns for a phone are only settable on a folder by folder basis in File Explorer. File Explorer saves those settings in incrementally numbered nodes in binary format in the registry. To set the columns via a script would require knowing exactly the entire folder structure of the phone before it's connected (and even then any new folders going forward would not have the same view) or have a resident task that keeps looking for such connections and then corrects the File Explorer registry entries on the fly. That's not going happen.

I have searched everywhere to try to find where/how File Explorer gets it's defaults for virtual folders, such as a connected phone, with no luck. I have spent many hours using Procmon to capture what File Explorer does when such devices are opened and it hasn't revealed where it gets the default settings. They appear to be hard-coded, but that's not typically the Microsoft way. It's certainly not documented anywhere and it's frustrated me to no end.

LesFerch commented 3 years ago

@tobwz Please download the latest version from the Main branch (click the green Code button and select Download Zip). With the latest version, you can hold down the Alt key when clicking Submit to keep the PowerShell console window open. That will allow any errors to be seen.

LesFerch commented 3 years ago

@tobwz I had to set up a physical Windows 7 machine to test with a phone. When I did that, the results were the same as I see in Windows 10. That is, the PowerShell console showed no errors and the phone folders were all in Details view (i.e. same as my General Items setting in WinSetView). Column headings for the phone, as expected, were unchanged.

However, I can also use the CaptureCustom.vbs script to save any view changes, such as turning off those column headings you don't like. That is, you would make the column heading changes in every folder of interest and then run CaptureCustom.vbs to capture those changes. See the readme for more details. The benefit of capturing is so that you can get the same settings back quickly on another computer or another user or if you reset the File Explorer views with WinSetView. AFAIK, there is no way to manipulate the phone column heading defaults. If I ever find a way, I will build that into the script.

On your computer, you're getting an error in the PowerShell console. I need to see that error to help further. Please download the latest version and hold Alt when clicking Submit to keep the PowerShell console window open.

tobwz commented 3 years ago

Ok, now I checked WinSetView following your instructions.

I got the following error:

WinSetView error

WinSetView.hta and WinSetView.ps1 are in the same directory at D:\tools\win\WinExp\WinSetView[v2.12]\

Powershell is installed:

installed Powershell

LesFerch commented 3 years ago

@tobwz The error is caused by the square brackets in the path. Specifically, the folder name WinSetView[v2.12]. Change that folder name to WinSetViewv2.12 or simply WinSetView and it will work fine. When I get a moment, I'll investigate why square brackets break it.

tobwz commented 3 years ago

v2.13 still not working (even in a path without square brackets). It seems to be executed successfully but after USB cable connection no change can be observed in FileExplorer View (see snaphot below for Win10).

Even worse: Now all my hard disk folder views are changed. "Date modified" comes BEFORE (=left) of "Size"

How do I setup sequence of columns in WinSetView?

I want to have Name, Size, Date modified.

How do I set column widths of selected columns?

WinSetView v2 13 not working

LesFerch commented 3 years ago

Your phone view is Details instead of Tiles, so that appears to be working.

Column order is click order. Order shown on screen. This is covered in the readme.

Setting column widths is also covered in the readme.

LesFerch commented 3 years ago

@tobwz As stated earlier, only the view (i.e. List, Details, Icons, etc.) will carry over to a connected phone. The selected column headings you've chosen under Global will apply to everything except special folders, that have their own set of column headings, such as "This PC", "Network", and your connected Android phone.

tobwz commented 3 years ago

@tobwz As stated earlier, only the view (i.e. List, Details, Icons, etc.) will carry over to a connected phone. The selected column headings you've chosen under Global will apply to everything except special folders, that have their own set of column headings, such as "This PC", "Network", and your connected Android phone.

Are folders on a Smartphone "Special folders"? I think not.

According to your post on 03.08. applying the mentioned *.reg script will add all Smartphone folders to the set of "General Item" folders .

So changing the columns and column sort order for "Global" and "General" should be effective for them as well.

LesFerch commented 3 years ago

image

@tobwz I'm sorry, but you're assumptions are incorrect.

As I already stated, a special folder is one which has its own set of column headings. A connected phone certainly does. You can see in the screen shot above, the only column headings available for a phone are Name, Type, Total Size, Free Space, and Percent Full. Normal generic folders have a list of over 300 headings to choose from, but do NOT include Free Space or Percent Full. Some special folders, such as Recycle Bin and Network, have their own unique folder identifier (GUID) allowing for the possibility of controlling their default view. However, some special folders, such as This PC and a connected phone, share their GUID with General Items (i.e. Generic folder type) and therefore cannot be separately controlled. This is a very unfortunate decision by Microsoft. File Explorer handles these special folders differently than a normal Generic folder and that handling is completely out of my control (it's hard-coded in File Explorer as far as I can determine).

Whether you use the reg file I provided earlier, or check the option Use General Items view for connected devices, the result is the same and a bit of an illusion. That is, since there is no unique GUID for phone folders, there is nothing specific to add or control. What that setting is doing is placing the same Generic folder GUID in another place in the registry that causes ALL special folders, that share the Generic GUID, to be displayed in the same view (i.e. Details, List, etc.) that has been set for normal Generic folders. It's the only thing that can be done with these types of folders that actually affects its default view in any way whatsoever.

When you change the column selections for your phone, as you know, you have to do it for every single folder. If the phone folder view had its own folder type (i.e. its own GUID), the Apply to folders button would be available so that those settings could be applied to all the folders on the phone. If that were the case, it would be possible to build an interface into WinSetView to set those views as a default. Since that's not the case, the possibility does not exist.

When you set views individually, it creates registry values that override the default view on a folder by folder basis. Those views are in the BagMRU/Bags keys and cannot be set ahead of time or set for multiple devices. They really are absolutely folder by folder. So, the best anyone might be able to do is to provide a separate script that you can run once the phone is connected that would take the view you set for the topmost folder of the phone and repeat it through all the subfolders. Ironically, Windows XP File Explorer used to work that way. That is, you could set all subfolders to match a parent folder. That system was replaced by folder types in Windows Vista and beyond. In all those years since Vista was introduced, you would think someone would have created a tool that would let you propagate folder settings through a folder tree (as opposed to folder type) but I have never seen such a tool. Searching for a tool that works that way keeps finding articles referring to Apply to folders, which is irrelevant because phones don't have their own folder type. I also think such a tool doesn't exist because it would be very difficult (darn near impossible really) to programmatically create the BagMRU/Bags keys correctly, since they are incrementally numbered nodes in an undocumented binary format. If I ever find a script/tool which can do that, I'll definitely post back here. I'm always looking for ways to get better control over File Explorer folder views, but this one has hit a wall.

tobwz commented 3 years ago

ok, thank you.

I suggest to write down a short and clear statement in the summary on page

https://github.com/LesFerch/WinSetView

that WinSetView (still) does NOT work for (USB) connected SmartPhones.

LesFerch commented 3 years ago

With the settings applied by WinSetView, your phone folders now all open in Details view instead of Tiles. Is that not some improvement?

LesFerch commented 3 years ago

@tobwz I've added a note regarding phone view limitations in the Summary section.