[SOLVED] Default position for Copy window

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Leito
Posts: 402
Joined: 26 Sep 2016 15:37
Location: Windows 10 1809 x64

[SOLVED] Default position for Copy window

Post by Leito » 10 Nov 2017 14:24

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.
Last edited by Leito on 08 Apr 2018 12:10, edited 1 time in total.

highend
Posts: 7738
Joined: 06 Feb 2011 00:33

Re: Default position for Copy window

Post by highend » 10 Nov 2017 15:24

Apart from writing (or finding) a tool that automatically moves that window in the correct position once it pops up?
No
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

Leito
Posts: 402
Joined: 26 Sep 2016 15:37
Location: Windows 10 1809 x64

Re: Default position for Copy window

Post by Leito » 10 Nov 2017 15:29

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)

highend
Posts: 7738
Joined: 06 Feb 2011 00:33

Re: Default position for Copy window

Post by highend » 10 Nov 2017 15:38

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
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

Leito
Posts: 402
Joined: 26 Sep 2016 15:37
Location: Windows 10 1809 x64

Re: Default position for Copy window

Post by Leito » 10 Nov 2017 15:58

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.

highend
Posts: 7738
Joined: 06 Feb 2011 00:33

Re: Default position for Copy window

Post by highend » 10 Nov 2017 16:04

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.
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

Leito
Posts: 402
Joined: 26 Sep 2016 15:37
Location: Windows 10 1809 x64

Re: Default position for Copy window

Post by Leito » 10 Nov 2017 16:18

Thanks, will try that!

Leito
Posts: 402
Joined: 26 Sep 2016 15:37
Location: Windows 10 1809 x64

Re: Default position for Copy window

Post by Leito » 10 Nov 2017 18:39

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

VeeGee
Posts: 139
Joined: 27 Jul 2015 20:00

Re: [SOLVED] Default position for Copy window

Post by VeeGee » 11 May 2018 20:10

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.
Attachments
MoveXYCopyWindow.zip
(20.99 KiB) Downloaded 15 times

highend
Posts: 7738
Joined: 06 Feb 2011 00:33

Re: [SOLVED] Default position for Copy window

Post by highend » 16 May 2018 11:13

I am open to suggestions, comments
Looks fine to me. Clean code...
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

ds1508
Posts: 17
Joined: 19 Jul 2016 12:51
Location: NRW, Germany

Re: [SOLVED] Default position for Copy window

Post by ds1508 » 17 May 2018 20:25

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.
In special cases you may contact me on Discord: http://bit.ly/dsDisco

Post Reply