topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday October 14, 2024, 3:54 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: AutoHotKey solution for Desktop ListView  (Read 18143 times)

guerillablood

  • Participant
  • Joined in 2013
  • *
  • default avatar
  • Posts: 12
    • View Profile
    • Donate to Member
DONE: AutoHotKey solution for Desktop ListView
« on: March 22, 2014, 07:43 PM »
Hi all!

I'm looking for an a way to emulate the function of this freeware.

Preferably something that would run at the start of a script and could be toggled on and off. It'd also be great if I could integrate it into my own AHK script, if possible. I know there is already an AHK script called DesktopHomes that does this, even though I plundered through the source, I couldn't find the bit of code for the function that I want.

Thanks in advance!

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: AutoHotKey solution for Desktop ListView
« Reply #1 on: March 23, 2014, 01:11 PM »
Preferably something that would run at the start of a script and could be toggled on and off. It'd also be great if I could integrate it into my own AHK script, if possible.
-guerillablood (March 22, 2014, 07:43 PM)

Here you go.

Code: Autohotkey [Select]
  1. LV_VIEW_ICON      := 0 ; Default
  2. LV_VIEW_DETAILS   := 1 ; Flat font and columns don't work right.
  3. LV_VIEW_SMALLICON := 2 ; Correct font, columns are okay.
  4. LV_VIEW_LIST      := 3 ; Flat font and columns are too far apart.
  5. LV_VIEW_TILE      := 4 ; Flat font, columns are okay, and there is extra text detail.
  6. LVM_SETVIEW       := 0x108E
  7. LVM_GETVIEW       := 0x108F
  8.  
  9. #1::
  10. {
  11.     If ( Toggle ) ; LV_VIEW_SMALLICON & LV_VIEW_TILE work the best.
  12.     {
  13.         ControlGet, myDesktopWindow, HWND,, SysListView321, ahk_class Progman
  14.         SendMessage, % LVM_SETVIEW, % LV_VIEW_SMALLICON, 0, , % "ahk_id " . myDesktopWindow
  15.     }
  16.     Else ; Set back to default.
  17.     {
  18.         ControlGet, myDesktopWindow, HWND,, SysListView321, ahk_class Progman
  19.         SendMessage, % LVM_SETVIEW, % LV_VIEW_ICON, 0, , % "ahk_id " . myDesktopWindow
  20.     }
  21.     Toggle := !Toggle
  22. }
  23. Return

Here are some screenshots showing the different modes under a Windows 8 VM:

LV_VIEW_ICON
2014-03-23_130259.pngDONE: AutoHotKey solution for Desktop ListView

LV_VIEW_DETAILS
2014-03-23_130323.pngDONE: AutoHotKey solution for Desktop ListView

LV_VIEW_SMALLICON
2014-03-23_130339.pngDONE: AutoHotKey solution for Desktop ListView

LV_VIEW_LIST
2014-03-23_130356.pngDONE: AutoHotKey solution for Desktop ListView

LV_VIEW_TILE
2014-03-23_130410.pngDONE: AutoHotKey solution for Desktop ListView

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,543
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: DONE: AutoHotKey solution for Desktop ListView
« Reply #2 on: March 23, 2014, 04:04 PM »
That's rather nifty.     :up:

guerillablood

  • Participant
  • Joined in 2013
  • *
  • default avatar
  • Posts: 12
    • View Profile
    • Donate to Member
Re: DONE: AutoHotKey solution for Desktop ListView
« Reply #3 on: March 23, 2014, 11:50 PM »
Thank you so much Skwire! Your work never ceases to impress. It's a shame that LV_VIEW_DETAILS doesn't function properly, but LV_VIEW_SMALLICON functions perfectly, just as I wanted!

Skwire, I don't suppose you could provide an efficient method of having a scheme run at the start of the script and have the hotkey toggle be reversed so it reverts to the default setting, could you? Or just syntax to get the list view to execute with a script?

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: AutoHotKey solution for Desktop ListView
« Reply #4 on: March 24, 2014, 03:29 PM »
Thank you so much Skwire! Your work never ceases to impress. It's a shame that LV_VIEW_DETAILS doesn't function properly, but LV_VIEW_SMALLICON functions perfectly, just as I wanted!
-guerillablood (March 23, 2014, 11:50 PM)

Actually, when you think about it, LV_VIEW_DETAILS does function properly.  That is, in details mode in Windows Explorer, you only ever get one column.

Skwire, I don't suppose you could provide an efficient method of having a scheme run at the start of the script and have the hotkey toggle be reversed so it reverts to the default setting, could you? Or just syntax to get the list view to execute with a script?
-guerillablood (March 23, 2014, 11:50 PM)

