• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: changing uppercase/lowercase of MS word footnote text...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing uppercase/lowercase of MS word footnote text...


  • Subject: Re: changing uppercase/lowercase of MS word footnote text...
  • From: Paul Berkowitz <email@hidden>
  • Date: Sun, 23 Dec 2007 23:45:01 -0800
  • Thread-topic: changing uppercase/lowercase of MS word footnote text...

Title: Re: changing uppercase/lowercase of MS word footnote text...
On 12/23/07 8:00 PM, "Conor McDonough" <email@hidden> wrote:

I am trying to write a script that selects the first character of the text of a footnote in MS Word 2004 and changes it from lowercase to uppercase.

I had tried the following:

------------------------------------------
tell application "Microsoft Word"

set footnoteCount to count of footnotes in active document
if footnoteCount > 0 then
repeat with i from 1 to footnoteCount
set  uppercase of first character of content of text object of footnote i to true

end repeat
end
if

end tell
-----------------------------------
This gives me an error.  Any ideas what is  going wrong?
 

1) Well, you are using imaginary keywords, for a start. You seem to have invented a boolean 'uppercase' property for 'character'. Why did you do that? Instead of that, check the dictionary. You'll see that 'character' has a 'case' property, one of whose enumerations is 'upper case'. Use that.

2) Then, while you're there, check 'content' property of 'text range'. (That's what a 'text object' property of a footnote is - a text range.) You'll see, or can remind yourself, that 'content' is just basic 'Unicode text' - an AppleScript (not MS Word) class. 'Unicode text' characters don't have fancy Word properties such as 'case' - that's what Word's own 'character' class (a sort of expansion of the basic AppleScript 'character') has. You shouldn't have introduced 'content of' here. Just use the 'first character of text object' - drop 'content of'.

3) Finally, although you know that the 'footnotes' are elements of 'active document' in the first line, you forgot all about the document in your repeat loop. 'footnote i' has no meaning without 'footnote i of active document'. So:

tell application "Microsoft Word"
    set footnoteCount to count of footnotes in active document
   if footnoteCount > 0 then
       repeat with i from 1 to footnoteCount
           set case of first character of text object of footnote i of active document to upper case
       end repeat
   end if
end
tell

That works. (Actually, you don't need the if/end if block. If footnoteCount = 0, no harm is done, and nothing will error.)

--
Paul Berkowitz
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >changing uppercase/lowercase of MS word footnote text... (From: Conor McDonough <email@hidden>)

  • Prev by Date: Re: Scripting Print Orientation
  • Next by Date: Re: App's added to Dock or not
  • Previous by thread: changing uppercase/lowercase of MS word footnote text...
  • Next by thread: Re: changing uppercase/lowercase of MS word footnote text...
  • Index(es):
    • Date
    • Thread