Welcome colleagues
How do I create a hotkey to open three windows Explorer on a fixed location on the screen each time they are opened with equal space and dimensions.
As shown in attached picture
Thanks in advance
Run Explorer Topic is solved
- Thoughtfu1Tux
- Posts: 125
- Joined: 31 May 2018, 23:26
Re: Run Explorer
You should be able to accomplish this with run, and winmove using each window’s title. Winmove lets you set the size of the window you’re moving as well as moving the window to a specific x,y position.
Try looking up those functions in the help files and post and writing a script. I can help you figure out any problems you might get with it.
Try looking up those functions in the help files and post and writing a script. I can help you figure out any problems you might get with it.
Re: Run Explorer
Thanks for Quick Reply
I want to customize this code with 3 windows explorer, appear together,
and please help
I want to customize this code with 3 windows explorer, appear together,
- E:\Programs\Re
\\srv\Kalemon\Members\05 Linguistic revision Dept
\\srv\Kalemon\Members\08 KG unit
and please help
Code: Select all
#NoEnv
#SingleInstance Force
Gui +LastFound
DllCall("RegisterShellHookWindow", UInt,WinExist())
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
return
Esc:: ExitApp
ShellMessage( wParam,lParam )
{
If ( wParam = 1 ) ; 1 means HSHELL_WINDOWCREATED
{
WinGetClass, class, ahk_id %lParam%
If (class="CabinetWClass")
WinMove,ahk_id %lParam%,, 0, 0, 250, 250
else If (class="Notepad")
WinMove,ahk_id %lParam%,, 257, 0, 250, 250
else If (class="SciTEWindow")
WinMove,ahk_id %lParam%,, 509, 0, 250, 250
else If (class="Word")
WinMove,ahk_id %lParam%,, 760, 0, 250, 250
; ...
}
}
- Thoughtfu1Tux
- Posts: 125
- Joined: 31 May 2018, 23:26
Re: Run Explorer
I'm not sure how to do it with a DLL call, in the script you posted I don't see any way to check for a window name or pass a string along.
Here's a much simpler solution which works fairly well for me.
Here's a much simpler solution which works fairly well for me.
Code: Select all
WinmoveFunction("C:\Users\me\Pictures\Screenshots","Screenshots", 0) ;Passes filepath, windowname, and xlocation to the function "WinMoveFunction"
WinmoveFunction("C:\Users\me\Pictures\Wallpapers","Wallpapers", 640) ;Runs function with these perameters
WinmoveFunction("C:\Users\me\Downloads\_Old Files","_Old Files", 1280) ;Runs function with these perameters
return
WinmoveFunction(Filepath, FolderName, xlocation) {
Run, explorer "%Filepath%" ; Runs the filepath with windows explorer
WinWaitActive, %FolderName% ; In File Explorer the window name is the same as the folder name
WinMove, %FolderName%,, %xlocation%, 0, 640, 1080 ; Moves the window to desired location and resizes it to 640px wide, and 1080p in height.
return
}
- Thoughtfu1Tux
- Posts: 125
- Joined: 31 May 2018, 23:26
Re: Run Explorer
Edit:
Turns out if you just run all three filespaths, and wait for the last window to show up and then move the three of them into their individual locations the script performs much faster.
Turns out if you just run all three filespaths, and wait for the last window to show up and then move the three of them into their individual locations the script performs much faster.
Code: Select all
run, explorer "C:\Users\me\Pictures\Screenshots" ; Run first window
run, explorer "C:\Users\me\Pictures\Wallpapers" ; Run Second window
run, explorer "C:\Users\me\Downloads\_Old Files" ; Run Third Window
WinWait, _Old Files ; Wait for the last window to appear
sleep, 500 ; Half a second for the animations to catch up
Winmove, Screenshots,,0, 0, 640, 1080 ; Moves windows to appropriate locations
Winmove, Wallpapers,,640, 0, 640, 1080
Winmove, _Old Files,,1280, 0, 640, 1080
return ; Finish
- Thoughtfu1Tux
- Posts: 125
- Joined: 31 May 2018, 23:26
Re: Run Explorer
So after playing around with this a bit more and then doing a little bit of googlefoo I found the function that you mentioned in your example on the old forums and there was a different post and showed how to use a window's title. Here's the forum post for reference: https://autohotkey.com/board/topic/8064 ... -messages/
So Here's a script that will watch for a Windows Explorer window to be created with a specific window title and will then instantly move it to a specified location.
This script just watches for a window to be created, so you would have to launch the explorer window either from a different script or a shortcut from your desktop.
So Here's a script that will watch for a Windows Explorer window to be created with a specific window title and will then instantly move it to a specified location.
This script just watches for a window to be created, so you would have to launch the explorer window either from a different script or a shortcut from your desktop.
Code: Select all
global Title1 ; Makes variable global so that it can be accessible to functions even when not passed in.
global Title2
global Title3
Path1 = C:\Users\me\Pictures\Screenshots ; Path to your first folder
Path2 = C:\Users\me\Pictures\Wallpapers
Path3 = C:\Users\me\Downloads\_Old Files
SplitPath, Path1, Title1 ; Input Path1 and pull out folder name for window title
SplitPath, Path2, Title2 ; Input Path1 and pull out folder name for window title
SplitPath, Path3, Title3 ; Input Path1 and pull out folder name for window title
Gui +LastFound
hWnd := WinExist()
DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
Return
ShellMessage( wParam,lParam ) {
If ( wParam = 1 ) ; HSHELL_WINDOWCREATED := 1
{
WinGetTitle, Title, ahk_id %lParam%
If ( Title = Title1 ) ; If created window's title is the same as Variable Title1, then do this
{
WinMove, ahk_id %lParam%, , 0, 0, 640, 1080
}
If ( Title = Title2 ) ; If created window's title is the same as variable Title2, then do this
{
WinMove, ahk_id %lParam%, , 640, 0, 640, 1080
}
If ( Title = Title3 )
{
WinMove, ahk_id %lParam%, , 1280, 0, 640, 1080
}
}
}
Re: Run Explorer
Hi Mr. Thoughtfu1Tux
Thank you very much for this excellent help
But where do I put the links of the windows I want to open
I tried a lot and did not succeed
Please give me an example
please forgive me
Thank you very much for this excellent help
But where do I put the links of the windows I want to open
I tried a lot and did not succeed
Code: Select all
Path1 = E:\Programs\Re ; Path to your first folder
Path2 = E:\1work
Path3 = E:\Programs\Folder_and_File
Please give me an example
please forgive me
Code: Select all
global Title1 ; Makes variable global so that it can be accessible to functions even when not passed in.
global Title2
global Title3
Path1 = E:\Programs\Re ; Path to your first folder
Path2 = E:\1work
Path3 = E:\Programs\Folder_and_File
SplitPath, Path1, Title1 ; Input Path1 and pull out folder name for window title
SplitPath, Path2, Title2 ; Input Path1 and pull out folder name for window title
SplitPath, Path3, Title3 ; Input Path1 and pull out folder name for window title
Gui +LastFound
hWnd := WinExist()
DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
Return
ShellMessage( wParam,lParam ) {
If ( wParam = 1 ) ; HSHELL_WINDOWCREATED := 1
{
WinGetTitle, Title, ahk_id %lParam%
If ( Title = Title1 ) ; If created window's title is the same as Variable Title1, then do this
{
WinMove, ahk_id %lParam%, , 0, 0, 640, 1080
}
If ( Title = Title2 ) ; If created window's title is the same as variable Title2, then do this
{
WinMove, ahk_id %lParam%, , 640, 0, 640, 1080
}
If ( Title = Title3 )
{
WinMove, ahk_id %lParam%, , 1280, 0, 640, 1080
}
}
}
- Thoughtfu1Tux
- Posts: 125
- Joined: 31 May 2018, 23:26
Re: Run Explorer Topic is solved
Woops! I didn't realize you had replied to this.
I have made some modifications to the original and am actually using this script as part of my daily workflow. My original posts were over complicated as I was thinking stuff through as I was posting it, so I apologize for the confusion.
You will need two different scripts, the first to launch file explorer to a specific folder, and the second to watch for the window that's being created and then act on that creation.
Script 1: Opens windows explorer to a specific folder.
Code: Select all
; Windows Key + D Key
#d:: run "C:\Users\%A_UserName%\Downloads"
; Windows Key + R Key
#r:: run,"C:\Software\Sync\AutoHotKey\Tools\RadialMenu"
; Windows Key + T Key
#t:: run,"C:\Software\Sync\AutoHotKey\Tools"
; Windows Key + A Key ; Open all 3 folders in new windows, one after another.
#a::
run "C:\Users\%A_UserName%\Downloads"
sleep, 550 ; Sleeps for a short time, which gives the watch script a chance to run it's winmove function and go back to watching.
run,"C:\Software\Sync\AutoHotKey\Tools\RadialMenu"
sleep,550
run,"C:\Software\Sync\AutoHotKey\Tools"
Script 2: Watches for a window named "Downloads" or "RadialMenu" or "Tools" to be created, and then acts.
Code: Select all
#Persistent
SetBatchLines, -1 ; Determines how fast a script will run (affects CPU utilization).
Process, Priority,, High
#SingleInstance, Force
#NoTrayIcon
CoordMode, ToolTip, Screen
Gui +LastFound
hWnd := WinExist()
DllCall( "RegisterShellHookWindow", UInt,hWnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
Return
ShellMessage( wParam,lParam ) {
If ( wParam = 1 ) ; HSHELL_WINDOWCREATED := 1 ; HSHELL_WINDOWDESTROYED : 2
{
WinGetTitle, Title, ahk_id %lParam%
WinGetClass, class, ahk_id %lParam%
;msgbox, Title: %Title% and class: %Class%
If ( Title = "RadialMenu" ) ; If created window's title is "RadialMenu", do this
{
WinMove, ahk_id %lParam%, , 0, 0, 640, 1080
return
}
If ( Title = "Tools" ) ; If created window's title is "Tools", do this
{
WinMove, ahk_id %lParam%, , 640, 0, 640, 1080
return
}
If ( Title = "Downloads" ) ; If created window's title is "Downloads", do this
{
WinMove, ahk_id %lParam%, , 1280, 0, 640, 1080
return
}
}
}
return
Re: Run Explorer
Hi Mr. Thoughtfu1Tux
Excellent support.
Thank you very much.
Excellent support.
Thank you very much.
Re: Run Explorer
Hi Mr. Thoughtfu1Tux
Excellent support.
Thank you very much.
Excellent support.
Thank you very much.
Who is online
Users browsing this forum: No registered users and 77 guests