Open three file explorer windows in specific locations on-screen and displaying different directories??

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
s1rrah
Posts: 5
Joined: 26 Jun 2022, 06:49

Open three file explorer windows in specific locations on-screen and displaying different directories??

Post by s1rrah » 12 Aug 2022, 21:32

Coding friend is needing to routinely open three separate Windows File Explorer Windows, aligned side by side in a row and not tiled/cascaded with each displaying the contents of three different directories.

Can AutoHotkey accommodate this sort of procedure and consolidated within a single script?

Thanks in advance,

~s1rrah

User avatar
mikeyww
Posts: 26882
Joined: 09 Sep 2014, 18:38

Re: Open three file explorer windows in specific locations on-screen and displaying different directories??

Post by mikeyww » 12 Aug 2022, 21:41

Yes, you can Run explorer, followed by :arrow: WinMove.

Code: Select all

GroupAdd, explore, ahk_class CabinetWClass
group = ahk_group explore
For dir, x in {"C:\": 100, "C:\Users": 700, "C:\Windows": 1300} {
 WinMinimize, %group%
 Run, explorer %dir%
 SoundBeep, 1500
 WinWaitActive, %group%
 WinRestore
 WinMove,,, x, 300, 450, 450
}
WinRestore, %group%

s1rrah
Posts: 5
Joined: 26 Jun 2022, 06:49

Re: Open three file explorer windows in specific locations on-screen and displaying different directories??

Post by s1rrah » 12 Aug 2022, 22:30

mikeyww wrote:
12 Aug 2022, 21:41
Yes, you can Run explorer, followed by :arrow: WinMove.

Code: Select all

GroupAdd, explore, ahk_class CabinetWClass
group = ahk_group explore
For dir, x in {"C:\": 100, "C:\Users": 700, "C:\Windows": 1300} {
 WinMinimize, %group%
 Run, explorer %dir%
 SoundBeep, 1500
 WinWaitActive, %group%
 WinRestore
 WinMove,,, x, 300, 450, 450
}
WinRestore, %group%
Thanks you for the prompt response. I am a utmost beginner but can interpret most of what you have presented with the above; seems to open three explorer windows in three distinct directories, and in specific locations ...

However, after creating a new AutoHotkey script using your provided code and simply right clicking it and selecting "run script" ... nothing happens. Again. Just jumping out of the nest here so pardon my ignorance. The other, very simple scripts I use daily all have a specific hotkey command such as "#v::
Run, ms-settings:apps-volume..." which specificies that pressing WIN-V will then run the script and open the volume settings.

Should their not be an initiating hot key defined to run your basic, but fairly understandable routine quoted above? Otherwise, it looks like a very good start towards doing exactly what I'm trying to help my friend sort out.

Thanks for any further input,

~s1rrah

User avatar
mikeyww
Posts: 26882
Joined: 09 Sep 2014, 18:38

Re: Open three file explorer windows in specific locations on-screen and displaying different directories??

Post by mikeyww » 13 Aug 2022, 06:03

You are running this script by itself, with no other code? You can insert a MsgBox command as the first line, so that you can confirm that this message box is displayed.

What AHK version are you running? Mine is 1.1.34.03.

s1rrah
Posts: 5
Joined: 26 Jun 2022, 06:49

Re: Open three file explorer windows in specific locations on-screen and displaying different directories??

Post by s1rrah » 13 Aug 2022, 09:09

mikeyww wrote:
13 Aug 2022, 06:03
You are running this script by itself, with no other code? You can insert a MsgBox command as the first line, so that you can confirm that this message box is displayed.

What AHK version are you running? Mine is 1.1.34.03.
...

Ah! Sensei! Thank you!

I am happy to report that I now see positive results after following your last suggestion of simply adding the "MsgBox" command at the top of the previous code you provided and as well adding my own bit "#Q::" to map the script to the WIN-Q key combination. Very exciting! ;-)

Now? After first manually running the script? When I use the WIN-Q key combo? I first get a standard-issue dialogue box that asks me to click "OK" and that a "New AutoHotKey Script" is going to run. This dialogue "ok" box is a step I will work to eliminate in future revisions as I ultimately simply want the three windows to open ... but lo and behold! Upon clicking "OK"? Three identically sized file explorer windows do open in a nicely aligned horizontal row and to precisely the directories you specified in your originally suggested script (I've attached a screenshot below).

And here is the code I'm using currently based on your basic, first instruction:

Code: Select all

#Q::
MsgBox
GroupAdd, explore, ahk_class CabinetWClass
group = ahk_group explore
For dir, x in {"C:\": 100, "C:\Users": 700, "C:\Windows": 1300} {
 WinMinimize, %group%
 Run, explorer %dir%
 SoundBeep, 1500
 WinWaitActive, %group%
 WinRestore
 WinMove,,, x, 300, 450, 450
}
WinRestore, %group%
...
[Mod edit: [code][/code] tags added.]

And here is a screen shot of the window size and placement onscreen ...

Image

...

When and if you have time for further instruction? Where among the above bit of scripting would I make adjustments to change the default size of each of the three windows while still retaining the perfectly spaced and aligned presentation? Ultimately, I will want the three windows to be significantly larger so as to of course show more of the respective directory/file contents but just that little bit of progress you've assisted me with is wonderful (I'm not very good at scripting but it's a very exciting effort/reward process that I've always enjoyed so thanks again for your input).

I too will be interested in exploring various coordinate based placement of the windows onscreen and as pertains to my particular monitor resolution (3840x1600) but much of such I'm sure I will manage simply by hacking various values and testing/retesting. But primarily and first? I'm curious where to begin identifying that area of the above script which would allow me to open the same windows but with each being a good bit larger while still identical in size.

Best regards,

~s1rrah

...

...
Attachments
image.png
image.png (908.95 KiB) Viewed 927 times

User avatar
mikeyww
Posts: 26882
Joined: 09 Sep 2014, 18:38

Re: Open three file explorer windows in specific locations on-screen and displaying different directories??

Post by mikeyww » 13 Aug 2022, 09:27

x-values are on line 5 of your new script. y, width, and height are on line 11. See :arrow: WinMove.

Code: Select all

SysGet, mon, MonitorWorkArea
GroupAdd, explore, ahk_class CabinetWClass
group    = ahk_group explore
dirList := ["C:\", "C:\Users", "C:\Windows"]
y       := monTop + 100
width   := A_ScreenWidth  / (dirList.Count() + 1)
height  := A_ScreenHeight / 2
offset  := 50

F4::WinClose, %group%
#q Up::
For dirNum, dir in dirList {
 WinMinimize, %group%
 Run, explorer %dir%
 WinWaitActive, %group%
 WinRestore
 WinMove,,, (dirNum - 1) * A_ScreenWidth / dirList.Count() + offset, y, width, height
}
WinRestore, %group%
Return

s1rrah
Posts: 5
Joined: 26 Jun 2022, 06:49

Re: Open three file explorer windows in specific locations on-screen and displaying different directories??

Post by s1rrah » 13 Aug 2022, 15:50

Thanks again for the time and assistance; I'm having fun learning ...

Post Reply

Return to “Ask for Help (v1)”