Toggle specific column in File Explorer (then set its order) Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
omareg94
Posts: 89
Joined: 27 Jun 2016, 22:46

Toggle specific column in File Explorer (then set its order)

29 Nov 2017, 15:56

How can I toggle the "Comments" column in File Explorer (Windows 10) on/off and then set its order to be the second column using AutoHotkey.
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Toggle specific column in File Explorer (then set its order)

29 Nov 2017, 20:31

I was going to let jeeswg answer you, but, since he still hasn't yet, here are a few links to posts by him on this subject:

https://autohotkey.com/boards/viewtopic.php?f=6&t=33129

https://autohotkey.com/boards/viewtopic.php?f=6&t=35041
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Toggle specific column in File Explorer (then set its order)  Topic is solved

29 Nov 2017, 21:04

- Thanks Osprey. And thanks for knowing about the column functions, it's hard to know who knows about what on this forum with so many threads.
- First, copy the functions from here to your script, or to an included script (by using #Include).
Explorer column interaction (get/set: which appear, width, ascending/descending order) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 63#p154163
- Then use the following script, which works for me (tested on Windows 7). If the Comments column is visible, it is hidden. If the Comments column is hidden, then it is shown as the second column.

Code: Select all

q:: ;toggle hide show Comments column (as column 2)
WinGet, hWnd, ID, A
WinGetClass, vWinClass, % "ahk_id " hWnd
if !(vWinClass = "CabinetWClass") && !(vWinClass = "ExploreWClass")
	return
for oWin2 in ComObjCreate("Shell.Application").Windows
	if (oWin2.HWND == hWnd)
	{
		oWin := oWin2
		break
	}
JEE_ExpGetInterfaces(oWin, isp, isb, isv, ifv2, icm)
vList := JEE_ICMGetColumns(icm, "|")
;MsgBox, % StrReplace(vList, "|", "`n")
if InStr("|" vList "|", "|System.Comment|")
	vList := Trim(StrReplace("|" vList "|", "|System.Comment|", "|"), "|")
else if !InStr(vList, "|")
	vList .= "|System.Comment"
else
	vList := StrReplace(vList, "|", "|System.Comment|", "", 1)
;MsgBox, % StrReplace(vList, "|", "`n")
JEE_ICMSetColumns(icm, vList, "|")
isp := isb := isv := ifv2 := icm := ""
return
- Well, I'm glad I wrote the functions in a way such that they are quite easy to use.
- I haven't been using any of the functions as it happens, except for one, which I use all the time, which sorts files by date, putting the most recently modified file at the top of the window.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Toggle specific column in File Explorer (then set its order)

29 Nov 2017, 21:14

I only knew of them because I discovered them mere minutes ago when seeing your link to them in the other Explorer interaction thread. I generally have no idea what libraries are already available. I keep being impressed that there seems to already be a library to do just about anything. Is there a good archive to search for what's available or is everything just posted in this forum and the search function the best way to find them?

I should use these to create a script to set up all of my columns in Explorer. It's really annoying when I lose my carefully created column configurations, often because Windows thinks that it's doing me a favor (no, I don't want you to change the columns to show artist and track number just because I added a few music files to the folder!).
omareg94
Posts: 89
Joined: 27 Jun 2016, 22:46

Re: Toggle specific column in File Explorer (then set its order)

30 Nov 2017, 12:35

@jeeswg:
It gives me blank column each time I hit the shortcut key. It places new columns successfully as second, but unfortunately it calls blank ones (That has no name) (not the Comments one)
Image
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Toggle specific column in File Explorer (then set its order)

30 Nov 2017, 12:54

- If you add the Comments column manually, does the script remove the column?
- Does it add in a new blank column every single time? Giving you a tonne of blank columns. What is the description text for the blank columns?
- It might be worth adding the Comments column manually, and uncommenting the MsgBox lines, to see what its description text is, i.e. is it called 'System.Comment' or something else on your system.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
omareg94
Posts: 89
Joined: 27 Jun 2016, 22:46

Re: Toggle specific column in File Explorer (then set its order)

30 Nov 2017, 14:25

It works successfully now. For some reason it didn't work before. May be I've missed something.
Thanks a lot.
Image
Image
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Toggle specific column in File Explorer (then set its order)

30 Nov 2017, 14:55

- Hmm, if it works if a MsgBox is shown, but doesn't work if a MsgBox isn't shown, that would be curious behaviour, but there have been examples of something like that happening in the past with other unrelated things, although I wouldn't know what the cause of or solution for that would be.
- In the worst-case scenario, you could use the MsgBox command with a 1 millisecond timeout.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “[V1] Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Flowgun, Google [Bot], krl, Stinkfoot9, XMCQCX and 44 guests