Impossibly Slow Load-Time for Cross-Reference Window Items

P

Paul Berkowitz

Yes, I've written a solution using AppleScript. It turns out that when
you use AppleScript to ask for that same list of all the headings, the
reply comes back instantly, unlike when you do it from within Word's own
interface. m.

What is it, Matt?

--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
D

Daiya Mitchell

The OP is perfectly right, the built-in Word interface to
the list of headings is unconscionably slow and instantly becomes
useless as your document gets bigger, but if you get the same list using
AppleScript:

set L to get cross reference items active document reference type
reference type heading

...the answer comes back instantly. So the problem is obviously in

Word's interface, not in its underlying machinery; the MacBU folks are
doing something wrong when they populate the interface. Therefore I use
AppleScript and provide my own interface. Presumably you could do
exactly the same thing in VBA. m.

Yes, I think that's what John McGhie's macro does. It starts that way,
anyhow. Can I ask, out of curiosity, how you structured the interface in
Applescript? Textual description, not code. I personally thought the Vito
/fizzicist solution of generating all cross-refs at once and cut-n-pasting
them was pretty elegant, despite his disclaimer, but am wondering how you
chose to do it.
 
C

Clive Huggan

Inline comments.

Hi Clive:

Just a belated note of thanks in follow-up to your kindly having taken
the time to send a reply to my original post. As you might know by
now, I managed to concoct a somewhat primitive workaround that
nevertheless got the job done, as described in a separate post to John
McGhie. Practicality won out over sophistication; what my workaround
lacks in elegance is makes up for in simplicity, ease of use, and
SPEED. I need only adapt it to John's suggestion for automation (or
some suitably tweaked variant thereof) to have the best of all
currently available worlds.

Yes, this has been a very interesting discussion. Thank you for your
comprehensive descriptions, feedback and commentary; and I hope this is not
the last significant contribution you'll make to this newsgroup!
As for the best of all theoretically possible worlds...ah,
well...that's another matter entirely, but if I were to dream one up,
it would have something to do with a clear and unambiguous commitment
from Microsoft to fix the doggone bug, and then actually DO it. Based


To my admittedly uninformed ears, that sounds like a Word 2007 sort of
a fix.
Well yes ... ... ... Ommm ...

I probably should have been a bit more explict there. We are not using
the Master Document "feature" in Word -- and I'm certain that it's
because of our predilection for avoiding the very same Demonic
Complexities to which you have referred...

Rather, the term "master document" as I am using refers to the
document ownership system we're using in this project. All documents
are "owned" by someone who is responsible for completion, for
compliance with specifications, for adherence to schedule &
budget...etc. Some documents are humongous...they have an owner, but
it's not realistic for one person to be on the hook for the entire
thing, so it's divided into "sections", each of which has an owner.
The sections are merged into the big, fat, humongous, giant "master
document" as it nears completion, but it's really nothing more than a
series of document merges.

I'm with you; I do that for long documents that I have to distribute to many
colleagues.

It's a pity Msft used the terms "master document" and "template" -- it
leaves precious few other terms to use.
Hmmm... sounds like maybe you're not so confident after all,

Umm, no ...
but what
do I know? You're undoubtedly plugged in to information resources that
I don't have on that subject.

I'm not, mainly because I'm not involved in beta testing. I used to be in
the Royal Australian Air Force, which has the motto "Never volunteer".
Since my resources are accurately
characterized by the number ZERO, the only thing I have to go on is
what shows up in the service pack releases or on the next distribution
CD. Don't get me wrong -- I'd love to receive a direct communication
from someone at Microsoft assuring me that the bug is fixin' to be
relieved of its existence,
Ho-ho-ho!!!

but until the fix actually shows up...

...let's just say that I grok the wisdom in your reference to

meditation. ;-)

Om,

Vito


Cheers,

Clive
Canberra, Australia
 
J

John McGhie

Hi Matt:

Yeah, it's not getting the list that takes the time. It's repaginating the
document twice, once to place the bookmark at the destination then again to
update the cross-references.

Fizzicist's idea of stacking all the cross-references together at the end of
the document is actually the idea that makes this whole thing work: by doing
that, he is retaining all of the cross-reference activity within the Word
Page Buffer so all the operations take place in memory at motherboard speed.

If you call that list from AppleScript, you are actually calling the same
entrypoint in the code as VBA does, and the list will come back, not
instantly, but within a second or so, depending on the size of the document.

Cheers

Yes, I've written a solution using AppleScript. It turns out that when
you use AppleScript to ask for that same list of all the headings, the
reply comes back instantly, unlike when you do it from within Word's own
interface. m.

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Consultant Technical Writer
Sydney, Australia +61 4 1209 1410
 
J

John McGhie

Hi Vito:

Many thanks for your help on this. I just got through telling Daiya that it
was YOUR idea, of stacking all the cross-references at the end of the
document, that enabled me to find a code solution to this problem.

Predictably, there is a certain amount of indignation over the fact
that a great deal of effort is being expended by a number of users in
the development of a workaround, yet a similar level of concern and
remedial effort apparently is not forthcoming from Microsoft.

Well, ummm... You have to put this into perspective.
have an effect on it. I'm in hypothesizing mode here, so take it with
a grain of salt, but I'm inferring that there is a much bigger problem
with MacWord than the reload bug itself. I'm inferring that the reload
bug is a consequence of something else that is broken in the porting
from WinWord to MacWord, and it's such a formidable task to repair it
or redesign it that MBU is balking at the commitment of resources that
effort would require.

You're "close" :)

This issue did not get "broken" in the porting from WinWord, the problem
exists in the WinWord code too. The reason you do not see WinWord users
screaming about it (much, except for ME...) is that on the PC Word can
easily help itself to much more CPU time and memory. It solves the problem
very quickly on documents shorter than 2,000 pages. But it does it by
throwing horsepower at it.

In Word 2003, they made a change to the code to help themselves to even more
memory and horsepower. This enables them to run very much faster when doing
stuff like this. But even a low-end PC has power to burn, so they can get
away with it. When Mac BU took a look at how they did it, they figured out
that the power/speed/memory penalty would make us rather unwelcome citizens
on the Mac platform.

There is a more efficient way of doing it, but it's a major (read:
expensive!!) rewrite to get there. And the problem was survivable right up
to when they switched to ATSUI from QuickDraw. Now, we have full Unicode
compatibility, but ATSUI is a fearful CPU hog and we start slowing down in
other areas.

It helps to remember that the Microsoft Word code base is older than about
half of its users. There's 300 million lines of it, give or take a few.
And it has been hacked and patched and chopped so often that changes have to
be made very carefully, with a lot of research and planning, otherwise they
create more problems than they cure.

All of which adds up to "cost". The other parameter is, of course, "sales".
If we sold 300 million copies every time we changed the colour of the
packaging, like PC Word does, we could afford to hire 1,000 programmers to
make major changes, just like they can. As it is, we are a bit dependent on
what we can con the PC Office developers into doing for us :)

So there's some horse-trading going on :) THEY want our Project Centre and
our Notebook View. And we want a few things from them... And if you think
that's not really the way things happen in large corporations, you've never
worked for one :)

We should also consider that there is a very fixed limit to how much the
Macintosh Business Unit can afford to spend on Mac Office 2006, and one or
two other things we want that are a rather higher priority than this one.

You gather 1,000 users of Mac Word together and ask them how many know how
to put in even ONE cross-reference, let alone use it often enough to run
into this problem. Chances are, it will be less than two!

But ask them how many would like printing that works first time, every time.
How many would like the ability to share a Word document containing ANY kind
of content with their PC-using workmates? How many would like proper
right-to-left language support?

You get the picture now? It's not a bug: it's a design that is no longer
adequate for the job it's trying to do. And it's on the list to be fixed.
Along with everything else. So here's the 64-thousand-dollar question that
will get this issue moved up the list: how many more copies of Mac Word
would they sell if they spent the money to fix this one?

