Copy Office XML Colour Palette to new PC using script

My company has recently re-branded and I have created new PowerPoint, Excel and Word templates.
In Office I have created my colour palettes which are very useful, but these dont go across with the PowerPoint/Excel/Word files.

Ive been looking into it and it create an XML file on the machine with all the colours within that palette.
C:\Users\user\AppData\Roaming\Microsoft\Templates\Document Themes\Theme Colors\Name.xml

I would like an easy way for everyone else in the company to copy this XML onto their computer.

Can this be done with a batch script??

Any advice?

Steve
Steve TinsleyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
Well if you placed the file on a shared folder that everyone has access to, then a small BAT file like this could also be placed in that folder that they could run to copy the file to their machine.  Assuming you don't want to overwrite it if they already had that file, then perhaps something like:

@echo off
setlocal
set SourceFile=\\server\share\folder1\Name.xml
set DestFile=%APPDATA%\Microsoft\Templates\Document Themes\Theme Colors\Name.xml
if not exist "%DestFile% copy "%SourceFile%" "%DestFile%"

Open in new window


»bp
0
Shaun VermaakTechnical Specialist/DeveloperCommented:
Do you have Active Directory? Deploy the file as a GPO file preference similar to this
https://www.experts-exchange.com/articles/29126/Deploy-single-EXE-applications-without-installers.html
0
Steve TinsleyAuthor Commented:
No Active Directory. It will be something that we can email out.

Thanks for the script idea.... Because it will be emailed out the xml needs to be in the script.
I thought something like this... But ive got no idea now to do any error checking. Check for success etc....

@echo off
setlocal

@echo on
ECHO ===== COLORS =====

@echo off

SET SCRIPTXMLNAME=SCRIPT_COLOURS1
SET SCRIPTPATH=%APPDATA%\Microsoft\Templates\Document Themes\Theme Colors\
SET SCRIPTFILENAME=SCRIPT_COLOURS1.xml
SET SCRIPTFULLPATH="%SCRIPTPATH%%SCRIPTFILENAME%"

@echo on
ECHO Creating XML File
@echo off
ECHO ^<!-- COLOURS --^> >%SCRIPTFULLPATH%

ECHO ^<?xml version="1.0" encoding="UTF-8" standalone="yes"?^> >>%SCRIPTFULLPATH%

ECHO ^<a:clrScheme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="%SCRIPTXMLNAME%"^> >>%SCRIPTFULLPATH%

ECHO ^<a:dk1^>^<a:sysClr val="windowText" lastClr="000000"/^>^</a:dk1^> >>%SCRIPTFULLPATH%
ECHO ^<a:lt1^>^<a:sysClr val="window" lastClr="FFFFFF"/^>^</a:lt1^> >>%SCRIPTFULLPATH%
ECHO ^<a:dk2^>^<a:srgbClr val="37393A"/^>^</a:dk2^> >>%SCRIPTFULLPATH%
ECHO ^<a:lt2^>^<a:srgbClr val="8C827E"/^>^</a:lt2^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent1^>^<a:srgbClr val="006EB6"/^>^</a:accent1^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent2^>^<a:srgbClr val="00A97A"/^>^</a:accent2^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent3^>^<a:srgbClr val="7CCBE2"/^>^</a:accent3^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent4^>^<a:srgbClr val="6679BA"/^>^</a:accent4^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent5^>^<a:srgbClr val="E6224F"/^>^</a:accent5^> >>%SCRIPTFULLPATH%
ECHO ^<a:accent6^>^<a:srgbClr val="C8B9AF"/^>^</a:accent6^> >>%SCRIPTFULLPATH%
ECHO ^<a:hlink^>^<a:srgbClr val="006EB6"/^>^</a:hlink^> >>%SCRIPTFULLPATH%
ECHO ^<a:folHlink^>^<a:srgbClr val="954F72"/^>^</a:folHlink^> >>%SCRIPTFULLPATH%

ECHO ^</a:clrScheme^> >>%SCRIPTFULLPATH%



endlocal

Open in new window


Will this work? Any ideas how to improve?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Bill PrewCommented:
Have you done a proof of concept on this in your environment?  Most good email clients and/or antivirus products won't let a BAT file attached to an email anywhere near execution...

One tip in the BAT file itself, you don't need the outer ECHO commands in things like:

@echo on
ECHO Creating XML File
@echo off


Just the actual ECHO in the middle is all you need, it will be shown.  The ECHO OFF and ECHO ON only affect each commadn line being echoed before it gets executed, so if you turn it on for the ECHO's you will see it twice.  Just use:

ECHO Creating XML File


»bp
1
Bill PrewCommented:
And if you wanted to play around with it, here's a slightly easier way I use to embed "data" into the BAT script...

@echo off
setlocal

ECHO ===== COLORS =====

SET SCRIPTPATH=%APPDATA%\Microsoft\Templates\Document Themes\Theme Colors\
SET SCRIPTFILENAME=SCRIPT_COLOURS1.xml
SET SCRIPTFULLPATH="%SCRIPTPATH%%SCRIPTFILENAME%"

ECHO Creating XML File

if exist %SCRIPTFULLPATH% del %SCRIPTFULLPATH%

set WriteFile=
for /f "tokens=1,* delims=]" %%A in ('find /n /v "" "%~f0"') do (
  if defined WriteFile echo.%%B>>%SCRIPTFULLPATH%
  if /i "%%B" == "[XML]" set WriteFile=Y
)
exit /b


[XML]
<!-- COLOURS --> 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<a:clrScheme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="SCRIPT_COLOURS1"> 
<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1> 
<a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1> 
<a:dk2><a:srgbClr val="37393A"/></a:dk2> 
<a:lt2><a:srgbClr val="8C827E"/></a:lt2> 
<a:accent1><a:srgbClr val="006EB6"/></a:accent1> 
<a:accent2><a:srgbClr val="00A97A"/></a:accent2> 
<a:accent3><a:srgbClr val="7CCBE2"/></a:accent3> 
<a:accent4><a:srgbClr val="6679BA"/></a:accent4> 
<a:accent5><a:srgbClr val="E6224F"/></a:accent5> 
<a:accent6><a:srgbClr val="C8B9AF"/></a:accent6> 
<a:hlink><a:srgbClr val="006EB6"/></a:hlink> 
<a:folHlink><a:srgbClr val="954F72"/></a:folHlink> 
</a:clrScheme> 

Open in new window


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Echo_SCommented:
If you build the color theme into the template (or theme), then they'll travel with the file and you won't need to install them on everyone's computer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.