Specify window size and position from shortcut ?

  • Thread starter Thread starter Terry Pinnell
  • Start date Start date
T

Terry Pinnell

Is it possible to edit or somehow hack an XP shortcut so that it opens the
program at a specified size and position please?
 
Is it possible to edit or somehow hack an XP shortcut so that it opens the
program at a specified size and position please?
See Autohotkey's Winmove function.
 
Terry Pinnell said:
Is it possible to edit or somehow hack an XP shortcut so that it opens the
program at a specified size and position please?

Right-click the shortcut, choose "Properties", click the "Shortcut"
tab. There's a "Run" dropdown where you can choose to have the program
start in a normal, maximized, or minimized state. The exact size and
position of a "normal" window are up to the program.
 
As others have answered this topic and stated : you can specify to have
the program start "minimized", "maximized" or "normal" (restored).

However, there are many window-ed programs that retain the size of window
that they last had when that program exited!

For example open [Notepad.exe] and stretch the window to a noticeably
larger size.

Then close Notepad by clicking on the [X] in the top right-hand corner.

Open [Notepad.exe] again - you will notice that it opens in the exact-same
size as it was when it last exited!!

Thus, you can set the size of future [Notepad.exe] windows...

*NB Although this works for *many* programs, it does not work for *every*
window-ed app.

==

Cheers, Tim Meddick, Peckham, London. :-)
 
The OP was, after all, asking for a Windows-based solution, and didn't make
any request for a third-party solution.

The obvious problem here being that if you install a third-part app to
patch every configuration issue that bothers a body, the result (no matter
how good or how small and compact the app is) will be an overdose of
applications interfering ultimately with the smooth running of the
operating system...

==

Cheers, Tim Meddick, Peckham, London. :-)




Anthony Buckland said:
Tim Meddick said:
As others have answered this topic and stated : you can specify to have
the program start "minimized", "maximized" or "normal" (restored).

However, there are many window-ed programs that retain the size of
window that they last had when that program exited!

For example open [Notepad.exe] and stretch the window to a noticeably
larger size.

Then close Notepad by clicking on the [X] in the top right-hand corner.

Open [Notepad.exe] again - you will notice that it opens in the
exact-same size as it was when it last exited!!

Google is your friend. What it told me in a fast search:
- Any program can store its window size and position, and restore them
from the stored values. Not too helpful if you are using a program but
can't modify its source and recompile it.
- There is a free open-source application called AutoHotkey which
claims to make it possible to launch and control programs (among
many other things) easily, including specifying the position and size
of their windows. Google it yourself to learn more. Caveat: I haven't
tried using it.
Thus, you can set the size of future [Notepad.exe] windows...

*NB Although this works for *many* programs, it does not work for
*every* window-ed app.

==

Cheers, Tim Meddick, Peckham, London. :-)




Terry Pinnell said:
Is it possible to edit or somehow hack an XP shortcut so that it opens
the
program at a specified size and position please?
 
Thanks for the replies. But I was asking for "...a specified size and
position". Not merely minimised, maximised or restored, which I do know
about!

After advice in alt.comp.freeware I eventually found and installed the
program AutoSizer. Basically, on using 'AutoSize Now! (Rescan)' from the
XP System Tray, all open apps that you've previously configured will
change (if necessary) to their specified positions and sizes.

So, while it won't directly do what I asked, which was to "...edit a
shortcut so that it opens the program at a specified size and
position" (unless, of course, it was previously closed at that size and
position), I can instead use AutoSize Rescan as an immediate next step to
get effectively the same result.
 
So, what was wrong with my reply?...

I am aware it doesn't work will *all* applications, but with many, you can
re-size the window to an exact dimension...

When the program is exited, it will retain the window-size dimension data
in the registry, and will restore that window to it's last-opened size
again.

For applications that retain such window size data, you may locate that
data in the registry. For example, the [Notepad.exe] WindowsXP application
;

[HKEY_CURRENT_USER\Software\Microsoft\Notepad]
"iWindowPosX"=dword:000000db
"iWindowPosY"=dword:0000008f

If you want the [Notepad.exe] window to return each time to a specified
size, no matter how it was closed at the end of the Windows session, then
save the data above (i.e. export the key after sizing the window and
exiting the program ).

Then place a shortcut in the "Startup" folder with the following as a
command-line :

regedit /s c:\notepad.reg

....where [c:\notepad.reg] stands for the save (exported) Notepad settings
sub-key reg-file.


