Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Edison, New Jersey, USA
    Posts
    215
    Thanks
    4
    Thanked 0 Times in 0 Posts

    WORD XP (Template Installation Script)

    I had an install script for our set of templates when we were using 97. Now, we have migrated to XP. XP has altered it's template storage path to include a file with the user's name on it. Since this file name alters for each install, how do I get the name of that folder and insert it where needed?

    OLD: copy "CIS_RS_Template.dot" "C:Program FilesMicrosoft OfficeTemplatesCIS Templates"
    NEW: copy "CIS_RS_Template.dot" "Cocument Settings(UNKNOWN USERNAME VARIABLE THAT I NEED TO CAPTURE)Application Data MicrosoftTemplates"

    The file path is listed as the default path for the template/ File Locations (tools/ Options/ File Locations)... how do I capture it? <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15> I THink I can, I think I can....

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: WORD XP (Template Installation Script)

    The user templates path is

    Options.DefaultFilePath(wdUserTemplatesPath)

    The workgroup templates path is

    Options.DefaultFilePath(wdWorkgroupTemplatesPath)

    (returns an empty string "" if not set)

  3. #3
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Edison, New Jersey, USA
    Posts
    215
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: WORD XP (Template Installation Script)

    OK, I think we're getting closer....

    But how would I place that information into an install script? To aquire that information, word would have to be open and run the code.... ??

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: WORD XP (Template Installation Script)

    I'm sorry, I didn't read your post closely enough. I hope somebody else will jump in, for I don't know anything about install scripts. <img src=/S/sorry.gif border=0 alt=sorry width=15 height=15>

  5. #5
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: WORD XP (Template Installation Script)

    What kind of install script?

    Is this a VBA script or an actuall installer, like Wise or InstallShield?
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  6. #6
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Edison, New Jersey, USA
    Posts
    215
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: WORD XP (Template Installation Script)

    I just wrote a .bat file that copies files from a zip and saves them to specified directories...


    I place the following into a .bat file. The user just double clicks on it to activate it.

    @echo off
    rem *************************************************
    rem * Name: CIS Template Installation Script
    rem *
    rem * Description: Installs CIS templates onto a local computer
    rem *
    rem * Author: Jody Dyche
    rem *
    rem * Date: November 2002
    rem *
    rem *************************************************

    rem Create directories
    mkdir "C:Program FilesMicrosoft OfficeTemplatesCIS Templates"
    mkdir "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    mkdir "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesrequirements"

    rem Insert the following RS related documents into file folder locations specified:
    copy "CIS_RS_Template.dot" "C:Program FilesMicrosoft OfficeTemplatesCIS Templates"
    Xcopy /R /H "rs_user_guide.doc" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    Xcopy /R /H "Requirements_Manual.doc" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    Xcopy /R /H "Requirements_Example.doc" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    Xcopy /R /H "RS_Requirements_Guideline.doc" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    Xcopy /R /H "IS_Data Model_Guidelines.pdf" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    Xcopy /R /H "QS1.doc" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    Xcopy /R /H "QS2.doc" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"

    Xcopy /H "RTM_Requirements.txt" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesrequirements"

    rem Insert the following RS related documents into file folder locations specified:
    copy "CIS_SDS_Template.dot" "C:Program FilesMicrosoft OfficeTemplatesCIS Templates"
    Xcopy /R /H "sds_user_guide.doc" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    Xcopy /R /H "QS3.doc" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    Xcopy /R /H "SDS_Guidelines.doc" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    Xcopy /R /H "RTM_CompTraceMatrix_SDS.rtf" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesrequirements"


    rem Insert the following RS related documents into file folder locations specified:
    Copy "Mercl___.ttf" "C:WINNTFonts"

    echo "The installation was successful. Please Exit this screen and access the documents by opening Microsoft Word and Clicking File/New, CIS Templates' tab and selecting the desired template."



    Now, the file pathe that I need to copy the templates to has a folder dependant on the user name....I don't know how to pass that unknown.

  7. #7
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: WORD XP (Template Installation Script)

    I don't know whether you can read the registry by using dos commands so I have no idea as to whether it can done with a bat file.

    If you wanted to do the same script using VBS then it can be done easily. The following script (when saved in a text file with a .vbs file extension) will tell you where the user templates are located on a Word 97 machine.

    Set Sh = CreateObject("WScript.Shell")
    key = "HKEY_CURRENT_USERSoftwareMicrosoftOffice8.0Common FileNew"
    WScript.Echo "Your Word User Templates are in: " & VbCr & VbCr & Sh.RegRead(key & "LocalTemplates")

    The rest of your script can be done in VBS too.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  8. #8
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: WORD XP (Template Installation Script)

    If you are running this on an NT based system (NT4, 2K, or WinXP) then you can use an environmental variable in the script:

    From a command prompt type:

    ECHO %username%

    That should give you the WINDOWS user name of the currently logged in person. So your Copy line would look something like:

    copy "CIS_RS_Template.dot" "Cocument and Settings%username%Application Data MicrosoftTemplates"
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  9. #9
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Edison, New Jersey, USA
    Posts
    215
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: WORD XP (Template Installation Script)

    I T W O R K E D !!!!!! It Worked, It worked, It worked!!!!! You can't imagine how excited I am to have this!!!!!

    I just replaced the %USERNAME% right into the same .bat file <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35> <img src=/S/joy.gif border=0 alt=joy width=23 height=23>

  10. #10
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Edison, New Jersey, USA
    Posts
    215
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: WORD XP (Template Installation Script)

    PS... Thanks for giving the "example" line. Very often, I read answers, but they're over my head.... and I have to play with them..... the example helps kick-off/confirm my path.

  11. #11
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: WORD XP (Template Installation Script)

    This method will only work for some users on some PCs. The name of the folder is usually the username, but it can be other things.
    <UL><LI>If you are in a domain and the user logs in to both the domain and the local workstation. You can get folders called username.domainname or username.computername (instead of just username)
    <LI>If you reinstall Windows on top of an existing installation to fix a problem and then create the same usernames. You get folders called username.0000 (or something very similar)[/list]StuartR

  12. #12
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Edison, New Jersey, USA
    Posts
    215
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: WORD XP (Template Installation Script)

    OK, I do have ONE more question.... In my script, most of the files are stored as hidden, and it worked in 97.... Now, they are copying over as hidden. Any suggestions?

    Xcopy /R /H "rs_user_guide.doc" "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"

    /R = Read Only
    /H = Hidden

  13. #13
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: WORD XP (Template Installation Script)

    How about adding
    Attrib -h "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref*.doc"

    StuartR

  14. #14
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Edison, New Jersey, USA
    Posts
    215
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: WORD XP (Template Installation Script)

    Ok, I tried:
    Xcopy -R -H "rs_user_guide.doc" -R -H "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    and
    Xcopy /R /H "rs_user_guide.doc" /R /H "C:Program FilesMicrosoft OfficeTemplatesCIS Templatesref"
    Neither one seemed to help . <img src=/S/weep.gif border=0 alt=weep width=21 height=16>

  15. #15
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: WORD XP (Template Installation Script)

    After the XCOPY try issuing the ATTRIB command.

    StuartR

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •