koresho Posted November 6, 2007 Posted November 6, 2007 Hey all. I want a program I am making to be able to launch control panel apps... like the power configuration page for example. Here is how I am doing it now: If $msg = $powerconfig Then $typerun = "powercfg.cpl" $typeexecute = "RunCmd" _run ($typerun, $typeexecute) EndIf Func _run($typerun, $typeexecute) If $typeexecute = "RunCmd" Then Send ("#r") WinWaitActive ("Run") ClipPut($typerun) If @OSVersion = "WIN_VISTA" Then Sleep (50) Send("^v") If @OSVersion = "WIN_VISTA" Then Sleep (50) ControlClick ("Run", "", 1) EndIf EndFunc ;==>_run Any better ideas? I want to avoid havign to script the Run box.
Kerros Posted November 6, 2007 Posted November 6, 2007 have you tried shellExecute? Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.
koresho Posted November 6, 2007 Author Posted November 6, 2007 (edited) Yes, ShellExecute works with some things like msconfig, cmd, chkdsk and such, Run works for stuff like "control admintools" or "control netconnections" but .cpl or .msc do not work for either command. examples: desk.cpl inetcpl.cpl diskmgt.msc working examples: Run("control netconnections") ShellExecute("verifier") Edit:: I Figured it out. Trial by elimination... This does it: Run(@ComSpec & " /c " & 'diskmgmt.msc', "", @SW_HIDE) Yes i stole that line verbatim from the help file for "Run" Edited November 6, 2007 by koresho
smashly Posted November 6, 2007 Posted November 6, 2007 Hi, ShellExecute() works for all for me... ShellExecute("control.exe", "desk.cpl") ShellExecute("mmc.exe", "diskmgmt.msc") Cheers
Joon Posted November 6, 2007 Posted November 6, 2007 (edited) Try this. $ControlPanel = 'Main.CPL' $TabNumber = 0 ; Starts at 0. $AppletNumber = '@0' ; Starts at 0 Run(@ComSpec & ' /c RUNDLL32 SHELL32.DLL,Control_RunDLL ' & $ControlPanel & ',' & $AppletNumber & ',' & $TabNumber,'',@SW_HIDE) Edited November 6, 2007 by Joon
koresho Posted November 6, 2007 Author Posted November 6, 2007 I didnt think of doing that. Thanks for the help everyone
Eduardo Posted November 6, 2007 Posted November 6, 2007 Hi, you can try this Run("control.exe main.cpl,@0,","",@SW_HIDE) I suggest you check http://www.autoitscript.com/forum/index.ph...;hl=Control.exe Regards, Eduardo.
A. Percy Posted November 6, 2007 Posted November 6, 2007 Hi, you can try this Run("control.exe main.cpl,@0,","",@SW_HIDE) I suggest you check http://www.autoitscript.com/forum/index.ph...;hl=Control.exe Regards, Eduardo.Or call cpl file using ShellExecute Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator VW Bug user Pinheiral (Pinewood) city: http://pt.wikipedia.org/wiki/Pinheiral
koresho Posted November 6, 2007 Author Posted November 6, 2007 Edit:: Trial by elimination... This does it: Run(@ComSpec & " /c " & 'diskmgmt.msc', "", @SW_HIDE) Yes i stole that line verbatim from the help file for "Run" I appreciate the help, however I don't want to waste anyone's time with this topic anymore... That is how I did it.
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