If you can get a number bigger than 1,000 world-wide (and prove it...) I
know a few guys at the Mac BU who would like to hear from you :) A
thousand extra sales would give Microsoft maybe $10,000 extra dollars, or
which the Mac BU may get to spend half on development. Enough to hire one
developer for maybe two weeks. But this issue would probably take a
development team of 6 or 12 maybe three months. It may not happen "soon"
:)

In the meantime, how may we help you further? :)

Cheers

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Consultant Technical Writer
Sydney, Australia +61 4 1209 1410
 
S

Stan Hadley

Although it looks like you might have soved your problem, I'd like to
mention that I set up a macro that I use to insert a cross reference. It
gives me a dialog box whether I want a Figure or Table, then a dialog box
asking for the number. I use ctl-shift-X for the macro. I'm sure it could be
snazzed up more, but it works for me.

Sub InsertXRef()
'
' InsertXRef Macro
' Macro recorded 2/18/03 by Stanton Hadley
'
xobject = InputBox(prompt:="What type of reference? (Table or Figure)",
Title:="Type ", Default:="Table")
If xobject = False Then Exit Sub
Xnumber = InputBox(prompt:="What number?", Title:="Number ", Default:=1)
If Xnumber = False Then Exit Sub
If xobject = "Table" Then
With Selection
.InsertCrossReference ReferenceType:=wdCaptionTable, _
ReferenceKind:=wdOnlyLabelAndNumber, ReferenceItem:=Xnumber,
InsertAsHyperLink:=True
End With
ElseIf xobject = "Figure" Then
With Selection
.InsertCrossReference ReferenceType:=wdCaptionFigure, _
ReferenceKind:=wdOnlyLabelAndNumber, ReferenceItem:=Xnumber,
InsertAsHyperLink:=True
End With
End If
End Sub

Hope this helps

Stan Hadley
 
M

matt neuburg

John McGhie said:
Fizzicist's idea of stacking all the cross-references together at the end of
the document is actually the idea that makes this whole thing work: by doing
that, he is retaining all of the cross-reference activity within the Word
Page Buffer so all the operations take place in memory at motherboard speed.

I'm not sure what that's all about. Anyhow it wouldn't be practical for
me. I don't want to stack anything anywhere; I want to use the document
as it actually is, and put a cross-reference where I want it, right now.
That's what my solution lets me do.
If you call that list from AppleScript, you are actually calling the same
entrypoint in the code as VBA does, and the list will come back, not
instantly, but within a second or so, depending on the size of the document.

Right - the first time it's a second or so. The second time it's even
faster. And a second or so is better than a minute or so, which is what
it takes in the Insert Cross-Reference dialog in Word. m.

PS Daiya asked what my interface looks like. It looks however I want it
to look. I can make it look like it does in Word, I can make it look
like an outline, I can make it look like it does in FrameMaker (list all
Heading 1s, list all Heading 2s, etc.). Basically interface is
irrelevant; it's just trivial icing on the cake. The important thing is
that fetching (and displaying) the list of headings is very fast if you
use AppleScript or VBA.
 
P

Phillip M. Jones, CE.T.

John said:
Hi Vito:

Many thanks for your help on this. I just got through telling Daiya that it
was YOUR idea, of stacking all the cross-references at the end of the
document, that enabled me to find a code solution to this problem.




Well, ummm... You have to put this into perspective.




You're "close" :)

This issue did not get "broken" in the porting from WinWord, the problem
exists in the WinWord code too. The reason you do not see WinWord users
screaming about it (much, except for ME...) is that on the PC Word can
easily help itself to much more CPU time and memory. It solves the problem
very quickly on documents shorter than 2,000 pages. But it does it by
throwing horsepower at it.

In Word 2003, they made a change to the code to help themselves to even more
memory and horsepower. This enables them to run very much faster when doing
stuff like this. But even a low-end PC has power to burn, so they can get
away with it. When Mac BU took a look at how they did it, they figured out
that the power/speed/memory penalty would make us rather unwelcome citizens
on the Mac platform.

