Thanks to everyone!
Each time someone asks "Is it possible" I am tempted to give a straight
answser and say "Yes, it is possible." However, since you probably wanted to
ask "How can I start this snap-in maximised", here is an answer:
Set WshShell = CreateObject("WScript.Shell")
WshShell.run "cmd.exe /c compmgmt.msc", 0, False
WScript.sleep 15000
WshShell.SendKeys("% x")
Note that the script is fragile like all scripts that involve the SendKeys
method. The delay of 15 seconds may be excessive or inadequate, depending on
the number of disks and partitions that the snap-in has to process.
Do you know of any freeware, small executable to start applications in a
maximized window?.
"Pegasus (MVP)" <I....@fly.com.oz> wrote in message
news:uyjTbWqC...@TK2MSFTNGP05.phx.gbl...
Sorry, I don't.
CMD.EXE can do that in most cases, i.e.:
start /max notepad.exe
This works for MMC.EXE as well:
Set WshShell = CreateObject("WScript.Shell")
WshShell.run "cmd.exe /c start /max mmc.exe", 0, False
Unfortunately, however, this does not work:
Set WshShell = CreateObject("WScript.Shell")
WshShell.run "cmd.exe /c start /max mmc.exe %windir%\system32\compmgmt.msc",
0, False
as the xml code in the .mmc file includes settings such as the window size.
If you want compmgmt.msc to always open maximized, you will have to open it
in author mode, maximize its window, and save it - either back to
%windir%\system32 or somewhere else.
/Al
"Al Dunbar" <Alan...@hotmail.com.nospaam> wrote in message
news:e66O9z6C...@TK2MSFTNGP05.phx.gbl...
But if you want compmgmt.msc to always open maximized on every computer, you
could make the change on one computer and copy the .msc file to all the
others - there is no need to open each .msc file in author mode on more than
one system.
/Al
"Tyler Durden" <ab...@antispam.org> wrote in message
news:uoxWGWDD...@TK2MSFTNGP04.phx.gbl...
Set WshShell = CreateObject("Wscript.Shell")
With GetObject("winmgmts:Win32_Process")
Set oInParams = .Methods_("Create").InParameters.SpawnInstance_
oInParams.CommandLine = strCMD
Set oOutParams = .ExecMethod_("Create", oInParams)
strPID = oOutParams.ProcessId
returned = oOutParams.ReturnValue
End With
While WshShell.AppActivate(strPID) = FALSE
wscript.sleep 500
Wend
If returned = 0 Then
WshShell.AppActivate strPID
If WshShell.AppActivate(strPID) then _
WshShell.SendKeys "(% )" & "{DOWN}{DOWN}{DOWN}{DOWN}~"
Wsh.sleep 99 : WshShell.SendKeys("^")
End If
'''''''''''''''''''''''''''''''
As "Pegasus (MVP)" already wrote:
Note that the script is fragile like all scripts that involve the SendKeys
method. !
\Remco
Hi Tyler,
[...]
| Do you know of any freeware, small executable to start applications
| in a maximized window?.
My tool StartMax (freeware) is maybe what you need ;-)
http://glsft.free.fr/index.php?option=com_content&task=view&id=52&Itemid=28
--
Gilles LAURENT
MVP Windows Server - Admin Frameworks
http://glsft.free.fr
I really thank you, that's *exactly* what I was looking for. Worked
perfectly, and I hope that helps someone else too (certainly will).
Thank you!
"Gilles LAURENT [MVP]" <gl...@free.fr> wrote in message
news:ek9p483D...@TK2MSFTNGP04.phx.gbl...