Ktulu789

Maximize CompMgmt.msc

3 posts in this topic

Hi! Happy new year, everyone!

I have a script for keyboard shortcuts. It runs different applications when I push the keys.

I wanted a simple thing: to run CompMgmt.msc maximized. I wasn't able to do it xD

TraySetIcon("%WinDir%\system32\shell32.dll",40)
HotKeySet("^+a","Notepad")
HotKeySet("^!p","Paint")
HotKeySet("^!i","Maxthon")
HotKeySet("^+c","MStsc")
HotKeySet("^!v","Volume")
HotKeySet("^!o","Outlook")
HotKeySet("^!w","Word")
HotKeySet("^!e","Excel")
HotKeySet("^+e","IE")
HotKeySet("^!s","SciTE")
HotKeySet("^!+i","AUInfo")
HotKeySet("^+v","VMClient")
HotKeySet("^+m","CharMap")
HotKeySet("^+r","Cmd")
HotKeySet("^+<","TotalCmd")
HotKeySet("^!c","Calculator")
HotKeySet("^!+a","CompMgmt")
While 1
    Sleep(10*60*1000)
WEnd

Func Notepad()
   Opt("WinTitleMatchMode",2);any substring in title
   Select
   Case WinExists("- Notepad")
      WinActivate("- Notepad")
      If MsgBox(4+32+256,"Otro Notepad?","Abrir otro?")==6 Then Run(@WindowsDir&"\System32\Notepad.exe","",@SW_MAXIMIZE)
   Case Else
      Run(@WindowsDir&"\System32\Notepad.exe","",@SW_MAXIMIZE)
   EndSelect
   Opt("WinTitleMatchMode",1);title from start
EndFunc
Func Paint()
   Run(@WindowsDir&"\System32\MSPaint.exe","",@SW_MAXIMIZE)
EndFunc
Func Maxthon()
   Run("C:\Program Files (x86)\Maxthon\Bin\Maxthon.exe","",@SW_MAXIMIZE)
EndFunc
Func CompMgmt()
   ShellExecute("C:\Windows\System32\CompMgmt.msc","","","",@SW_MAXIMIZE)
EndFunc

Just to simplify I pasted some of the script, just to give you all an idea.

Well, CompMgmt always opens restored. No matter which @SW_ command I used.

I tried runing it from console then maximize with WinSetState.
Runing it then double clicking the title bar (double clicking maximizes any window but this one). The mouse doesn't even move.
Running it and then Send("!{Space}x") to get the window menu and select Ma&ximize, nothing happens.
I tried some other alternatives similar to these with no success. Any idea why?

For instance, Notepad runs maximized without problems, and mouse and keystrokes sent work there perfectly.


AutoIt is a blessing, I don't know how I was able to use my computer before [Auto]It :-S

Share this post


Link to post
Share on other sites



CompMgmt.msc is configured to open in a Normal Window, what I had to do was copy C:\Windows\System32\CompMgmt.msc to @ScriptDir then:

Open: @ScriptDir@\CompMgmt.msc with NotePad
Modify Line 5

<WindowPlacement ShowCommand="SW_SHOWNORMAL">

to

<WindowPlacement ShowCommand="SW_SHOWMAXIMIZED">

Save the file

then use the following to execute:
nb: On Windows 10 Enterprise I require the verb "RunAs" to start mmc

ShellExecute(@ScriptDir & '\CompMgmt.msc', '', 'RunAs')

You could also use FileInstall, XML Parser or FileWrite to create the CompMgmt.msc file, if you're using this on multiple systems

Hope that helps.

1 person likes this

Share this post


Link to post
Share on other sites

#3 ·  Posted

Seems like @Subz's solution may be the most reliable.  Another solution (if you don't want to modify the .msc file or embed one) would be to wait for the window to load, then maximize it.

$iPID = Run(@SystemDir & '\mmc.exe "' & @SystemDir & '\compmgmt.msc"')
WinWait("Computer Management")
WinSetState("Computer Management","",@SW_MAXIMIZE)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now