How can I customize Microsoft Word Outline Numbered List Templates with AppleScript?

I wrote an applescript to set up a word document with the appropriate styles to give the document an academic setup, much like what Xelatex produces. This is a work in progress and I have a problem.
I have successfully applied the style changes to each Header and I have applied the desired outline numbered list template "list template 5 of list gallery 3", however I would like to add tab stops to each one in order to make each header look slick like in Latex.
To do what I want manually in Microsoft Word 2011 mac I would click Bullets and Numbering, customize, under text position i would check the tab stop box and put in some value (1 cm, for example)
The following is an approximation of the result of running this script on a document with headings 1-9 applied consequently to each line, respectively. Note how they are not even. I think this is an issue with the template, but I want to be able to run this script on any mac without extra template files.
1    Heading 1
1.1    Heading 2
1.1.1    Heading 3
1.1.1.1    Heading 4
1.1.1.1.1    Heading 5
1.1.1.1.1.1 Heading 6
1.1.1.1.1.1.1        Heading 7
1.1.1.1.1.1.1.1Heading 8
1.1.1.1.1.1.1.1.1 Heading 9
Here is the script so far:
Academic Paper Setup
Copyright © 2012 macmadness86
Just kidding there is no copyright. Open Source rules!
You may use this code however you like. It would be nice
if you made reference to the original code when sharing.
THINGS TO DO:
find a fix for changing font color of headings without hardcoding it.
fix headings 4-9
(*<Properties to be set by the user*)
--number suffix corresponds to heading 1, heading 2, etc.
--NOTE: To change the coloring of headings, it must be hardcoded. must find a fix.
property fontName1 : "CMU Serif Roman"
property fontName2 : "CMU Serif Roman"
property fontName3 : "CMU Serif Roman"
property fontName4 : "CMU Serif Roman"
property fontName5 : "CMU Serif Roman"
property fontName6 : "CMU Serif Roman"
property fontName7 : "CMU Serif Roman"
property fontName8 : "CMU Serif Roman"
property fontName9 : "CMU Serif Roman"
property fontSize1 : 15
property fontSize2 : 14
property fontSize3 : 13
property fontSize4 : 12
property fontSize5 : 12
property fontSize6 : 12
property fontSize7 : 12
property fontSize8 : 12
property fontSize9 : 12
property boldTF : true
property italicTF : false
property highlightTF : false
(*Properties to be set by the user>*)
tell application "Microsoft Word"
    tell active document
        (*<normal code BLOCK*)
        set name of font object of Word style style normal to "CMU Serif Roman"
        set font size of font object of Word style style normal to 12
        set bold of font object of Word style style normal to false
        set italic of font object of Word style style normal to false
        set color index of font object of Word style style normal to black
        (*normal code BLOCK>*)
        (*<heading 1 code BLOCK*)
        set name of font object of Word style style heading1 to fontName1
        set font size of font object of Word style style heading1 to fontSize1
        set bold of font object of Word style style heading1 to boldTF
        set italic of font object of Word style style heading1 to italicTF
        set color index of font object of Word style style heading1 to black
        --set paragraph format left indent of paragraph format of Word style style heading1 to (centimeters to points centimeters 0) --indent sections relative to margin
        --set tab stop position of tab stop of Word style style heading1 to (centimeters to points centimeters 1)
        --set tab hanging indent of paragraph format of Word style style heading1 to count 1
        (*heading 1 code BLOCK>*)
        (*<heading 2 code BLOCK*)
        set name of font object of Word style style heading2 to fontName2
        set font size of font object of Word style style heading2 to fontSize2
        set bold of font object of Word style style heading2 to boldTF
        set italic of font object of Word style style heading2 to italicTF
        set color index of font object of Word style style heading2 to black
        (*heading 2 code BLOCK>*)
        (*<heading 3 code BLOCK*)
        set name of font object of Word style style heading3 to fontName3
        set font size of font object of Word style style heading3 to fontSize3
        set bold of font object of Word style style heading3 to boldTF
        set italic of font object of Word style style heading3 to italicTF
        set color index of font object of Word style style heading3 to black
        (*heading 3 code BLOCK>*)
        (*<heading 4 code BLOCK*)
        set name of font object of Word style style heading4 to fontName4
        set font size of font object of Word style style heading4 to fontSize4
        set bold of font object of Word style style heading4 to boldTF
        set italic of font object of Word style style heading4 to italicTF
        set color index of font object of Word style style heading4 to black
        (*heading 4 code BLOCK>*)
        (*<heading 5 code BLOCK*)
        set name of font object of Word style style heading5 to fontName5
        set font size of font object of Word style style heading5 to fontSize5
        set bold of font object of Word style style heading5 to boldTF
        set italic of font object of Word style style heading5 to italicTF
        set color index of font object of Word style style heading5 to black
        (*heading 5 code BLOCK>*)
        (*<heading 6 code BLOCK*)
        set name of font object of Word style style heading6 to fontName6
        set font size of font object of Word style style heading6 to fontSize6
        set bold of font object of Word style style heading6 to boldTF
        set italic of font object of Word style style heading6 to italicTF
        set color index of font object of Word style style heading6 to black
        (*heading 6 code BLOCK>*)
        (*<heading 7 code BLOCK*)
        set name of font object of Word style style heading7 to fontName7
        set font size of font object of Word style style heading7 to fontSize7
        set bold of font object of Word style style heading7 to boldTF
        set italic of font object of Word style style heading7 to italicTF
        set color index of font object of Word style style heading7 to black
        (*heading 7 code BLOCK>*)
        (*<heading 8 code BLOCK*)
        set name of font object of Word style style heading8 to fontName8
        set font size of font object of Word style style heading8 to fontSize8
        set bold of font object of Word style style heading8 to boldTF
        set italic of font object of Word style style heading8 to italicTF
        set color index of font object of Word style style heading8 to black
        (*heading 8 code BLOCK>*)
        (*<heading 9 code BLOCK*)
        set name of font object of Word style style heading9 to fontName9
        set font size of font object of Word style style heading9 to fontSize9
        set bold of font object of Word style style heading9 to boldTF
        set italic of font object of Word style style heading9 to italicTF
        set color index of font object of Word style style heading9 to black
        (*heading 9 code BLOCK>*)
    end tell
    (*<apply numbering to the sections code BLOCK*)
    set selFind to find object of selection --selects text of execute find command
    clear formatting selFind --reset selFind just to make sure
    set style of selFind to style heading1 --set style we are looking for
    execute find selFind find text "" wrap find find continue with find format and match forward
    if found of selFind is true then
        --display dialog (get content of text object of selection) --for debugging only
        (*<code BLOCK word__set paragraph style*)
        --I apply the formatting to the previously found text
        set myLT to list template 5 of list gallery 3 of active document
        apply list format template (list format of text object of selection) ¬
            list template myLT
    end if
    (*Apply numbering to the sections code BLOCK>*)