Anyway, I was trying to give you a solution that did not require another
third-party app! If you use a third-party app. every time you come across
a Windows configuration issue, you will soon have a private army of
third-party apps sucking up all your Window's resources!!

==

Cheers, Tim Meddick, Peckham, London. :-)
 
Tim Meddick said:
So, what was wrong with my reply?...

I am aware it doesn't work will *all* applications, but with many, you can
re-size the window to an exact dimension...

When the program is exited, it will retain the window-size dimension data
in the registry, and will restore that window to it's last-opened size
again.

For applications that retain such window size data, you may locate that
data in the registry. For example, the [Notepad.exe] WindowsXP application
;

[HKEY_CURRENT_USER\Software\Microsoft\Notepad]
"iWindowPosX"=dword:000000db
"iWindowPosY"=dword:0000008f

If you want the [Notepad.exe] window to return each time to a specified
size, no matter how it was closed at the end of the Windows session, then
save the data above (i.e. export the key after sizing the window and
exiting the program ).

Then place a shortcut in the "Startup" folder with the following as a
command-line :

regedit /s c:\notepad.reg

...where [c:\notepad.reg] stands for the save (exported) Notepad settings
sub-key reg-file.


Anyway, I was trying to give you a solution that did not require another
third-party app! If you use a third-party app. every time you come across
a Windows configuration issue, you will soon have a private army of
third-party apps sucking up all your Window's resources!!

==

Cheers, Tim Meddick, Peckham, London. :-)




Terry Pinnell said:
Thanks for the replies. But I was asking for "...a specified size and
position". Not merely minimised, maximised or restored, which I do know
about!

After advice in alt.comp.freeware I eventually found and installed the
program AutoSizer. Basically, on using 'AutoSize Now! (Rescan)' from the
XP System Tray, all open apps that you've previously configured will
change (if necessary) to their specified positions and sizes.

So, while it won't directly do what I asked, which was to "...edit a
shortcut so that it opens the program at a specified size and
position" (unless, of course, it was previously closed at that size and
position), I can instead use AutoSize Rescan as an immediate next step to
get effectively the same result.

Thanks for that follow-up, Tim. It does add to my knowledge and indeed
offers a new alternative approach using the registry that I'll try to
experiment with. But I currently achieve the same result in an arguably
simpler fashion using my macro program, which includes commands to move
and resize windows based on their exact or partial titles.

I appreciated your original reply too, and there was nothing 'wrong' with
it! However, as I thought I'd explained, it didn't address my specific
need. I wanted more than the (very familiar) capability of a window to
return to its last-closed size and position. As per my original post, I
want many of my windows to open from cold at a *fixed* specification. Not
the last-closed one.

Of course, if I could always rely on remembering to return an application
or folder to that required starting specification before closing it, that
would be another method. (Apart from those not infrequent occasions when
the app gets closed improperly, either crashing itself or the victim of
some other crash or freeze.) But I don't want to have to rely on that
discipline and extra effort.

For further background, take Google Earth as one of many examples. For
*most* of the time I want this at 0,0 and size 1920 x 1146. That gives me
a certain aspect ration in its main map window for image screenshots and
video captures for use in making DVDs. So I want it to open at that. But
quite frequently I might *change* this during a session, for a whole bunch
of reasons. The most familiar one of course being to view the GE window
and one or more others simultaneously.

Best wishes,
 
Alternative method for making Notepad always open at a given fixed position
(no matter where it was last closed)

Copy and paste the following into a batch-file :

------------------- copy between lines -------------------

@echo off
reg ADD HKCU\Software\Microsoft\Notepad /v iWindowPosDX /t REG_DWORD /d 630
/f
reg ADD HKCU\Software\Microsoft\Notepad /v iWindowPosDY /t REG_DWORD /d 447
/f
reg ADD HKCU\Software\Microsoft\Notepad /v iWindowPosX /t REG_DWORD /d 211
/f
reg ADD HKCU\Software\Microsoft\Notepad /v iWindowPosY /t REG_DWORD /d 135
/f

start /b notepad.exe

------------------- copy between lines -------------------

*NB The reg-commands in the above script should each be on one line but may
not appear so due to line-wrap. Please ensure that each command begins
with 'reg' and ends with '/f' apart from the last 'start' command.

Use the resulting batch-file to start notepad - create a shortcut to the
batch-file on your desktop and use that to start notepad.

