Settings: Saved to WindowList.txt
https://bpaste.net/show/3c1fd705e5d8
Update 1: now requires TF library to sort windows - https://github.com/hi5/TF
Update 2: fixes
Update 3: more fixes, shows saved windows, requiring Notify - http://www.autohotkey.com/board/topic/4 ... ns-v04991/
Remember windows' position and size
Remember windows' position and size
Last edited by zotune on 21 Nov 2014, 15:12, edited 1 time in total.
Re: Remember windows' position and size
?? What does this do? How does it work? etc...
Re: Remember windows' position and size
Some more explanations and examples would be nice.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
Re: Remember windows' position and size
[WIN] + [SHIFT] + [TAB]: Saves everything but your minimized windows position into WindowList.txt, even works if they're maximized or not.
[WIN] + [TAB]: Restores your saved windows positions, also maximizes them if they were saved like that.
Note: Uses process detection, will not work on multiple windows from the same process.
[WIN] + [TAB]: Restores your saved windows positions, also maximizes them if they were saved like that.
Note: Uses process detection, will not work on multiple windows from the same process.
Re: Remember windows' position and size
Good job. It's interesting to see your script.
In case you're interested, I wrote something similar for an "Ask for Help" topic. Link.
I don't plan on developing or maintaining it. Just thought it was worth mentioning, since the scripts are related.
In case you're interested, I wrote something similar for an "Ask for Help" topic. Link.
I don't plan on developing or maintaining it. Just thought it was worth mentioning, since the scripts are related.
Re: Remember windows' position and size
Thanks, I'll have a look Mine seems to work better now. I can use it to run processes with the same name, that way I can position duplicate simulators with different ports. I'll post the new script if anyone is interested (I'll have to extract it from my code)
-
- Posts: 21
- Joined: 19 Feb 2015, 20:15
Re: Remember windows' position and size
Any chance this code is still available?
Re: Remember windows' position and size
Code: Select all
; http://ahkscript.org/boards/viewtopic.php?f=6&t=5166
#Include TF.ahk
; Settings: Saved to WindowList.txt
; Requires TF library to sort windows
; Save window profile (does not remember minimized windows):
!r::
DetectHiddenWindows Off
FileDelete, WindowList.txt
Remember=
WindowList=
WinGet, Window, List
Loop, %Window%
{
WinGet, Process, ProcessName, % "ahk_id " Window%A_Index%
if (Process != "explorer.exe")
{
Remember=%Remember%%Process%`n
}
}
StringSplit,Remember,Remember,"`n"
Loop, %Remember0%
{
Process:=Remember%A_Index%
WinGetPos, X, Y, Width, Height, ahk_exe %Process%
WinGet, MinMax, MinMax, ahk_exe %Process%
if !InStr(WindowList,Process) and (Process != "") and (X != "") and (Y != "") and (Width != "") and (Height != "") and (Width != "0") and (Height != "0") and (MinMax != "") and (MinMax != "-1")
{
WindowList=%WindowList%%Process%|%X%|%Y%|%Width%|%Height%|%MinMax%`n
}
}
WindowList:=TF_RemoveBlankLines(WindowList)
WindowList:=TF_ReverseLines(WindowList)
FileAppend, %WindowList%, WindowList.txt
Notify("Saved layout",,5)
DetectHiddenWindows On
Return
;Load window profile
#TAB::
DetectHiddenWindows Off
FileRead, WindowList, WindowList.txt
StringSplit,Rows,WindowList,"`n`r"
Loop, %Rows0%
{
Win:=Rows%A_Index%
StringSplit,Columns,Win,"|"
;Restore if minimized
Process, Exist, %Columns1%
IF errorlevel!=0
{
Minmax=
While (Minmax = "")
{
WinGet, MinMax, MinMax, ahk_exe %Columns1%
}
If (MinMax = "-1")
{
;WinActivate, ahk_exe %Columns1%
PostMessage, 0x112, 0xF120,,, ahk_exe %Columns1%
}
}
;Move to saved position
WinMove, ahk_exe %Columns1%,, %Columns2%, %Columns3%, %Columns4%, %Columns5%
;Maximize if saved as such
If (Columns6 = "1")
{
WinMaximize, ahk_exe %Columns1%
}
;Put the window at the top of other windows
WinSet, Top,, ahk_exe %Columns1%
}
DetectHiddenWindows On
Return
-
- Posts: 21
- Joined: 19 Feb 2015, 20:15
-
- Posts: 47
- Joined: 09 Oct 2014, 11:44
Re: Remember windows' position and size
Kon....that was me you wrote that for andI have to tell you Ive gotten very much use out of it....very happy with it!kon wrote:Good job. It's interesting to see your script.
In case you're interested, I wrote something similar for an "Ask for Help" topic. Link.
I don't plan on developing or maintaining it. Just thought it was worth mentioning, since the scripts are related.
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: CastleChou and 94 guests