Applescript Language Help

M

MC

The ways of Applescript are a complete mystery to me, but maybe someone
could kindly help me out :

I need a script that will:

1

Turn Track Changes OFF if it's ON

2

Change the language of the whole document to English (US)

3

Turn Track Changes ON

___

Also: Could you remind me how and where to install it... ?

Many thanks in advance.
 
M

MC

MC said:
The ways of Applescript are a complete mystery to me, but maybe someone
could kindly help me out :

I need a script that will:

1

Turn Track Changes OFF if it's ON

2

Change the language of the whole document to English (US)

3

Turn Track Changes ON

___

Also: Could you remind me how and where to install it... ?

Many thanks in advance.

No takers?

Too bad!
 
D

Daiya Mitchell

I got a little ways with it but was hoping an expert would come along.
But I want to figure out how to Select All anyhow. Be patient.
 
M

MC

Thanks!

Daiya Mitchell said:
I got a little ways with it but was hoping an expert would come along.
But I want to figure out how to Select All anyhow. Be patient.
 
M

MC

Daiya Mitchell said:
I got a little ways with it but was hoping an expert would come along.
But I want to figure out how to Select All anyhow. Be patient.

PS: This would have been 100% simple to do with a WordPerfect (for Mac)
macro. I'm guessing it would have been almost -- but not quite - as
simple with a Word macro.

Just reinforces the stupidity of disabling the macro function... (sigh).

BUT... is there any user-friendly -- some kind of shell -- that would
make Applescripts easier to implement?

Seems to me that such a thing -- that would record keystrokes and
commands the way macros could be recorded would be a welcome addition to
the OS or a useful third-party add-on.

Does it exist? If not, maybe some enterprising programmer could make
some bucks from it.
 
D

Daiya Mitchell

MC said:
PS: This would have been 100% simple to do with a WordPerfect (for Mac)
macro. I'm guessing it would have been almost -- but not quite - as
simple with a Word macro.

Word macro would have let you record it--but with both the macro and
AppleScript you run into the same issue: what do you mean by whole
document? Select All in Word doesn't really select all--just the main
text, but not the header/footer or endnotes/footnotes if there are any.
What do your documents look like? What do you do manually to do this?

Is is likely that changing the language of Normal style to English US
would serve your purpose?
BUT... is there any user-friendly -- some kind of shell -- that would
make Applescripts easier to implement?

Automator, theoretically. Unfortunately I didn't see anything in
Automator that would help here.
Seems to me that such a thing -- that would record keystrokes and
commands the way macros could be recorded would be a welcome addition to
the OS or a useful third-party add-on.

Does it exist? If not, maybe some enterprising programmer could make
some bucks from it.
Well, it's pretty difficult and time consuming to write. Existing
programs like QuicKeys and Keyboard Maestro might have recorder modes,
though. You could check them out.

By the way--you wish you hadn't upgraded, but you haven't gone back to
Word 2004? Why not?
 
M

MC

Daiya Mitchell said:
Word macro would have let you record it--but with both the macro and
AppleScript you run into the same issue: what do you mean by whole
document? Select All in Word doesn't really select all--just the main
text, but not the header/footer or endnotes/footnotes if there are any.
What do your documents look like? What do you do manually to do this?

Select All. header/footer, endnotes and footnotes don't arise with the
docs I'm working with.
Is is likely that changing the language of Normal style to English US
would serve your purpose?

No. Here's where the problem arises. I create a document in English
(US). I send them to a client who is on a PC using French Canadian.

When she sends back, any amendments and/or additions she makes give me a
document that is a mixture of both -- and spell check can't handle it --
even if she's writing in English, the program sees French Canadian
wherever she's changed something.

Now, we're both using Track Changes, and to change the language back to
English I have to Select All, go into Tools - Language -- but I don't
want Track Changes to note that because it marks the WHOLE document as
changed. One big vertical line from top to bottom.

So... the manual steps are exactly what I described as wanting in an
Applescript. Once or twice is no great hardship, but when I'm juggling
dozens of documents it gets tiresome and I want a way to automate it.
Automator, theoretically. Unfortunately I didn't see anything in
Automator that would help here.
Well, it's pretty difficult and time consuming to write. Existing
programs like QuicKeys and Keyboard Maestro might have recorder modes,
though. You could check them out.

I will.

Is one significantly better than the other?
By the way--you wish you hadn't upgraded, but you haven't gone back to
Word 2004? Why not?

I suppose I could. Just haven't gotten around to it.
 
S

Shawn Larson [MSFT]

MC,

Here is a quick AppleScript script I¹ve put together that I believe will
work for you:
tell application "Microsoft Word"
-- If Track Changes is enabled, disable it
if (track revisions of active document) then
set track revisions of active document to false
end if
-- Change language of the main document to English (US)
set language ID of text object of active document to english us
-- Enable Track Changes
set track revisions of active document to true
end tell

Reply to this thread if you have any questions or need more detail.

HTH,
Shawn Larson
Microsoft MacBU
Mac Word Test
 
D

Daiya Mitchell

Shawn, I think there's a bug in this line, I had just posted about it
elsewhere:
*set* language ID *of* text object *of* active document *to* english us

I was just testing that syntax and getting very odd results, though it
might be a language dependent bug---when I applied French that way,
Tools | Language reported French but SpellCheck didn't act as though it
were French. When I tried Spanish, SpellCheck accepted part of the
document as Spanish but not all, while Tools | Language still reported
Spanish for the entire thing. But maybe it will work with English.

MC, if you have problems, substitute:

select text object of active document
set language ID of selection to french

for the language line above.

Daiya
 
M

MC

Shawn Larson said:
MC,

Here is a quick AppleScript script I¹ve put together that I believe will
work for you:
tell application "Microsoft Word"
-- If Track Changes is enabled, disable it
if (track revisions of active document) then
set track revisions of active document to false
end if
-- Change language of the main document to English (US)
set language ID of text object of active document to english us
-- Enable Track Changes
set track revisions of active document to true
end tell

Reply to this thread if you have any questions or need more detail.

It works -- many thanks!
 

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