• 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: Passing MS Word object specs (Larry the O)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing MS Word object specs (Larry the O)


  • Subject: Re: Passing MS Word object specs (Larry the O)
  • From: Larry the O <email@hidden>
  • Date: Wed, 21 Mar 2007 11:12:28 -0700

Actually, this is a lot great information that will keep me busy digesting and testing for a couple of days!

Thanks, Kai, your help is very much appreciated.

Larry

On Mar 20, 2007, at 8:05 PM, kai wrote:


On 20 Mar 2007, at 17:48, Larry the O wrote:

(contritely) Thanks, Kai, but my mail was actually me shooting myself in the foot by putting in wrong code. The actual handler has a whole bunch of other, unrelated messy (and ineffective) code that I didn't want to include, including the fact that the excerpt I sent is actually in a repeat loop that steps through a number of paragraphs.

Understood, Larry.

However, those commands ARE actually within a tell statement to MS Word that I failed to include. If it wasn't, I think I would have gotten a different, VERY puzzled error message from AppleScript!

Yes, you'd have probably got an error number -2753 [OSAUndefinedVariable]: "The variable wholeStoryText is not defined." However, as it stood, I couldn't see anything else obviously amiss about the code.


(Incidentally, I can see the potential for an error number -2753 relating to the variable 'errorList' since, at the moment, it's only defined in certain cases. That issue could be easily fixed by attributing its initial value before the if/then routines are entered.)

I will now post the whole handler as it currently exists. It's purpose is to try and suss out whether a Word document received from a contractor conforms to our desired structure and, if not, to fix it. However, as I have noted, it is a first and very flawed attempt; I am currently contemplating either a more efficient approach, or whether it is even really possible to anticipate all the ways our contractors could goof it up. However, for the sake of getting help, here it is:

Again, there's nothing in the new code that suggests, to me at least, an obvious cause of the particular error that you're getting. If a missing value is somehow attributed to the variable 'wholeStoryText', then the first manifestation of the problem would certainly occur during an attempt to evaluate its first paragraph - resulting in an error number -1728 [errAENoSuchObject]: "Can't get paragraph 1 of missing value." (which is evidently what you're experiencing).


If there had been a failure to successfully attribute a value to the variable 'wholeStory', then I'd have expected an error similar to those above, but occurring earlier - and accompanied by a slightly different message, such as:

error number -1728: "Can't get content of missing value."

or:

error number -2753: "The variable wholeStory is not defined."

However, I'm still inclined to suspect the operation that defines the variable 'wholeStory'. If (for some reason) that was only partially successful, so that the range it defined represented a null reference (text range id «data iWrg0000000000000000»), that could cause the type of error you're seeing. To simulate this, try something like:

----------------

tell application "Microsoft Word"
	set wholeStory to create range active document
	set wholeStoryText to content of wholeStory
	try
		set paraTest to paragraph 1 of wholeStoryText
	on error msg number num
		set paraTest to msg & " (" & num & ")"
	end try
end tell

{wholeStory:wholeStory, wholeStoryText:wholeStoryText, paraTest:paraTest}

----------------

--> {wholeStory:text range id «data iWrg0000000000000000» of active document of application "Microsoft Word", wholeStoryText:missing value, paraTest:"Can't get paragraph 1 of missing value. (-1728)"}

----------------

This is, of course, pure speculation. What's not clear is why the behaviour should occur in the first place - since I can't replicate it here using your code. So I can only suggest exploring it further with questions like: Does the error occur every time? Does it occur on a distilled version of the script (but still using a 'getStoryParts' handler)? What happens if you comment out the statements that call the other handlers? Does the insertion of delays between handler calls make any difference? If your file sizes are large, do smaller ones work any better? What *is* the value of the variable 'wholeStory' when the code fails? etc...

Sorry I can't suggest anything more helpful than a few further questions, but I hope they might contain a clue as to where to start looking for possible answers...

:-)

---
kai


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


This email sent to email@hidden

_______________________________________________ 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: 
 >Passing MS Word object specs (Larry the O) (From: Larry the O <email@hidden>)
 >Re: Passing MS Word object specs (Larry the O) (From: kai <email@hidden>)

  • Prev by Date: [ANN] SmartActivate.osax, HelpBook.osax and so on
  • Next by Date: Launch remote script
  • Previous by thread: Re: Passing MS Word object specs (Larry the O)
  • Next by thread: OS9 vintage script-error reading txt file using InDesign 2.0
  • Index(es):
    • Date
    • Thread