Add the following at the top of your script before the first "Return":

Code: Autohotkey [Select]
  1. DesktopToggle := True
  2. ToggleDesktopView( DesktopToggle )

Then add the following hotkey and function somewhere else in the script:

Code: Autohotkey [Select]
  1. #1::
  2. {
  3.     DesktopToggle := !DesktopToggle
  4.     ToggleDesktopView( DesktopToggle )
  5. }
  6. Return
  7.  
  8. ToggleDesktopView( _Toggle )
  9. {
  10.     LV_VIEW_ICON      := 0 ; Default
  11.     LV_VIEW_DETAILS   := 1 ; Flat font and columns don't work right.
  12.     LV_VIEW_SMALLICON := 2 ; Correct font, columns are okay.
  13.     LV_VIEW_LIST      := 3 ; Flat font and columns are too far apart.
  14.     LV_VIEW_TILE      := 4 ; Flat font, columns are okay, and there is extra text detail.
  15.     LVM_SETVIEW       := 0x108E
  16.     LVM_GETVIEW       := 0x108F
  17.     If ( _Toggle ) ; LV_VIEW_SMALLICON & LV_VIEW_TILE work the best.
  18.     {
  19.         ControlGet, myDesktopWindow, HWND,, SysListView321, ahk_class Progman
  20.         SendMessage, % LVM_SETVIEW, % LV_VIEW_SMALLICON, 0, , % "ahk_id " . myDesktopWindow
  21.     }
  22.     Else ; Set back to default.
  23.     {
  24.         ControlGet, myDesktopWindow, HWND,, SysListView321, ahk_class Progman
  25.         SendMessage, % LVM_SETVIEW, % LV_VIEW_ICON, 0, , % "ahk_id " . myDesktopWindow
  26.     }
  27. }

guerillablood

  • Participant
  • Joined in 2013
  • *
  • default avatar
  • Posts: 12
    • View Profile
    • Donate to Member
Re: DONE: AutoHotKey solution for Desktop ListView
« Reply #5 on: March 25, 2014, 02:14 AM »
Absolutely perfect! Thank you so much Skwire! It assimilates right in with my existing master script.

Unrelated, but interestingly enough the first version would not play nicely with my alt dragging and window shading code in some manner depending on it's placement in the script. Placing it before or between either of those scripts would break the shading and cause the alt dragging to jump erratically. Placing it after them would prevent the listview from launching. Not quite sure why though.

At any rate, the script is functioning just as I want. The autostart toggle bit, along with it's initial purpose, fixed that entirely by me just splitting the autostart toggle up from the initial script around my other functions. No hiccups whatsoever.

Actually, when you think about it, LV_VIEW_DETAILS does function properly.  That is, in details mode in Windows Explorer, you only ever get one column.

Very true, but that doesn't *really* work in an environment where you don't have a scroll bar, unless you have a large vertical area or very few files on your desktop.  ;)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: AutoHotKey solution for Desktop ListView
« Reply #6 on: March 25, 2014, 02:38 PM »
Absolutely perfect! Thank you so much Skwire! It assimilates right in with my existing master script.
-guerillablood (March 25, 2014, 02:14 AM)


Right on.  I'm glad it's working for you.   :Thmbsup:

Very true, but that doesn't *really* work in an environment where you don't have a scroll bar, unless you have a large vertical area or very few files on your desktop.  ;)
-guerillablood (March 25, 2014, 02:14 AM)

Agreed.   :)

I'll move this to the Finished section.

RonJon

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 2
    • View Profile
    • Donate to Member
Re: DONE: AutoHotKey solution for Desktop ListView
« Reply #7 on: May 25, 2014, 01:13 PM »
Would it be very difficult to make this into a windows program, not using autohotkey?

I would love to have the details view on my windows 7 desktop.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: AutoHotKey solution for Desktop ListView
« Reply #8 on: May 25, 2014, 03:34 PM »
I think you're asking if I can compile this into an executable (a .exe file), right?  If so, sure, I can do that.

RonJon

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 2
    • View Profile
    • Donate to Member
Re: DONE: AutoHotKey solution for Desktop ListView
« Reply #9 on: May 25, 2014, 04:16 PM »
Yes, that is exactly what I am requesting.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: DONE: AutoHotKey solution for Desktop ListView
« Reply #10 on: May 26, 2014, 07:54 PM »
Yes, that is exactly what I am requesting.

I incorporated the functionality shown in this thread with another tool I wrote in this thread.  Perhaps that will work for you?