Ken@fri Posted January 16, 2010 Posted January 16, 2010 (edited) For a theme addon, based on moataz Royal AIO theme, I was looking for how to select a particular theme from the command line or script with no user interaction.The following command works rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"%windir%\\resources\\themes\\Royal AIO.theme, but it shows a confirmation box with button. I want to run this SILENTLY with the assumed answer "yes".After googling during a week, I finally found how to do it >>>HERE<<<Little mods in the script to set theme dir dynamically & increase time sleep,objShell.Run('rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"%windir%\\resources\\themes\\%YOUR_THEME_NAME%.theme"',1);WScript.Sleep(2000);AND.... ://=================================================================== // FILE: theme.js // DESCRIPTION: automatically set the Windows theme //=================================================================== // create shell object objShell = new ActiveXObject("WScript.Shell"); // start themes applet, load desired theme, and activate this window objShell.Run('rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"%windir%\\resources\\themes\\Royal AIO.theme"',1); // wait for themes window WScript.Sleep(2000); // send the 'enter' key to accept this theme objShell.Sendkeys("{ENTER}");To use it, just create a new .txt file, copy-past script above & save as .js file (like theme.js)This is how I apply it in my INF file :[DefaultInstall]RegisterDlls=Launch.RoyalistTheme.Install[Launch.RoyalistTheme.Install]11,,rundll32.exe,,,"advpack.dll,LaunchINFSection ""%01%\RoyalTem.inf"",Install"[install]BeginPrompt = ...RunPreSetupCommands = Create.i386:1CopyFiles = ...AddReg = ...UpdateInis = ...RunPostSetupCommands= SetRoyalistTheme.AsDefaultThemeEndPrompt = ...[setRoyalistTheme.AsDefaultTheme]RUNDLL32 advpack.dll,LaunchINFSection ""%01%\RoyalTem.inf"",Default.Theme.Choice"[Default.Theme.Choice]BeginPrompt = RoyalistThemeChoicePromptRunPostSetupCommands = Default_Theme_ChoicerEndPrompt = EndInsThemePrompt; At the end of copy files, u can set Royal AIO as Windows default theme[RoyalistThemeChoicePrompt]Title ="::. %ThemeChoice_Title% .::"Prompt ="%ThemeReplacerPrompt%" ButtonType=YESNO; If u're response's YES, file theme.js will be run & Royal AIO installed as default theme (visual style is Royal) ; If NO, your current theme will be kept [Default_Theme_Choicer]"WSCRIPT ""%01%\theme.js"""Enjoy ! Edited February 3, 2010 by Ken@fri Quote
Geej Posted February 1, 2010 Posted February 1, 2010 Thanks for the trick. It has inspire me to make an addon. Quote
Ken@fri Posted February 3, 2010 Author Posted February 3, 2010 Hi Geej!Thanx 4 your contribution. I've downloaded your soft few minutes ago.Bye :welcome: . Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.