• 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: Scripting InDesign CS3 & 4
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting InDesign CS3 & 4


  • Subject: Re: Scripting InDesign CS3 & 4
  • From: Curt Schultz <email@hidden>
  • Date: Thu, 29 Oct 2009 17:07:58 -0700


On Oct 29, 2009, at 4:34 PM, Shane Stanley wrote:

On 30/10/09 10:30 AM, "Curt Schultz" <email@hidden> wrote:

set docPStyles to (name of all paragraph styles whose name does not start with
"[")

Try something like:

set docPStyles to (name of every item of all paragraph styles whose name
does not start with "[")



-- Shane Stanley <email@hidden> AppleScript Pro, April 2010, Florida <http://www.applescriptpro.com>



It sort of worked. It was able to see the nested styles but it could not change them. In the ID file that I am using as a test, there is a nested style called "Left Foot".
When I tested the suggestion I tried to change the name from "Left Foot" to "NEW left foot" using: {"Left Foot", "NEW left foot", "n"}, ¬
On output I receive a message stating "WARNING! Unable to rename paragraph style "Left Foot" to "NEW left foot"


Do I need to apply the suggestion to another part of the script?

Here is the section that I changed and the section that is sending the warning message.
Thanks


--Do paragraph styles
repeat with thisPStyle in myPStyleList
set newPStyle to item 1 of thisPStyle
set oldPStyle to item 2 of thisPStyle
set noteError to item 3 of thisPStyle
set docPStyles to (name of every item of all paragraph styles whose name does not start with "[")
if docPStyles contains newPStyle then
if docPStyles does not contain oldPStyle then
--The oldPStyle exists, the newPStyle does NOT exist so we can rename it now
try
set name of paragraph style newPStyle to oldPStyle
set successPCounter to successPCounter + 1
on error
display dialog "WARNING! Unable to rename paragraph style \"" & newPStyle & "\" to \"" & oldPStyle & "\"." buttons "Cancel" default button 1
end try
else
--Whoops, can't rename a style to an already existing name, delete instead?
beep
set deleteResults to display dialog "WARNING: Paragraph style \"" & oldPStyle & "\" already exists!" & return & return & "Do you wish to delete \"" & newPStyle & "\" and replace it with \"" & oldPStyle & "\" instead?" buttons {"Delete", "Don't Delete"} default button 2
if button returned of deleteResults = "Delete" then
delete paragraph style newPStyle replacing with oldPStyle
set successPDelete to successPDelete + 1
end if
end if
else
if noteError = "y" then
display dialog "NOTE: Could not find a paragraph style named \"" & newPStyle & "\" to change. Continue running script?" buttons {"Continue", "Cancel"} default button 2
set notedErrorCounter to notedErrorCounter + 1
end if
end if
end repeat


_______________________________________________
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
  • Follow-Ups:
    • Re: Scripting InDesign CS3 & 4
      • From: Shane Stanley <email@hidden>
References: 
 >Re: Scripting InDesign CS3 & 4 (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Scripting InDesign CS3 & 4
  • Next by Date: Re: Scripting InDesign CS3 & 4
  • Previous by thread: Re: Scripting InDesign CS3 & 4
  • Next by thread: Re: Scripting InDesign CS3 & 4
  • Index(es):
    • Date
    • Thread