Smart questions
Smart answers
Smart people
Join Tek-Tips Forums

Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Lurky (IS/IT--Management) (OP)
16 Nov 04 10:29
I'm trying to create a logon batch file that will enable us to apply a windows theme when users log on, the only problem is, when we run the *.theme file, we have to click OK or APPLY. Is there any way of running the *.theme file silently?  i've tried using a command prompt and using "start /b Lurky.theme" but it still opens the display properties window and waits for me to click OK or APPLY.

"Experience is the result of failure"

Helpful Member!  bcastner (IS/IT--Management)
16 Nov 04 11:24
I do not know how familiar you are with WSH scripting.  The Themes command line calls the associated file extension like this (I have fully pathed the command):

%windir%\system32\rundll32.exe %windir%\system32\Shell32.dll,Control_RunDLL %windir%\system32\desk.cpl  
desk,@Themes /Action:OpenTheme /File:"%1"

If there is a valid filename used for %1, it is substituted and highlighted waiting for an OK.

. You could use SENDKEY to answer the prompt
. You can use the excellent freeware AutoIt to roll the whole thing together in the alternative:

Lurky (IS/IT--Management) (OP)
16 Nov 04 11:52
I've never heard of WSH Scripting!

I tried to use sendkey, however, the sendkey command runs before the Display properties window has a chance to open. Also, it opens the Sendkey program as well as sending the OK command.

What we'd like is a completely silent way to apply a set theme on the pc's when a user logs on. The old Network Manager set policies that we can't get rid of, therefore when a user logs on, we get classic windows. We need something that runs on login and sets a new theme.

"Experience is the result of failure"

bcastner (IS/IT--Management)
16 Nov 04 12:00
WSH is the native XP installation of the "Windows Scripting Host."  This allows you to script in VB or Java as an alternative to .bat or .cmd files.  It has a native sendkey and RUN facility in either language.

You would run the first statement, and sendkey to the application to OK or Apply as needed.

Given the details I provided earlier, this is a simple script to enable and include at logon.  I apologize as I myself will likely not be able to look at this until late tonight, but if you check the forum again either myself or some of the scripting wizards will reply.  Or, post the question and the link back to here in Forum329
bcastner (IS/IT--Management)
16 Nov 04 12:03
Note to anyone attempting to script this:

add before the sendkey:

WSH.Sleep 1600  ' wait for desk.cpl to initialize
y2ktiger (TechnicalUser)
16 Nov 04 16:57
On the same subject when I start the computer I get a choice of what operating system do I want to use Windows XP or Microsoft Windows if I don't respond it will start after 30 secs with Win XP, but it does wait for my response to press enter every time. I tried to edit Boot.ini in Sys Config Utility but it won't let me, is there anywhere else I can edit the sys boot? By the way I did a fresh install of winXP namely formatted the drive before installing XP.
bcastner (IS/IT--Management)
16 Nov 04 17:04
right-click My Computer, Properties, Advanced, Startup and recovery options - Settings, Edit.

Set in edit mode the default timout to 0.
y2ktiger (TechnicalUser)
16 Nov 04 17:40
Re: Win XP boot, Yes it worked Thank You.
bcastner (IS/IT--Management)
16 Nov 04 22:01

' logon script to set the Theme
' make this the last logon entry
' make sure logon is processed syncrhonously through Group Policy **
' edit YOUR_THEME_HERE to a fully pathed theme

Const iFocus = 1

'open the Shell
Set objShell = Wscript.CreateObject("Wscript.Shell")

' now call Rundll32, and demand focus for the later Sendkeys
objShell = "rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"YOUR_THEME_HERE"", iFocus

'pause for the desk.cpl to initialize
Wscript.Sleep 1600

'send the confirmation to the control panel desk applet
objShell.Sendkeys "{ENTER}"

'  ... end of script

I have not tested this, but this is the gist of what you requested.

** XP by default processes logons asynchronously.  Change this though Group Policy.  See last paragraph of my FAQ779-4017 for instructions.

Lurky (IS/IT--Management) (OP)
17 Nov 04 4:39
When it comes to scripting, i'm clueless!!

I attempted to use Autoit and pasted the scipt into it, changed the theme for the path of the theme i use and it just came up with multiple errors when i ran it.

What exactly should i be doing with this script?

"Experience is the result of failure"

bcastner (IS/IT--Management)
18 Nov 04 20:42
I apologize, as this thread disappeared from my display.

AutoIT has it own scripting language.  What I wrote above I intended you to:

open a notepad session, and create something like themes.vbs, and copy paste the above

A .vbs or other script file should launch in a logon script, or use if part of a larger command session the syntax:

wscript themes.vbs

gspino (MIS)
19 Dec 04 20:58
Here's the code I wrote using AutoIT to restore the Windows Classic Theme to a workstation. After you compile, add START \\uncpath\Scriptname.exe to the last line of your logon script.

;AutoIT Script to Restore Windows Classic Theme to Users Desktop
;Created by GSpino12/17/2004
IF @OSVersion <> "WIN_XP" THEN
  MsgBox(0,"Error","You must be running Windows XP to run this utility")

Dim $var1 = '"' & @WindowsDir & '\'

;launch control panel applet to change desktop theme
Run(@ComSpec & " /c " & 'rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:' & $var1 & 'resources\themes\windows classic.theme"', "", @SW_HIDE)

;wait for Disply Properties window to open, timeout after 3 sec
WinWait("Display Properties", "",3)

;send Enter to open applet

;Exit application

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close