Style Name Applescript

M

MC

I am at a total loss when it comes to Applescripts, but I know some of
you love this kind of challenge.

I'd be really grateful if someone can write me a script that changes 6
Style Names in a document as follows:

DIALOG to Dialogue
TRANSITION to Camera
SCENE HEADING to Location
ACTION to Direction
CHARACTER NAME to Character
PARENTHETICAL to Emphasis1

They are case sensitive.

Emphasis1 is the word followed by the numeral 1.

TIA
 
M

MC

MC said:
I am at a total loss when it comes to Applescripts, but I know some of
you love this kind of challenge.

I'd be really grateful if someone can write me a script that changes 6
Style Names in a document as follows:

DIALOG to Dialogue
TRANSITION to Camera
SCENE HEADING to Location
ACTION to Direction
CHARACTER NAME to Character
PARENTHETICAL to Emphasis1

They are case sensitive.

Emphasis1 is the word followed by the numeral 1.

TIA

No takers?

Dang...
 
J

John McGhie

I'll bet there are no takers :)

This is nearly impossible to do in VBA too, because the way strings are
handled in the style name property, "Case" is ignored.

Let me guess: You have several hundred documents to change?

Otherwise, it would be a lot faster to change them by editing the styles
directly in the Styles section of the formatting palette :)

Cheers

No takers?

Dang...

--

Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Nhulunbuy, NT, Australia. mailto:[email protected]
 
M

MC

John McGhie said:
I'll bet there are no takers :)
Indeed....

This is nearly impossible to do in VBA too, because the way strings are
handled in the style name property, "Case" is ignored.

Thanks for explaining it.

I did try with a QuickKeys demo, but I couldn't get it to work.
Let me guess: You have several hundred documents to change?

Actually no.

I luse Movie Magic Screenwriter 2000 to write TV scripts. I have a job
to do which requires a specific - and non-standard - format in Word.

I can export as rtf from Screenwriter and paste into a template based on
the production company's format.

It works just fine - so long as I change the Style Names.

Can't do that in Screenwriter - or in Final Draft (which I also have but
don't use unless I can't avoid it). So the change has to be in Word.
Otherwise, it would be a lot faster to change them by editing the styles
directly in the Styles section of the formatting palette :)

Which is what I end up having to do. No big sweat, but it would be nice
to be able to do it automatically.
 
J

John McGhie

Ito do this programmatically is an absolute CHORE. I have never bothered!

You have to:

1) Store all the properties of the wrong-named style in an array.

2) Create a new style with the correct name (if the new style does not
exist, Word will honour the case in your name).

3) Set the properties of the new style to be those you stored.

4) Run a Find/Replace to find every instance of BADSTYLE and replace it
with GoodStyle (make certain the text parts of the Find What and Replace
With dialogs are REALLY empty, or you will lose text...)

5) Delete the (now unused...) BADSTYLE from the document. Make sure it's
not applied to any text first, otherwise that text will get Normal style
when you delete the BadStyle.

If you do it like that, it will work. But while the bad style exists, you
can change its name, but Word will ignore the case of your new name.

Cheers

Thanks for explaining it.

I did try with a QuickKeys demo, but I couldn't get it to work.

Actually no.

I luse Movie Magic Screenwriter 2000 to write TV scripts. I have a job
to do which requires a specific - and non-standard - format in Word.

I can export as rtf from Screenwriter and paste into a template based on
the production company's format.

It works just fine - so long as I change the Style Names.

Can't do that in Screenwriter - or in Final Draft (which I also have but
don't use unless I can't avoid it). So the change has to be in Word.

Which is what I end up having to do. No big sweat, but it would be nice
to be able to do it automatically.

--

Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Nhulunbuy, NT, Australia. mailto:[email protected]
 
M

MC

John McGhie said:
Ito do this programmatically is an absolute CHORE. I have never bothered!

You have to:

1) Store all the properties of the wrong-named style in an array.

2) Create a new style with the correct name (if the new style does not
exist, Word will honour the case in your name).

3) Set the properties of the new style to be those you stored.

4) Run a Find/Replace to find every instance of BADSTYLE and replace it
with GoodStyle (make certain the text parts of the Find What and Replace
With dialogs are REALLY empty, or you will lose text...)

5) Delete the (now unused...) BADSTYLE from the document. Make sure it's
not applied to any text first, otherwise that text will get Normal style
when you delete the BadStyle.

If you do it like that, it will work. But while the bad style exists, you
can change its name, but Word will ignore the case of your new name.

It would be EASY if I could change the Style Names in Screenwriter and
save that as a new template. But I canMt. And no way am I going to jump
through the hoops above! I'll live with manual changes...

Interesting to see it all laid out, however. 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