Hi I need some help finishing a script in word. (I need a loop)

 

The script finds text in word and make the found text italic:

 

 

set organism to "Brevibacterium ammoniagenes"

set FindWordsToReplace to organism as text

tell application "Microsoft Word"

          set GetTxt to find object of selection

          tell GetTxt

  clear formatting

                    set its content to FindWordsToReplace

                    tell its replacement

  clear formatting

                              set its content to FindWordsToReplace

                              tell its font object

                                        set italic to true

                                        set bold to false

                              end tell

                    end tell

  execute find wrap find find continue replace replace all with match forward and match whole word without match case

          end tell

end tell

 

text-indent: -41.6px; font-size: 12px; font-family: Verdana;">set organism to "Pichia membranaefaciens"

set FindWordsToReplace to organism as text

tell application "Microsoft Word"

          set GetTxt to find object of selection

          tell GetTxt

  clear formatting

                    set its content to FindWordsToReplace

                    tell its replacement

  clear formatting

                              set its content to FindWordsToReplace

                              tell its font object

                                        set italic to true

                                        set bold to false

                              end tell

                    end tell

  execute find wrap find find continue replace replace all with match forward and match whole word without match case

          end tell

end tell

 

This is how I have managed so far. But I would like to create a list of organisms that the applescript will go through, instead of having to insert the entire clunk of code for every organism I come acrose.

I hope somebody can help me with this.

 

BR


Please add your answer in the form below:


  • Applescript: find mulitple instances of a word in text file?
  • Creating a shortcut to auto format text, system wide.
  • Text won't wrap in email
  • Loop in AppleScript?
  • TS4040 how do I install Microsoft word back in docks on old Mac OSX running ...
  • Italic and bold formats lost in PPT export
  • Microsoft Word on a Mac?
  • Word formatting picture problem
  • Reformatting entire slides to match in Keynote
  • How to filter Outlook for Mac calendar events by category using AppleScrip ...