Page 1 of 1

[SOLVED] Default position for Copy window

Posted: 10 Nov 2017 14:24
by Leito
When using the classic Windows copy (I'm not using Custom Copy), is there any way to specify the default position of the Copy window? I'd like to make it always open on the lower right part of my screen, instead of in the middle-ish.

Re: Default position for Copy window

Posted: 10 Nov 2017 15:24
by highend
Apart from writing (or finding) a tool that automatically moves that window in the correct position once it pops up?
No

Re: Default position for Copy window

Posted: 10 Nov 2017 15:29
by Leito
I was wondering if Don could send the position to the Window when creating it.

I can easily write an AutoHotKey program to move the window to the correct position, but I have no clue when to execute it. Thought maybe XYplorer could run a script after starting the copy...

Code: Select all

WinGetPos,,, copyWindowWidth, copyWindowHeight, ahk_exe XYcopy.exe
WinMove, ahk_exe XYcopy.exe,, (A_ScreenWidth)-(copyWindowWidth), (A_ScreenHeight)-(copyWindowHeight)

Re: Default position for Copy window

Posted: 10 Nov 2017 15:38
by highend
It's not executing that ahk script after the copy windows was created but letting
it run in the background and check for the windows appearance -> move it

Code: Select all

#NoTrayIcon

SetTimer, XYCopyCheck, 250
return

XYCopyCheck:
... your check / move code ...
return

Re: Default position for Copy window

Posted: 10 Nov 2017 15:58
by Leito
I still want to be able to move it, so it should be moved only when it's opening up. Such timer would move it back permanently.

Re: Default position for Copy window

Posted: 10 Nov 2017 16:04
by highend
Then add that functionality to your code. Give a new copy window an id,
move it once, ignore that id further on as long as that window still exists and
finally remove the id once the window is closed.

In the end the shell copy feature is a windows api call and I wouldn't expect
to mess XY with modifying window positions afterwards.

Re: Default position for Copy window

Posted: 10 Nov 2017 16:18
by Leito
Thanks, will try that!

Re: Default position for Copy window

Posted: 10 Nov 2017 18:39
by Leito
This seems to be working nicely:

Code: Select all

#Persistent ; Keeps a script permanently running (that is, until the user closes it or ExitApp is encountered).

SetTimer, MoveXYCopyWindow, 250
return

MoveXYCopyWindow:
exeName := "XYcopy.exe"
WinGet, windowHandle, ID, ahk_exe %exeName%
if (windowHandles != "" && windowHandle == "")
{
    ; Last active window has been closed, clear the list of handles
    windowHandles := ""
}
IfNotInString, windowHandles, %windowHandle%
{
    ; This is the first time we manage this window, add it to the list of handles
    windowHandles := windowHandles . "," . windowHandle
    ; Get the size of the window
    WinGetPos,,, windowWidth, windowHeight, ahk_id %windowHandle%
    ; Move the window to the lower right of the screen
    WinMove, ahk_id %windowHandle%,, (A_ScreenWidth)-(windowWidth)+7, (A_ScreenHeight)-(windowHeight)-33
}
return

Re: [SOLVED] Default position for Copy window

Posted: 11 May 2018 20:10
by VeeGee
Good afternoon all,
I just started working AutoHotKey this week after reading this thread and based on a reply in another one. I took your base script as a starting point and added a few features for my setup. This is my first attempt at a working AHK. I would assume improvements/corrections could be made. With that said, it does work on my setup without any error.

Added
-support for up to 3 monitors
-INI support (in case you compile to EXE, easier to change settings in the INI)
-extracted XYCopy.exe icon (hope this is okay w/Don) to use with the compiled version (if you use the Convert AHK to EXE utility)
-options to have the window move to CENTER, UPPERLEFT, UPPERRIGHT, LOWERLEFT and LOWERRIGHT

Attached are the base files. I am not including a compiled version. This way you can review the AHK and compile yourself.
Being my first AHK, I am open to suggestions, comments, etc. if you have any.

Re: [SOLVED] Default position for Copy window

Posted: 16 May 2018 11:13
by highend
I am open to suggestions, comments
Looks fine to me. Clean code...

Re: [SOLVED] Default position for Copy window

Posted: 17 May 2018 20:25
by ds1508
Hi,
I use DisplayFusion to move windows to special positions, resize them, or play a sound when a window closes.
https://www.displayfusion.com

Maybe this is something that helps you.