There is a more efficient way of doing it, but it's a major (read:
expensive!!) rewrite to get there. And the problem was survivable right up
to when they switched to ATSUI from QuickDraw. Now, we have full Unicode
compatibility, but ATSUI is a fearful CPU hog and we start slowing down in
other areas.

It helps to remember that the Microsoft Word code base is older than about
half of its users. There's 300 million lines of it, give or take a few.
And it has been hacked and patched and chopped so often that changes have to
be made very carefully, with a lot of research and planning, otherwise they
create more problems than they cure.

All of which adds up to "cost". The other parameter is, of course, "sales".
If we sold 300 million copies every time we changed the colour of the
packaging, like PC Word does, we could afford to hire 1,000 programmers to
make major changes, just like they can. As it is, we are a bit dependent on
what we can con the PC Office developers into doing for us :)

So there's some horse-trading going on :) THEY want our Project Centre and
our Notebook View. And we want a few things from them... And if you think
that's not really the way things happen in large corporations, you've never
worked for one :)

We should also consider that there is a very fixed limit to how much the
Macintosh Business Unit can afford to spend on Mac Office 2006, and one or
two other things we want that are a rather higher priority than this one.

You gather 1,000 users of Mac Word together and ask them how many know how
to put in even ONE cross-reference, let alone use it often enough to run
into this problem. Chances are, it will be less than two!

But ask them how many would like printing that works first time, every time.
How many would like the ability to share a Word document containing ANY kind
of content with their PC-using workmates? How many would like proper
right-to-left language support?

You get the picture now? It's not a bug: it's a design that is no longer
adequate for the job it's trying to do. And it's on the list to be fixed.
Along with everything else. So here's the 64-thousand-dollar question that
will get this issue moved up the list: how many more copies of Mac Word
would they sell if they spent the money to fix this one?

If you can get a number bigger than 1,000 world-wide (and prove it...) I
know a few guys at the Mac BU who would like to hear from you :) A
thousand extra sales would give Microsoft maybe $10,000 extra dollars, or
which the Mac BU may get to spend half on development. Enough to hire one
developer for maybe two weeks. But this issue would probably take a
development team of 6 or 12 maybe three months. It may not happen "soon"
:)

In the meantime, how may we help you further? :)

Cheers
Come on now:
If you can get a number bigger than 1,000 world-wide (and prove it...)
I know a few guys at the Mac BU who would like to hear from you :) A
thousand extra sales would give Microsoft maybe $10,000 extra dollars,
or which the Mac BU may get to spend half on development.

Surely you josh I paid $250 or more for the Upgrade and if I had paid
full price $500-600. I also bought the upgrde direct from MS. soe excpet
for shipping and Taxes it was pure profit for MS.

You mean to tell us when a Packge Sell's for $500.00 and you paid
officemax say $50.00 per each copy sold you clear $10 measly bucks.
Sounds like to me. Mr Gates is getting half to put in his billfold.

I mean this sounds so logical instead of diving up based on sales why
not combine the sales of all products and base the take on that. Then
say if Mac sales is 10% of the take give the MacBU 10% of the Money form
entire sales.

Seems like Mr Gates is secretly wishing the Mac would go away, by
leaving us with a substandard product.

Plus I thought that code for code the Mac version is identical except
for interface issues (how the Mac or PC talks to the Video Monitor or
printer or how the fonts are drawn based on 72dpi for Mac and 96 dpi for
PC).

And why does MS keep patching and patching code that's 30 years old be
it for Mac PC, Linux, or UNIX? Seems to me their is a point long past of
deminishing returns. Its ounds as if all that much is not spent on R&D.

Maybe that's why Gates is the richest person in the US if not (more
likely) the world. Is he skrimps on R&D to make his Billfold look bigger.
--
---------------------------------------------------------------------------
Phillip M. Jones, CET |MEMBER:VPEA (LIFE) ETA-I, NESDA,ISCET, Sterling
616 Liberty Street |Who's Who. PHONE:276-632-5045, FAX:276-632-0868
Martinsville Va 24112-1809 |[email protected], ICQ11269732, AIM pjonescet
---------------------------------------------------------------------------

