Open XYplorer window offset from position of existing window?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
vertigoelectric
Posts: 21
Joined: 19 Jul 2016 07:43

Open XYplorer window offset from position of existing window?

Post by vertigoelectric »

When opening new similar windows in Windows, each new window will appear slightly offset to the previous window, creating a cascading effect. However, this does not happen with XYplorer windows. When a new XYplorer window is opened, it opens at the exact size/position of the last XYplorer window, covering it perfectly.

Is there any way for new XYplorer windows to open slightly offset from the last XYplorer window position?

highend
Posts: 15003
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Open XYplorer window offset from position of existing window?

Post by highend »

XY can be started via
/win=[parameters]

which can contain positional arguments but this doesn't let you do it on <nr of instance> easily

so you would need at least e.g. a batch file that calculates the necessary positional difference
and then starts XY with the /win=... command line parameters
One of my scripts helped you out? Please donate via Paypal

DrChiron
Posts: 40
Joined: 04 Apr 2013 15:01
Location: Los Angeles environs

Re: Open XYplorer window offset from position of existing window?

Post by DrChiron »

Why did you send me a link to come here? I don't know anything about your offset! :maf: :whistle: :?:
Doc
Retired Hollywood Video Engr
[WinX Home amd64] [XYplorer 20.80.0000]

vertigoelectric
Posts: 21
Joined: 19 Jul 2016 07:43

Re: Open XYplorer window offset from position of existing window?

Post by vertigoelectric »

highend wrote:XY can be started via
/win=[parameters]

which can contain positional arguments but this doesn't let you do it on <nr of instance> easily

so you would need at least e.g. a batch file that calculates the necessary positional difference
and then starts XY with the /win=... command line parameters
Hmmm, interesting. Might be a little more complicated than it's worth this time around, but it might be fun to play with some time in the future.

Thanks!

highend
Posts: 15003
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Open XYplorer window offset from position of existing window?

Post by highend »

This isn't that complicated...

E.g.:

Code: Select all

@SETLOCAL EnableDelayedExpansion
@ECHO OFF & COLOR 0F & CLS
@ECHO Batch: "%~0" & ECHO.
REM ########################################################
REM ### Store Directory Paths ##############################
REM ########################################################
CD /D "%~dp0"
SET "WorkingDir=%CD%"
PUSHD..
SET "ParentDir=%CD%"
POPD
REM ### End Paths ##########################################

REM Set offsets in pixel
SET "OffsetX=30"
SET "OffsetY=30"

REM Where is XY's ini file
SET "XYINI=%WorkingDir%\Data\XYplorer.ini"


REM Get X and Y values from XYplorer.ini
FOR /F "tokens=*" %%M IN ('TYPE "%XYINI%" ^| FINDSTR /I /C:"WinX"') DO (
	SET XKV=%%M
	FOR /F "tokens=1,2 delims==" %%K IN ("!XKV!") DO SET WinX=%%L
)

FOR /F "tokens=*" %%M IN ('TYPE "%XYINI%" ^| FINDSTR /I /C:"WinY"') DO (
	SET YKV=%%M
	FOR /F "tokens=1,2 delims==" %%K IN ("!YKV!") DO SET WinY=%%L
)

REM Get number of running XY instances
FOR /F %%C IN ('TASKLIST /FI "IMAGENAME eq xyplorer.exe" ^| find /I /C "xyplorer.exe"') DO SET Count=%%C

REM Calculate the offsets for the new window
SET /A "OffX=%WinX%+(%OffsetX%*%Count%)"
SET /A "OffY=%WinY%+(%OffsetY%*%Count%)"

REM If no instances are running, use .ini values
IF %OffX% EQU 0 SET "OffX=%WinX%"
IF %OffY% EQU 0 SET "OffY=%WinY%"

REM Start XYplorer
START "" "%WorkingDir%\XYplorer.exe" /new /win=,%OffX%,%OffY%

One of my scripts helped you out? Please donate via Paypal

Post Reply