(Can be potentially adapted for any application that stores it's window's
positional data in the registry)

==

Cheers, Tim Meddick, Peckham, London. :-)




Terry Pinnell said:
Tim Meddick said:
So, what was wrong with my reply?...

I am aware it doesn't work will *all* applications, but with many, you
can
re-size the window to an exact dimension...

When the program is exited, it will retain the window-size dimension data
in the registry, and will restore that window to it's last-opened size
again.

For applications that retain such window size data, you may locate that
data in the registry. For example, the [Notepad.exe] WindowsXP
application
;

[HKEY_CURRENT_USER\Software\Microsoft\Notepad]
"iWindowPosX"=dword:000000db
"iWindowPosY"=dword:0000008f

If you want the [Notepad.exe] window to return each time to a specified
size, no matter how it was closed at the end of the Windows session, then
save the data above (i.e. export the key after sizing the window and
exiting the program ).

Then place a shortcut in the "Startup" folder with the following as a
command-line :

regedit /s c:\notepad.reg

...where [c:\notepad.reg] stands for the save (exported) Notepad settings
sub-key reg-file.


Anyway, I was trying to give you a solution that did not require another
third-party app! If you use a third-party app. every time you come
across
a Windows configuration issue, you will soon have a private army of
third-party apps sucking up all your Window's resources!!

==

Cheers, Tim Meddick, Peckham, London. :-)




Terry Pinnell said:
Thanks for the replies. But I was asking for "...a specified size and
position". Not merely minimised, maximised or restored, which I do know
about!

After advice in alt.comp.freeware I eventually found and installed the
program AutoSizer. Basically, on using 'AutoSize Now! (Rescan)' from
the
XP System Tray, all open apps that you've previously configured will
change (if necessary) to their specified positions and sizes.

So, while it won't directly do what I asked, which was to "...edit a
shortcut so that it opens the program at a specified size and
position" (unless, of course, it was previously closed at that size and
position), I can instead use AutoSize Rescan as an immediate next step
to
get effectively the same result.

Thanks for that follow-up, Tim. It does add to my knowledge and indeed
offers a new alternative approach using the registry that I'll try to
experiment with. But I currently achieve the same result in an arguably
simpler fashion using my macro program, which includes commands to move
and resize windows based on their exact or partial titles.

I appreciated your original reply too, and there was nothing 'wrong' with
it! However, as I thought I'd explained, it didn't address my specific
need. I wanted more than the (very familiar) capability of a window to
return to its last-closed size and position. As per my original post, I
want many of my windows to open from cold at a *fixed* specification. Not
the last-closed one.

Of course, if I could always rely on remembering to return an application
or folder to that required starting specification before closing it, that
would be another method. (Apart from those not infrequent occasions when
the app gets closed improperly, either crashing itself or the victim of
some other crash or freeze.) But I don't want to have to rely on that
discipline and extra effort.

For further background, take Google Earth as one of many examples. For
*most* of the time I want this at 0,0 and size 1920 x 1146. That gives me
a certain aspect ration in its main map window for image screenshots and
video captures for use in making DVDs. So I want it to open at that. But
quite frequently I might *change* this during a session, for a whole
bunch
of reasons. The most familiar one of course being to view the GE window
and one or more others simultaneously.

Best wishes,
 
Thanks Tim. OpenNotepadFixed.bat works fine with Notepad. I'll experiment
with other apps.

Best wishes,

--
Terry, East Grinstead, UK

====================


Tim Meddick said:
Alternative method for making Notepad always open at a given fixed position
(no matter where it was last closed)

Copy and paste the following into a batch-file :

------------------- copy between lines -------------------

@echo off
reg ADD HKCU\Software\Microsoft\Notepad /v iWindowPosDX /t REG_DWORD /d 630
/f
reg ADD HKCU\Software\Microsoft\Notepad /v iWindowPosDY /t REG_DWORD /d 447
/f
reg ADD HKCU\Software\Microsoft\Notepad /v iWindowPosX /t REG_DWORD /d 211
/f
reg ADD HKCU\Software\Microsoft\Notepad /v iWindowPosY /t REG_DWORD /d 135
/f

start /b notepad.exe

------------------- copy between lines -------------------

*NB The reg-commands in the above script should each be on one line but may
not appear so due to line-wrap. Please ensure that each command begins
with 'reg' and ends with '/f' apart from the last 'start' command.

Use the resulting batch-file to start notepad - create a shortcut to the
batch-file on your desktop and use that to start notepad.

