• 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: Word scripting?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Word scripting?


  • Subject: Re: Word scripting?
  • From: Paul Berkowitz <email@hidden>
  • Date: Mon, 24 Mar 2003 14:19:31 -0800

John,

All this stuff is self-referencing: first you insert text by 'set
selection', then you select text you've just inserted in the same unsaved
document. All that selection business usually works OK if _everything_ is
selection and no changes have been made.

Try writing a Word document by hand, with a few paragraphs. Save it.

Then open it by script and try setting the insertion point to a particular
spot, or, better, replacing a word or a sentence by script.

I'm not saying things never work. Sometimes they do, for a bit. Then it all
goes wrong, or you crash, or both.

--
Paul Berkowitz



> From: John Delacour <email@hidden>
> Date: Mon, 24 Mar 2003 20:44:33 +0000
> To: <email@hidden>
> Subject: Re: Word scripting?
>
> At 10:54 am -0800 24/3/03, Paul Berkowitz wrote:
>
>>> What was wrong with my solution, which uses the standard syntax for
>>> the text suite and requires no VB ?
>>>
>> Nothing. It should work every time with a new line, yes. But if you want to
>> move the insertion point from wherever it is to, say, somewhere in the 4th
>> paragraph, even the beginning of the 4th paragraph, it usually goes wrong,
>> sooner or later.
>
> I have no doubt that Word's behaviour may be bad in some respects --
> I never use it -- but in this respect it seems not do misbehave as
> you say. Can you give an example of what you mean?
>
>
> tell application "Microsoft Word"
> set bullet to ASCII character 165
> activate
> make document
> tell the front document
> repeat 8 times
> set the selection to "________" & return
> end repeat
> repeat 20 times
> set {x, y} to {random number from 1 to 8, random number from 1 to 8}
> select insertion point after character x of paragraph y
> set selection to bullet
> end repeat
> end tell
> end tell
>
> --JD
> _______________________________________________
> applescript-users mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/applescript-users
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Word scripting? (From: John Delacour <email@hidden>)

  • Prev by Date: Re: Word scripting?
  • Next by Date: Re: How to make a background applet ?
  • Previous by thread: Re: Word scripting?
  • Next by thread: Re: Word scripting?
  • Index(es):
    • Date
    • Thread