Sign in to follow this  
Followers 0
koresho

Running control panel apps...

9 posts in this topic

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.

Share this post


Link to post
Share on other sites



have you tried shellExecute?


Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by koresho

Share this post


Link to post
Share on other sites

Hi, ShellExecute() works for all for me...

ShellExecute("control.exe", "desk.cpl")
ShellExecute("mmc.exe", "diskmgmt.msc")

Cheers

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by Joon

Share this post


Link to post
Share on other sites

I didnt think of doing that.

Thanks for the help everyone <_<

Share this post


Link to post
Share on other sites

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[center] VW Bug user[/center]Pinheiral (Pinewood) city: http://pt.wikipedia.org/wiki/Pinheiral

Share this post


Link to post
Share on other sites

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.

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
Sign in to follow this  
Followers 0