Jump to content

Start Control Panel Applets


Klaatu
 Share

Recommended Posts

Ever wanted to open up a control panel applet but didn't know how exactly? Well, this routine will do it for you. Just pass the name displayed when you have Control Panel displayed in an Explorer window. Most of the applets are here, but a few of the more obscure ones I have yet to work out.

Coded for Windows XP only. May work on others but never tested. Let me know if you find any errors or can fill in the missing applets. Enjoy.

Func ControlPanel($APPLET)
  ; $Applet should be one of the names displayed when looking at Control Panel
  ; in an Explorer view
  ; Note: Designed to work under Windows XP only. If it works under other
  ;       Windows versions, I'd be suprised.
   Local $RUNDLL32 = @SystemDir & "\rundll32.exe"

   Select
      Case $APPLET = "accessibility options"
         Run($RUNDLL32 & " shell32.dll,Control_RunDLL access.cpl")
      Case $APPLET = "add hardware"
        ; runs the Add New Hardware wizard
         Run($RUNDLL32 & " shell32.dll,Control_RunDLL sysdm.cpl @1")
      Case $APPLET = "add or remove programs"
         Run($RUNDLL32 & " shell32.dll,Control_RunDLL appwiz.cpl")
     ;Case $Applet = "administrative tools"
     ;Run($RUNDLL32 & " Shell32.dll,Control_RunDLL")
      Case $APPLET = "date and time"
         Run($RUNDLL32 & " shell32.dll,Control_RunDLL timedate.cpl,,0")
      Case $APPLET = "display"
        ; displays the Display Options dialog
         Run($RUNDLL32 & " shell32.dll,Control_RunDLL desk.cpl")
      Case $APPLET = "folder options"
         Run($RUNDLL32 & " shell32.dll,Options_RunDLL 0")
      Case $APPLET = "fonts"
        ; displays the Fonts folder in an Explorer view
         Run($RUNDLL32 & " shell32.dll,SHHelpShortcuts_RunDLL FontsFolder")
      Case $APPLET = "game controllers"
         Run($RUNDLL32 & " shell32.dll,Control_RunDLL joy.cpl,,0")
      Case $APPLET = "internet options"
         Run($RUNDLL32 & " shell32.dll,Control_RunDLL inetcpl.cpl")
      Case $APPLET = "keyboard"
         Run($RUNDLL32 & " shell32.dll,Control_RunDLL main.cpl @1,,2")
     ;Case $Applet = "mail"
     ;   Run($RUNDLL32 & " Shell32.dll,Control_RunDLL")
      Case $APPLET = "mouse"
         Run($RUNDLL32 & " shell32.dll,Control_RunDLL main.cpl @0")
      Case $APPLET = "network connections"
         Run($RUNDLL32 & " Shell32.dll,Control_RunDLL ncpa.cpl")
      Case $APPLET = "phone and modem options"
         Run($RUNDLL32 & " Shell32.dll,Control_RunDLL telephon.cpl")
      Case $APPLET = "power options"
         Run($RUNDLL32 & " Shell32.dll,Control_RunDLL powercfg.cpl")
     ;Case $Applet = "printers and faxes"
     ;   Run($RUNDLL32 & " Shell32.dll,Control_RunDLL")
      Case $APPLET = "regional and language options"
         Run($RUNDLL32 & " Shell32.dll,Control_RunDLL intl.cpl")
     ;Case $Applet = "scanners and cameras"
     ;   Run($RUNDLL32 & " Shell32.dll,Control_RunDLL")
     ;Case $Applet = "scheduled tasks"
     ;   Run($RUNDLL32 & " Shell32.dll,Control_RunDLL")
      Case $APPLET = "sounds and audio devices"
         Run($RUNDLL32 & " shell32.dll,Control_RunDLL mmsys.cpl,,0")
     ;Case $Applet = "speech"
     ;   Run($RUNDLL32 & " Shell32.dll,Control_RunDLL")
      Case $APPLET = "system"
         Run($RUNDLL32 & " shell32.dll,Control_RunDLL sysdm.cpl,,0")
      Case $APPLET = "taskbar and start menu"
         Run($RUNDLL32 & " shell32.dll,Options_RunDLL 1")
     ;Case $Applet = "tweakui"
     ;   Run($RUNDLL32 & " Shell32.dll,Control_RunDLL")
      Case $APPLET = "user accounts"
         Run($RUNDLL32 & " Shell32.dll,Control_RunDLL nusrmgr.cpl")
     ;Case $Applet = ""
     ;   Run($RUNDLL32 & " Shell32.dll,Control_RunDLL")
     ;
     ; Extras
     ;
      Case $APPLET = "control panel"
        ; displays all the Control Panel icons in an Explorer view
         Run($RUNDLL32 & " Shell32.dll,Control_RUNDLL")
      Case $APPLET = "add printer"
        ; runs the Add New Printer wizard
         Run($RUNDLL32 & " shell32.dll,SHHelpShortcuts_RunDLL AddPrinter")
      Case $APPLET = "new share"
        ; displays the "New Share" dialog
         Run($RUNDLL32 & " ntlanui.dll,ShareCreate")
      Case $APPLET = "copy disk"
        ;  displays the Copy Disk dialog for removable media
         Run($RUNDLL32 & " diskcopy.dll,DiskCopyRunDll")
      Case $APPLET = "format"
        ; displays the Format Drive dialog
         Run($RUNDLL32 & " shell32.dll,SHFormatDrive")
     ;Case $Applet = ""
     ;   Run($RUNDLL32 & " Shell32.dll,Control_RunDLL")
     ;Case $Applet = ""
     ;   Run($RUNDLL32 & " Shell32.dll,Control_RunDLL")
   EndSelect
EndFunc
My Projects:DebugIt - Debug your AutoIt scripts with DebugIt!
Link to comment
Share on other sites

Klaatu, nice list.

You might want to add *.MSC for Windows XP.

c:\windows\*.msc ... there are 15 on my system

so far I have used these:

;Device Manager

Run('mmc.exe ' & @windowsdir & '\system32\devmgmt.msc')

;Event Viewer

Run('mmc.exe ' & @windowsdir & '\system32\eventvwr.msc')

;Services

Run('mmc.exe ' & @windowsdir & '\system32\services.msc')

On your system, you can:

Start > Run > services.msc (press enter)

(this method should not be used in your code because it is possible that the user has disabled it).

Lilla

2004-04-25 updated to use mmc.exe rather than as dos cmd. This eliminates the black DOS screen.

Edited by Lilla
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...