Page 1 of 1
Open XYplorer window offset from position of existing window?
Posted: 13 Jul 2017 21:24
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?
Re: Open XYplorer window offset from position of existing window?
Posted: 13 Jul 2017 21:47
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
Re: Open XYplorer window offset from position of existing window?
Posted: 14 Jul 2017 16:03
by DrChiron
Why did you send me a link to come here? I don't know anything about your offset!
Doc
Re: Open XYplorer window offset from position of existing window?
Posted: 15 Jul 2017 18:50
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!
Re: Open XYplorer window offset from position of existing window?
Posted: 15 Jul 2017 18:58
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%