(Can be potentially adapted for any application that stores it's window's
positional data in the registry)

==

Cheers, Tim Meddick, Peckham, London. :-)




Terry Pinnell said:
Tim Meddick said:
So, what was wrong with my reply?...

I am aware it doesn't work will *all* applications, but with many, you
can
re-size the window to an exact dimension...

When the program is exited, it will retain the window-size dimension data
in the registry, and will restore that window to it's last-opened size
again.

For applications that retain such window size data, you may locate that
data in the registry. For example, the [Notepad.exe] WindowsXP
application
;

[HKEY_CURRENT_USER\Software\Microsoft\Notepad]
"iWindowPosX"=dword:000000db
"iWindowPosY"=dword:0000008f

If you want the [Notepad.exe] window to return each time to a specified
size, no matter how it was closed at the end of the Windows session, then
save the data above (i.e. export the key after sizing the window and
exiting the program ).

Then place a shortcut in the "Startup" folder with the following as a
command-line :

regedit /s c:\notepad.reg

...where [c:\notepad.reg] stands for the save (exported) Notepad settings
sub-key reg-file.


Anyway, I was trying to give you a solution that did not require another
third-party app! If you use a third-party app. every time you come
across
a Windows configuration issue, you will soon have a private army of
third-party apps sucking up all your Window's resources!!

==

Cheers, Tim Meddick, Peckham, London. :-)




Thanks for the replies. But I was asking for "...a specified size and
position". Not merely minimised, maximised or restored, which I do know
about!

After advice in alt.comp.freeware I eventually found and installed the
program AutoSizer. Basically, on using 'AutoSize Now! (Rescan)' from
the
XP System Tray, all open apps that you've previously configured will
change (if necessary) to their specified positions and sizes.

So, while it won't directly do what I asked, which was to "...edit a
shortcut so that it opens the program at a specified size and
position" (unless, of course, it was previously closed at that size and
position), I can instead use AutoSize Rescan as an immediate next step
to
get effectively the same result.

Thanks for that follow-up, Tim. It does add to my knowledge and indeed
offers a new alternative approach using the registry that I'll try to
experiment with. But I currently achieve the same result in an arguably
simpler fashion using my macro program, which includes commands to move
and resize windows based on their exact or partial titles.

I appreciated your original reply too, and there was nothing 'wrong' with
it! However, as I thought I'd explained, it didn't address my specific
need. I wanted more than the (very familiar) capability of a window to
return to its last-closed size and position. As per my original post, I
want many of my windows to open from cold at a *fixed* specification. Not
the last-closed one.

Of course, if I could always rely on remembering to return an application
or folder to that required starting specification before closing it, that
would be another method. (Apart from those not infrequent occasions when
the app gets closed improperly, either crashing itself or the victim of
some other crash or freeze.) But I don't want to have to rely on that
discipline and extra effort.

For further background, take Google Earth as one of many examples. For
*most* of the time I want this at 0,0 and size 1920 x 1146. That gives me
a certain aspect ration in its main map window for image screenshots and
video captures for use in making DVDs. So I want it to open at that. But
quite frequently I might *change* this during a session, for a whole
bunch
of reasons. The most familiar one of course being to view the GE window
and one or more others simultaneously.

Best wishes,
 
Hi,

Realize that this is an old thread but might help out another. Somehow my Notepad settings were saved such that I could not access the bottom of the window (off screen) and since off screen, no way to resize the window. Figured out what the registry values mean. Edit only if you are comfortable with regedit!

Note: below values are the "Decimal" values if you enter them. I am assuming it is in pixels (but it could be some other "windows" measurement)

iWindowPosX = left position of the window in pixels i.e. pixels from the left of the screen e.g. 10 would put the left size of the Notepad window 10 pixels from the left

iWindowPosY = top position of the windows i.e. pixels from top of screen

iWindowPosDx = width of the notepad window in pixels
iWindowsPoxDy = height of the notepad window in pixels

(it was this last one that was wonky - it was some huge value; I reset it to 100 just so I could work with the window).

and for one other value in there:

fwrap = 0 is "don't wrap" and a 1 is wrap

Hope this saves someone else from aggravation - have lived with it being wonky for a few weeks but figured it must be in the registry.

Oh, the path to these values is:

Computer\HKEY_Current_User\Software\Microsoft\Notepad

Albert Gostick
Guelph, ON Canada
 
Back
Top