Re: Getting Error "Microsoft Word got an error. Connection is invalid"
Re: Getting Error "Microsoft Word got an error. Connection is invalid"
- Subject: Re: Getting Error "Microsoft Word got an error. Connection is invalid"
- From: Geoff Graham <email@hidden>
- Date: Fri, 21 May 2010 09:40:50 -0400
Well, I think I've told everything I know (which isn't much :). Word (really I script Excel and not Word, but they are similar) is busy doing something when it gets your applescript command, and responds with that generic "Connection is Invalid." It seems that many apps will queue an applescript command if there is something presently going on; I think you get a 30 second timeout window by default; and this spoils us to some degree. Word and Excel seem to be coded to reply immediately, apparently with that error if it's not possible to execute the command at that instant.
Scott had suggested that Word had crashed on you, and that certainly counts as Word being busy and one way you will see this error. I see it often in Excel, and I've been able to work around it by padding my commands with delay 2 and delay 8 and such. I've also had to rearrange blocks of code in scripts (mostly formatting Excel reports, inserting subtotals, etc.) to work around this. My main script I've had to split in two; saving the doc, quitting Excel, reopening and finishing the formatting. I guess that cleared some memory or something, but was one way I worked around these issues.
Just so you know; it's not just you; MS products are often difficult apps to use applescript with.
Geoff
On May 21, 2010, at 6:47 AM, SHIVANK AGGARWAL, Noida wrote:
> Hi Geoff,
>
> I am still facing these issues sometimes . Can you please let me know what else can be done in this case.
>
> Thanks,
> Shivank
_______________________________________________
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