If it's "fixed", don't "break it"!

mailto:p[email protected]

<http://www.kimbanet.com/~pjones/default.htm>
<http://home.kimbanet.com/~pjones/birthday/index.htm>
<http://vpea.exis.net>
 
F

fizzicist

Hi Matt:

I just found your post to this thread...

(e-mail address removed) (matt neuburg) wrote in message
(snip)
Yes, I've written a solution using AppleScript. It turns out that when
you use AppleScript to ask for that same list of all the headings, the
reply comes back instantly, unlike when you do it from within Word's own
interface. m.

I'm very interested in your solution using AppleScript. Can I find it
in your O'Reilly book on AppleScript? The book looks HOT. I checked it
out on your website and it appears to be THE resource to have for
learning AppleScript. I immediately ordered a copy.

If you have the time, I would very much appreciate your posting your
solution here, or providing a link to it... that is, unless you've
already done so. I saw the following item in your subsequent post:

(snip)
...The OP is perfectly right, the built-in Word interface to
the list of headings is unconscionably slow and instantly becomes
useless as your document gets bigger, but if you get the same list using
AppleScript:

set L to get cross reference items active document reference type
reference type heading

...the answer comes back instantly.
(snip)

Is that it?

Sorry for the newbie-level question, but one has to start somewhere. I
would characterize my knowledge of AppleScript as somewhere between
"non-existent" and "primordial", but this is as good a time to learn
as any...especially if it can provide an easier implementation of a
workaround for this bug. I particularly like the idea of using
AppleScript because the time I spend learning it will be leveraged
across the entire OS X user experience. If my seminal understanding of
its capabilities is correct, I should be able to apply it universally
to just about anything I want to do on the Mac. That is a worthwhile
investment.

Thanks!

Vito

