Jump to content

WinMove


Recommended Posts

Can you move it with click on title-bar? then try a script like this: It move the Active Window to right top corener of screen when you press Shift-F

HotKeySet("F","_TEST")
While 1
    Sleep(100)
WEnd
Func _TEST()
    Local $LeftMargin = 200, $TopMargin=1
    $pos = WinGetPos("")
    MouseMove($pos[0]+$LeftMargin,$pos[1]+$TopMargin)
    MouseDown("primary")
    MouseMove(@DesktopWidth+$LeftMargin-$pos[2],0-$TopMargin)
    MouseUp("primary")
EndFunc

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Is there any way to beat this or is it doing that for the sole reason what I'm doing? All I want is my windows in the top right of the screen :).

You might be able to get the windoiw where you want it by setting the working area of your screen, but it depends what else you want to have displayed.

You would probably need to set the working area before you ran the application whose window you want to postion.

Here is an example

Const $SPI_SETWORKAREA = 47,$SPI_GETWORKAREA = 48
Const $SPIF_SENDCHANGE = 11


$newWid = @DesktopWidth;- 500
$newHt = @DesktopHeight

$DtopRect = DllStructCreate("int[4]")
;WinMove("Chat", "", 797, 0, 482, 361, 2)
DllStructSetData($DtopRect,1,797,1);left
DllStructSetData($DtopRect,1,0,2);top
DllStructSetData($DtopRect,1,1280,3);right
DllStructSetData($DtopRect,1,361,4);bottom
$PRect = DllStructGetPtr($DtopRect)

$DNowRect = DllStructCreate("int[4]")
$PNowRect = DllStructGetPtr($DNowRect)
$StartRect = DllStructCreate("int[4]")
$PStartRect = DllStructGetPtr($StartRect)

$res = DllCall("user32.dll","int","SystemParametersInfo","int",$SPI_GETWORKAREA,"int",0,"ptr",$PStartRect,"int",0)
MsgBox(0,'work area starts at',DllStructGetData($StartRect,1,1) & ', ' & DllStructGetData($StartRect,1,2) & _
             ' x ' & DllStructGetData($StartRect,1,3) & ', ' & DllStructGetData($StartRect,1,4))

$res = DllCall("user32.dll","int","SystemParametersInfo","int",$SPI_SETWORKAREA,"int",0,"ptr",$PRect,"int",$SPIF_SENDCHANGE)

$res = DllCall("user32.dll","int","SystemParametersInfo","int",$SPI_GETWORKAREA,"int",0,"ptr",$PNowRect,"int",0)
MsgBox(0,'work area is now',DllStructGetData($DNowRect,1,1) & ', ' & DllStructGetData($DNowRect,1,2) & _
             ' x ' & DllStructGetData($DNowRect,1,3) & ', ' & DllStructGetData($DNowRect,1,4) & @cr & _
             "better have a look" & @CR & "Eg run notepad and maximize it." & _
                        "(After you have played with it click OK.)")

;set things back to how they started
$res = DllCall("user32.dll","int","SystemParametersInfo","int",$SPI_SETWORKAREA,"int",0,"ptr",$PStartRect,"int",$SPIF_SENDCHANGE)
$res = DllCall("user32.dll","int","SystemParametersInfo","int",$SPI_GETWORKAREA,"int",0,"ptr",$PNowRect,"int",0)

MsgBox(0,'work area is back to',DllStructGetData($DNowRect,1,1) & ', ' & DllStructGetData($DNowRect,1,2) & _
             ' x ' & DllStructGetData($DNowRect,1,3) & ', ' & DllStructGetData($DNowRect,1,4))
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

With the size of the window that wont work, and the whole idea is to do everything automatic, mousemove isn't automatic IMO, technically it is but to me it is not.

Well you lost me there.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...