AutoIt Script - resize to 1024x768 and move window to center

; For window size 1024 * 768
$customWidth = 1024
$customY = 768
 
If $CmdLine[0] = 1 Then
    WinMove($CmdLine[1], "", 0, 0, $customWidth, $customY)
    _Middle($CmdLine[1], "")
EndIf
 
Func _Middle($win, $txt)
    $size = WinGetClientSize($win, $txt)
    Local $y = (@DesktopHeight / 2) - ($size[1] / 2)
    Local $x = (@DesktopWidth / 2) - ($size[0] / 2)
    Return WinMove($win, $txt, $x, $y)
EndFunc

How to run: compile into resize1024.exe and run it with command line.
ie: resize1024.exe [CLASS:WinRarWindow]  <- for centering & resizing WinRAR window to 1024x768.


Note: above code does not count for the size of taskbar but using desktop size for calculation. For my next script, I will calculate it since it is important. Warning don't use above script for monitor with size 1024/768 :).