Jump to content

Recommended Posts

Posted

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.

Posted

have you tried shellExecute?

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

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
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
Posted

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

Posted

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.

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
×
×
  • Create New...