end tell

I figured it out . Just in case anyone else wants to know the script is below:
tell application "Microsoft Word"
    set myTable to table 1 of selection
    convert to text myTable separator separate by tabs
end tell

Similar Messages

  • How can I use microsoft word, power point and those apps in my new iMac ? i bought this iMac yesterday so am new on tho and i would like to know

    how can I use microsoft word, power point and those apps in my new iMac ? i bought this iMac yesterday so am new on tho and i would like to know

    If you absolutely must have the Microsoft applications, you can purchase and download them from http://microsoft.com/mac.
    Free software suites LibreOffice and OpenOffice offer similar functionality (word processing and spreadsheets).
    Or you could do worse than look at Apple's Pages, Numbers and Keynote, which should already be installed in your Mac and can export to Microsoft formats if need be.
    Matt

  • How can I open Microsoft Word files on my iMac?

    How can I open Microsoft Word files on my iMac?

    You can even use the Pages app that is installed on your computer. Finally you can buy a license of Office for Mac and have Word, Excel, PowerPoint and if you want Outlook too.

  • How can I get Microsoft Word in my MacBook Pro?

    How can I get Microsoft Word on my MacBook Pro? I need it to submit work to my teachers.

    Buy Office 2011 for OS X. Or if you don't want to spend any money you can use Libre Office.

  • How can i download microsoft word

    how can i download microsoft word into my macbook air

    ... or here (if you are in the U.S.):
    http://www.microsoftstore.com/store?SiteID=msusa&Locale=en_US&Action=DisplayProd uctSearchResultsPage&result=&keywords=office+compare
    Kappy's link above now goes to Office 365, the subscription based verion of Office.  Indeed that is newer than Office for Mac 2011, which is offered on the link I provided above.  But Microsoft still sells either version.  They are quite different in that you would own Office for Mac 2011, while Office 365 is subscription based, and can be used on more than one machine.
    Sorry, never mind the above.  Kappy's link provides both options.  Sorry!
    Message was edited by: sberman

  • Just found out that I can't run microsoft word or adobe photo shop with Mavericks, any way to solve this?

    Just found out that I can't run microsoft word or adobe photo shop with Mavericks, is there a way to make this work?

    You must be using very old versions (Office 2004 or older, Photoshop CS2 or older).
    Upgrade to newer, or current versions.

  • How can i use microsoft word on ipad 2

    how can i use the microsoft application on my ipad 2?

    The Pages app is also compatible with MS Word. Unlike some of the others mentioned, the document is actually stored on the iPad as opposed to 'the clouds'. Again, most of those mentioned are cut down versions of MS Word.
    Stand back and look at this constructively; do you need to regularly access to the document from more than one computer/device without the need to keep amending your document on your computer and sending it to your iPad? If so, Documente to Go etc may be the best choice.

  • How can I convert Microsoft Word 2004 to Microsoft Word 2011? About 50% of the time Word 2011 won't open Word 2004.

    How can I convert a Microsoft Word 2004 file to Microsoft Word 2011?  Most of the time the prompt says that the old Word is not supported anymore.

    Go to the Microsoft web site and download it.
    http://www.microsoftstore.com/store/msusa/en_US/list/ThemeID.33363200/categoryID .62686000?tid=s6YOr2uG5_dc&cid=5250&pcrid=22408403093&WT.srch=1&WT.mc_id=pointit sem_Microsoft+US_google_5+-+OMac+2011&WT.source=google&WT.medium=cpc
    Microsoft Word 2004 will not run on OSX 7.5 or later.  You might as well delete it.
    Ciao.

  • How can Tiger open Microsoft Word documents sent by e-mail?

    I recently upgraded to Tiger and use Appleworks 6, which is unable to read the Microsoft Word documents I frequently receive by e-mail. Is there any way I could read such documents, or should I get Microsoft Word? If so, which number/level would you advise? (I'm happy with Appleworks.)

    Do the problematic Word attachments end in ".doc" or in ".docx"?
    Neither AppleWorks 6 nor TextEdit will handle Microsoft's marketing-driven "improved" file format used in Mac Office 2008 / Windows Office 2007 (which is almost-but-not-really based on XML). There's a backwards-compatible option in those versions of Word to "Save As" Word 97 -2004 format (.doc). The practical solution where I work is to track down anyone sending .docx and threaten them with grievous bodily harm unless they resend as .doc and swear to never use .docx again.
    Microsoft has a converter that (allegedly) converts the new format to the vastly more common one, but that requires a previous copy of Office (Office 2004 or Office X).
    You can try the Mac OS X Dashboard widget DocX Converter instead.

  • How can i get microsoft word put on my computer

    I would like microsoft word to be put on my mac mini. Would i have to purchase this.

    You have to purchase it.
    http://www.microsoft.com/mac

  • How can I select an item from a list component with a seperate button

    This is a repost, I decided it'd probably be better here than
    in the general discussion board. I will try to delete the other
    one.
    Hello Everyone,
    This is my first post here. I am trying to figure out how to
    select an item within a list component with a button. This button
    is calling a function. I have searched for the past 3 hours online
    and I can't find anything about it. I thought perhaps I could set
    the selectedItem parameter, but that is read only, and I believe it
    returns an object reference rather than something like a number so
    even if i could set it, it would be pointless. I also found a get
    focus button, thought that may lead me somewhere, but I think that
    is for setting which component has focus currently as far as typing
    in and things like that. I am lost.
    Basically I am looking for a way to type this
    myList.setSelected(5); where 5 is the 5th item in the list.
    Any help would be much appreciated.

    Never mind found it. It is the property called selectedIndex
    and it is writable

  • HT2448 How can we get Microsoft word on iPad

    Download licensed 'VM vare' and get it all in one

    I'd suggest waiting until Microsoft corporate makes an official announcement before reporting that, Joey. Such claims were made before by supposed "in the know" Microsoft employees and turned out to be totally false. All Microsoft is confirming now is that the Office Mobile apps, OneNote and Lync, will be supported on iOS and Android.
    Regards.

  • How can I customize the behaviour of clicking a link with the middle mouse button?

    I just upgraded to Firefox 24ESR as part of an update of CentOS 5 (RHEL5) and now middle clicking on a link opens the link in a tab and not in a new window (like it did with Firefox 17ESR). I want to restore the middle click on a link behaviour to what it was under Firefox 17ESR. I *hate* tabs and don't want them, ever.

    Hello,
    To fix this, please go to the Firefox Preferences panel, and make sure the ''Tabs'' > ''Open new windows in a new tab instead'' preference is not checked.
    Then, type "'''about:config'''" in your location bar. In the page that appears, please click the "I'll be careful" button. In the search bar at the top of the page, type "'''browser.tabs.opentabfor.middleclick'''." Set the preference that is shown to '''false''' by double-clicking it.
    Hope this helps!<br>
    - Josh

  • [AS] How can I move an object, specifically a Text Frame with Applescript?

    I'm converting some old Quark 8 scripts that we used to use for pagination over to Indesign and I'm stuck on how to move one of my elements.
    This is the WORKING script in Quark 8, which uses the "Origin" command.
                                                                                                        set origin of bounds of Ad_Box to {Position_Height, Position_Width}
    Is there a quick and easy way to do this in InDesign CS5? I've been searching Google and these forums and have had no luck.
    I played around with the Set geometric bounds function, but had no luck.
    Thanks!

    move Ad_Box to {Position_Height,Position_Width}

  • How can i open microsoft office word documents on my ipad 4 and edit it.

    How can i open microsoft office word documents on my ipad 4 and edit it. How to transfer my scaned documents on it

    There are a number of apps that are compatible with Office documents. Apple makes iOS versions of their own iWork apps (Pages, Keynote, Numbers) that are available free if you purchase a new iOS device and that can be purchased separately for older devices. There are also 3rd party combined suites that cost less than the separate Apple apps. Ones often recommended include Documents 2 Go,  Quickoffice and Office2 HD.
    If you can accept needing a network connection whenever you want to use the apps and have an Office 365 subscription, Microsoft has just released their Office Mobile app, though it has significant limitations. Or a server-based solution such as CloudOn might be an option for you.
    Regards.

Maybe you are looking for

  • When Teststand is expired, the java process communicating with Teststand engine is killed.

    We are using an evaluation version of Teststand for development. We are using Teststand API in C code to communicate with the Teststand engine and in turn the java process communicates with the C code. But if the Teststand is expired, the java proces

  • Problem: Multiple albums created

    I don't know if any of you are having the same issue, but I am noticing that multiple albums are being created in iTunes 7. For example, I have 10 songs that were all downloaded from the same album in iTunes.... They are all tagged correctly as the s

  • Custom Workflow Activity not showing in Plugin Registration

    Could anybody suggest what I am doing wrong here? I have created a Custom Workflow Activity using this sample Create a custom workflow activity. But this is not showing up as a plugin/activity type in Plugin Registration Tool. See image below: My sam

  • Detail tabular form based on two tables

    db11gxe , apex 4.0 , firefox 24 , hi all , i have a master detail form based on two tables , the detail form ofcourse based on one table , the problem is i want to include a column of another table into the tabular form , so i have changed the query

  • Multiple monitors, duplicate user interfaces

    Hey everybody, My application consists (as the title suggests) of a computer running 4 touchscreen monitors. Three of the monitors will be completely different, but the 4th will need to be a combination of the other 3. The 4th is bigger, so it will a