Size and position an application's window when opening it.
-
Wednesday, October 31, 2012 9:21 PM
<Complete neophyte alert>
I have a very basic script that I run after I have rebooted my windows 7 machine, that opens the six apps I use all day every day. Just a little time-saver that also gets me familiar with powershell. It goes something like this:
$p=[System.Diagnostics.Process]::Start("ONENOTE.EXE")
$p=[System.Diagnostics.Process]::Start("iexplore.EXE")etc etc
Is it possible to do something similar to this that will also size and position a given application on the screen? For example:
- open notepad,
- make it 500 pixels wide,
- make it 500 pixels tall and
- position the top left corner at 100 pixels and 200 pixels respectively.
Cheers
GPO
All Replies
-
Wednesday, October 31, 2012 10:19 PMModerator
GPO,
Have a look at the Create Method of the Win32_Process class and look at it's arguments. It uses another WMI class called Win32_ProcessStartup, I've linked it here, there may be a way to configure the process to launch at a certain position on the desktop.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa394375(v=vs.85).aspx
Specifically the XSize and YSize Properties.
- Edited by Brian WilhiteModerator Wednesday, October 31, 2012 10:26 PM
- Marked As Answer by Bill_StewartMicrosoft Community Contributor, Moderator Saturday, November 03, 2012 2:05 PM

