Ktulu789 Posted December 30, 2016 Share Posted December 30, 2016 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 expandcollapse popupTraySetIcon("%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 Link to comment Share on other sites More sharing options...
Subz Posted December 30, 2016 Share Posted December 30, 2016 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. careca 1 Link to comment Share on other sites More sharing options...
spudw2k Posted January 4, 2017 Share Posted January 4, 2017 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) Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now