p.s. Your description "unconscionably slow" precisely captures the
essence of my realization that such a bug could be allowed to persist
for so long. :-(
 
D

Daiya Mitchell

I'm very interested in your solution using AppleScript. Can I find it
in your O'Reilly book on AppleScript? The book looks HOT. I checked it
out on your website and it appears to be THE resource to have for
learning AppleScript. I immediately ordered a copy.
OT side note of chagrin: I jumped my computer through eighty million hoops,
ruining something in the process, in an effort to get free online access to
Matt's book, and then realized online access meant I would have to *read* it
online (as opposed to downloading it), so I'll probably have to go buy it
anyhow....
 
P

Paul Berkowitz

The way to learn to script Word 2004 using AppleScript is quite simple;
learn to script it with Visual Basic, and translate. The new AppleScript
model is essentially a direct translation of VBA; that is what's so
ingenious about it. m.

Matt, that's really not for everybody. Only you and I seem to have done
that. Most people who learn Word VBA and don't already know AppleScript
don't then go to the trouble to translate it into AppleScript - they just
use VBA. (Many people other than you who know other programming languages
seem to have a resistance to learning AppleScript.) And most AppleScripters
have a resistance to learning VBA. I was the only one who seemed to want to
learn enough of it to make use of the VBA Help for "translating" into
AppleScript. You don't seem to be aware that there's a really big resistance
to VBA - not _totally_ due to anti-Microsoft bias among traditional
scripters. Some of it is due to people who like AppleScript not liking the
"dot language" of VBA.

Anyway, fizzicist is correct that it would make good sense to learn
AppleScript _in preference to VBA_ since he will be able to use it for much
else on the Mac. To learn the AppleScript language, he can do no better than
than your book, which is absolutely and truly the definitive guide. (There
are some new books for beginners in the works, but they're not out yet.
Yours is the only good book available. It might be a bit hard-going for some
beginners, perhaps, but not for fizzicist . He'll do fine.) To learn Word
2004 application scripting, after learning the basics of AppleScript
language and feeling ready to "plunge in", he should get the Word
AppleScript Reference from MacTopia website. Yes, there are a few errors in
the "Using Word AppleScript" front section. Fortunately, those are being
corrected - some of them partly thanks to your descriptions of them here.
(The errors, such as they are, are precisely the same ones you'd make
yourself translating from VBA, which is what the authors did in fact.) You
could script Word for months without even running into them, too.

You discount the difficulty some people have with multiple programming
languages, Matt, because you're so adept. For most AppleScripters, and
intermediate level scripters, the Reference is a real boon precisely because
it does the translation from VBA for you and provides examples. It's
precisely what new scripters to Word need. We can get them over the humps
and the few errors and imprecisions here. Because the Reference is a
download, it will be corrected pretty quickly - there's no need to wait for
a major upgrade to Word.

--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
E

Elliott Roper

he should get the Word
AppleScript Reference from MacTopia website.
<snip>
That would be useful. After 10 minutes crawling all over Mactopia, I
still can't find it. Could you give us a url?
 
J

JE McGimpsey

Phillip M. Jones said:
Surely you josh I paid $250 or more for the Upgrade and if I had paid
full price $500-600. I also bought the upgrde direct from MS. soe excpet
for shipping and Taxes it was pure profit for MS.

You mean to tell us when a Packge Sell's for $500.00 and you paid
officemax say $50.00 per each copy sold you clear $10 measly bucks.
Sounds like to me. Mr Gates is getting half to put in his billfold.

I don't know the numbers, and I doubt Mr. McGhie does either, but the
principal holds - there's a critical mass of additional sales that is
required to justify any particular fix. Even at $100 per copy (and that
seems extremely high to me), you don't get much for $100K - maybe two
programmers for a few months.

Sure Mr. Gates gets a buck or two for his billfold, but so do millions
of other shareholders who Mr. Gates is responsible to, and don't expect
him to use their money for philanthropy to Mac users...

I mean this sounds so logical instead of diving up based on sales why
not combine the sales of all products and base the take on that. Then
say if Mac sales is 10% of the take give the MacBU 10% of the Money form
entire sales.

Whether that's logical or not (and it doesn't seem so to me), it's not
the way any business that I know of does it. Especially if you're
talking about entire corporate sales - MS provides Office, Operating
systems, server systems, hundreds of PC applications, etc. Mac sales,
while profitable, are a pimple on the tail of the dog. I'd like it, but
I can't think of any sound reasoning that would justify giving 10% of
their investment dollars to MacBU.
Seems like Mr Gates is secretly wishing the Mac would go away, by
leaving us with a substandard product.

Mr. Gates doesn't have to secretly wish anything about Macs. MacBU is
profitable, and he'll (well, Mr. Ballmer will) be glad to keep MacBU
around as long as they are so. But MS is not going to shortchange its
shareholders by *subsidizing* the Mac platform unless it has a business
case to do so.

Plus I thought that code for code the Mac version is identical except
for interface issues (how the Mac or PC talks to the Video Monitor or
printer or how the fonts are drawn based on 72dpi for Mac and 96 dpi for
PC).

I think you're thinking of "core code" which went out with the disaster
that was Office 4.2. Much of the code is identical - the underlying
engines that drive the apps. But a large and increasing share of the
code is platform specific.
And why does MS keep patching and patching code that's 30 years old be
it for Mac PC, Linux, or UNIX? Seems to me their is a point long past of
deminishing returns. Its ounds as if all that much is not spent on R&D.

Do you have any idea what it would take to rewrite millions of lines of
code? Not even the Win Office team has that much leeway. It's like
asking why you don't tear down and rebuild your house when you add a
bathroom, just because copper piping is better than galvanized and the
electrical code changed.

Maybe that's why Gates is the richest person in the US if not (more
likely) the world. Is he skrimps on R&D to make his Billfold look bigger.

Nah - the company makes business decisions. Sometimes they're right,
sometimes they're wrong, but the focus is on how to get a good return on
investment, not how to scrimp on R&D.

I hate appearing as an apologist for MS, but to generate conspiracy
theories vastly overestimates the importance of the Mac market to them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top