Code: Select all
WinMove, X, Y
Code: Select all
WinMove,,, X, Y [, Width, Height, ExcludeTitle, ExcludeText]
Code: Select all
WinMove, WinTitle, WinText, X, Y [, Width, Height, ExcludeTitle, ExcludeText]
Code: Select all
WinMove, X, Y
Code: Select all
WinMove,,, X, Y [, Width, Height, ExcludeTitle, ExcludeText]
Code: Select all
WinMove, WinTitle, WinText, X, Y [, Width, Height, ExcludeTitle, ExcludeText]
Code: Select all
oVersion := "`nVersion: " "v" A_AhkVersion " " (A_PtrSize = 4 ? 32 : 64) "-bit / " (A_IsUnicode ? "Unicode" : "ANSI") ;*[AHK ShowVersion]
. "`nType:" A_Tab A_OSType . "`nOS:" A_Tab A_OSVersion
Gui, Add, Text, , % oVersion
Gui, Show, w300 h100, WinMove TEST
winmove, WinMove TEST,, 200, 500
Return
; Problem signature:
; Problem Event Name: APPCRASH
; Application Name: AutoHotkey.exe
; Application Version: 1.1.29.0
; Application Timestamp: 5b0762f3
; Fault Module Name: AutoHotkey.exe
; Fault Module Version: 1.1.29.0
; Fault Module Timestamp: 5b0762f3
; Exception Code: c0000005
; Exception Offset: 00001226
; OS Version: 6.1.7601.2.1.0.256.1
; Locale ID: 2057
; ...
#Persistent
ListLines
WinMove, % "ahk_id "A_ScriptHwnd,, 0, 0
Code: Select all
WinMove, %A_ScriptName%, , 0, 0
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Persistent
DetectHiddenWindows, On
SetTitleMatchMode, 2
While 1=1 {
#IfWinExist, ahk_class TMain ahk_exe sr.exe
BottomWindow("ahk_class TMain")
^!Escape::ExitApp
}
BottomWindow(WindowName)
{
WinGetPos,,, Width, Height, %WindowName%
; Crashes when it hits the next line.
WinMove, %WindowName%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight)-(A_ScreenHeight*.05)
return
}
Code: Select all
WinMove, EPOCA RADIO,,,,, 124
Code: Select all
;https://autohotkey.com/boards/viewtopic.php?f=5&t=49087&p=219059#p219059
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, RegEx
#SingleInstance, Force
;=============================================================================================================================================
;=============================================================================================================================================
WinTitlesArray:= [ "AutoHotkey.Help", "AHK Studio", "ahk_class Chrome_WidgetWin_1", "Window.Spy", "WinSpy", "ahk_class CabinetWClass", "DataSage50", "INFOS.CLIENT", "TempsTravail", ".SAI", "Ventes|Revenus|Produits ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1", "Achats|fournisseurs|Charges ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1", "Bilan ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1", ".tat des r.sultats ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1", "Rapport.*Rapprochement ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1", "Rapport.*sommaire ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1", "Encaissements ahk_class #32770", "Paiements ahk_class #32770", "Virer des Fonds ahk_class #32770", "Rapprochement & d.p.ts ahk_class #32770", "Journal.g.n.ral ahk_class #32770", "REGISTRE_KM", "TauxStatsCan.csv", "Visual Studio Code", "Accessible.Info.Viewer", "D.tails chronologiques des clients" ]
;=============================================================================================================================================
;=============================================================================================================================================
!#1::
SetBatchLines, -1
SetWinDelay, 0
SaveWindows(WinTitlesArray) ; Function call
Return
#1::
SetBatchLines, -1
SetWinDelay, 0
RepositionWindows(WinTitlesArray) ; function call
Return
;=============================================================================================================================================
;=============================================================================================================================================
; Functions
;=============================================================================================================================================
;=============================================================================================================================================
SaveWindows(WinTitlesArray) ; SaveWindows( **WinTitles Array**)
{
MsgBox,262180,Sauvegarder la position des fenêtres?,Voulez-vous sauvegarder la position des fenêtres, ou non?`n`nSi Oui, le fichier WinTitleStats_%A_ComputerName%.ini sera actualisé en conséquence des changements analysés.
ifMsgBox No
return
WinClose, WinTitleStats_%A_ComputerName%
WinGetActiveTitle, LastActiveWindowSaved
For Each, WinTitle in WinTitlesArray
{
This_WinTitle:= WinTitle
if WinExist(This_WinTitle)
{
IniRead, Ini_x, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, x
IniRead, Ini_y, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, y
IniRead, Ini_w, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, w
IniRead, Ini_h, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, h
IniRead, Ini_MinMax, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, MinMax
WinActivate, %This_WinTitle%
WinGetPos,Current_x,Current_y,Current_w,Current_h, %This_WinTitle%
WinGet, Current_MinMax, MinMax, %This_WinTitle%
if (Current_x != Ini_x) or (Current_y != Ini_y) or (Current_w != Ini_w) or (Current_h != Ini_h) ;or (Current_MinMax != Ini_MinMax)
{
IniDelete, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%
IniWrite, %Current_x%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, x
IniWrite, %Current_y%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, y
IniWrite, %Current_w%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, w
IniWrite, %Current_h%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, h
IniWrite, %Current_MinMax%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, MinMax
IniWrite, %A_Space%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, _________________________________________________________________________________________
;IniWrite, Value , Filename , Section , Key
}
}
}
WinActivate, %LastActiveWindowSaved%
}
;=============================================================================================================================================
;=============================================================================================================================================
RepositionWindows(WinTitlesArray) ; RepositionWindows( **WinTitles Array**)
;=============================================================================================================================================
;=============================================================================================================================================
{
WinClose, WinTitleStats_%A_ComputerName%
WinGetActiveTitle, LastActiveWindowSaved
For Each, WinTitle in WinTitlesArray
{
LoopTopLabel:
This_WinTitle:= WinTitle
if WinExist(This_WinTitle)
{
;IniRead, Ini_MinMax, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, MinMax
;if (Ini_MinMax = 1)
;WinMaximize, %This_WinTitle%
;else if (Ini_MinMax = -1) ;and (LastActiveWindow !== %This_WinTitle%)
;WinMinimize, %This_WinTitle%
;else if (Ini_MinMax = 0)
;{
;IniRead, OutputVar, Filename , Section , Key [, Default]
IniRead, Ini_x, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, x
IniRead, Ini_y, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, y
IniRead, Ini_w, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, w
IniRead, Ini_h, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, h
WinGetPos,Current_x,Current_y,Current_w,Current_h, %This_WinTitle%
WinGet, Current_MinMax, MinMax, %This_WinTitle%
WinGet, MatchingTitle, List, %This_WinTitle% ; Compare this WinTitle contained in the Array to count how many matches with All existing windows and retrieve IDs of these in pseudo-array
if (MatchingTitle > 1) ; If there is more than 1 existing window matching with This_WinTitle
{
;MsgBox % "Inside Loop Layer1`n`nSearching for This_WinTitle in all existing windows to count matches:`n`n" WinTitle "`n`nNumber of Matches found:`n" MatchingTitle
Loop, %MatchingTitle% ; loop for the amount of matches we found
{
This_WinTitle:= "ahk_id " MatchingTitle%A_Index% ; MatchingTitle contient le no. de MATCH| MatchingTitles1, MatchingTitles2, MatchingTitles3, etc.. = Unique ID of This_WinTitle
;MsgBox % "Inside Loop Layer2`n`nAnalysed Match " A_Index "/" MatchingTitle " for`n" This_WinTitle "`n`nThis Matching Window's unique ID is:`n" This_WinTitle
if (Current_MinMax = 0) and (Current_x != Ini_x) or (Current_y != Ini_y) or (Current_w != Ini_w) or (Current_h != Ini_h)
WinMove, %This_WinTitle%,, %Ini_x%, %Ini_y%, %Ini_w%, %Ini_h%
else if (Current_MinMax != 0) and (Current_x != Ini_x) or (Current_y != Ini_y) or (Current_w != Ini_w) or (Current_h != Ini_h)
{
;WinRestore, %This_WinTitle%
WinMove, %This_WinTitle%,, %Ini_x%, %Ini_y%, %Ini_w%, %Ini_h%
}
}
}
else if (Current_MinMax = 0) ; Normal state (not Minimized or Maximized)
if (Current_x != Ini_x) or (Current_y != Ini_y) or (Current_w != Ini_w) or (Current_h != Ini_h)
{
;WinMove, WinTitle ,WinText,X, Y [, Width , Height, ExcludeTitle, ExcludeText]
WinMove, %This_WinTitle%,, %Ini_x%, %Ini_y%, %Ini_w%, %Ini_h%
;Goto,LoopTopLabel
;MsgBox MinMax = 0 and Ini_positions are not matching Current Positions: Continuing back to LoopTopLabel
}
else if (Current_MinMax = 1) ; Maximized
if (Current_x != Ini_x) or (Current_y != Ini_y) or (Current_w != Ini_w) or (Current_h != Ini_h)
{
WinRestore, %This_WinTitle%
WinMove, %This_WinTitle%,, %Ini_x%, %Ini_y%, %Ini_w%, %Ini_h%
;MsgBox MinMax = 1: do nothing: Going LoopTopLabel
}
else if (Current_MinMax = -1)
{
;WinRestore, %This_WinTitle%
;WinMove, %This_WinTitle%,, %Ini_x%, %Ini_y%, %Ini_w%, %Ini_h%
;MsgBox MinMax = -1: do nothing: Continuing back to LoopTopLabel
}
;}
}
WinActivate, %LastActiveWindowSaved%
}
}
^#!1::ExitApp
Thank you Lexikoslexikos wrote:DRocks, you are not using the workaround I noted in my previous post.
Now I suggest you update to v1.1.29.01.
Users browsing this forum: No registered users and 15 guests