Converting Quark Style Sheets to InDesign Style Sheets

Hello -

Further to my post earlier about this, here’s a sort of solution. I say sort of, because it doesn’t deal with colors or rules, but it’ll do other things. You need to have the document which has all the styles open in Quark, and a blank document open in InDesign.

It’s a leetle annoying because Quark refers to fonts as eg Frutiger LT Std 47 Light Cn, and InDesign refers to them as Frutiger LT Std with style 47 Light Condensed. You’ll see that I’ve put in a bit checking this and splitting it out if necessary.

It needs a bit of careful attention when you’re using it, but (once adapted) should make converting paragraph styles from Quark to InDesign a bit easier.

Do drop me a line (hsymington@cambridge.org) if you use it; I’d be interested to see how often it’s used by people.

Cheers,

Hamish

tell application "QuarkXPress"
	activate
	tell document 1
		set paragraphStyles to name of every style spec
		
		repeat with i from 1 to count (paragraphStyles)
			
			set pS to properties of style spec (item i of paragraphStyles)
			
			set myList to (pS as list)
			
			--This is the name
			set pName to item 7 of myList
			
			--Get the useful properties
			set pList to (item 9 of myList)
			
			
			
			set pDropCap to drop cap characters of pList
			set pDropCapLines to drop cap lines of pList
			set pFirstIndent to first indent of pList
			set pGridLock to grid lock of pList
			set pJustification to justification of pList
			set pKeepAll to keep all of pList
			set pKeepTogether to keep together of pList
			set pKeepTogetherEnd to keep together end of pList
			set pKeepTogetherStart to keep together start of pList
			set pKeepWithNext to keep with next of pList
			set pLanguage to language of pList
			set pLeading to leading of pList
			set pLeftIndent to left indent of pList
			set pRelativeLeading to relative leading of pList
			set pRightIndent to right indent of pList
			set pRuleAbove to rule above of pList
			set pRuleBelow to rule below of pList
			set pSpaceAfter to space after of pList
			set pSpaceBefore to space before of pList
			set pTabList to tab list of pList
			
			--Some things are contained in item 10, so now switch to this one
			set pList to item 10 of myList
			
			set pBaseShift to base shift of pList
			set pColor to color of pList
			set pFont to font of pList
			set pHScale to horizontal scale of pList
			set pShade to shade of pList
			set mypSize to size of pList as string
			set pSize to text 1 thru ((length of mypSize) - 3) of mypSize
			set pStyle to style of pList
			set pTrack to track of pList
			set pVScale to vertical scale of pList
			
			set myCharacter to {}
			
			tell application "Adobe InDesign CS2"
				activate
				tell active document
					try
						set myCharacterStyle to make paragraph style
						set name of myCharacterStyle to pName
						if (pFont starts with "Frutiger LT Std") then
							set applied font of myCharacterStyle to "Frutiger LT Std"
							if (text 17 thru (length of pFont) of pFont ends with " Cn") then
								set font style of myCharacterStyle to ((text 17 thru ((length of pFont) - 3) of pFont) & " Condensed")
							else
								set font style of myCharacterStyle to text 17 thru (length of pFont) of pFont
							end if
						else
							set applied font of myCharacterStyle to pFont
						end if
						if on styles of pStyle contains "bold" and list item on styles of pStyle does not contain "italic" then
							set font style of myCharacterStyle to "Bold"
						end if
						if on styles of pStyle contains "italic" and list item on styles of pStyle does not contain "bold" then
							set font style of myCharacterStyle to "italic"
						end if
						if on styles of pStyle contains "bold" and list item on styles of pStyle contains "italic" then
							set font style of myCharacterStyle to "Bold Italic"
						end if
						set point size of myCharacterStyle to pSize
						
						
						set left indent of myCharacterStyle to text 1 thru ((length of (pLeftIndent as string)) - 3) of (pLeftIndent as string)
						set right indent of myCharacterStyle to text 1 thru ((length of (pRightIndent as string)) - 3) of (pRightIndent as string)
						set first line indent of myCharacterStyle to text 1 thru ((length of (pFirstIndent as string)) - 3) of (pFirstIndent as string)
						set justification of myCharacterStyle to pJustification
						set space after of myCharacterStyle to text 1 thru ((length of (pSpaceAfter as string)) - 3) of (pSpaceAfter as string)
						set space before of myCharacterStyle to text 1 thru ((length of (pSpaceBefore as string)) - 3) of (pSpaceBefore as string)
						
						if pLeading is "auto" then
							set leading of myCharacterStyle to -1
						else
							set mypLeading to pLeading as string
							set pLeading to text 1 thru ((length of mypLeading) - 3) of mypLeading
						end if
						
						--set case of myCharacterStyle to case of myCharacter 
						if on styles of pStyle contains "superscript" then
							set position of myCharacterStyle to "Superscript"
						end if
						if on styles of pStyle contains "subscript" then
							set position of myCharacterStyle to "Subscript"
						end if
						if on styles of pStyle contains "underline" then
							set underline of myCharacterStyle to true
						end if
						if on styles of pStyle contains "strikethrough" then
							set strike thru of myCharacterStyle to true
						end if
						
						set mypBaseShift to pBaseShift as string
						set pBaseShift to text 1 thru ((length of mypBaseShift) - 3) of mypBaseShift
						set baseline shift of myCharacterStyle to pBaseShift
						
					end try
				end tell
				
			end tell
		end repeat
		
		
	end tell
end tell

I liked your script but I am having issues with it. I assume it may be because of a newer version of Indesign. i only have CS4 and CS5.5 to test.

I having issues as shown in this screenshot

would love for someone to figure this out. FYI, I tried the email address shown above but, its no longer in service.

Thanks

Chris J

Hello

My understanding is that the instruction which fails on your machine isn’t triggering inDesign but Xpress so, it’s not related to your version of inDesign but to your version of Xpress.

KOENIG Yvan (VALLAURIS, France) vendredi 16 août 2013 16:19:13

Thanks Yvon

I will check this out further. FYI, I turned off, mypSize (commented using --) and it would work, kinda, it reads all the styles, and does put it InDesign but it doesn’t change the size, thus the reason for the error at changing size (mypsize)

Thanks

Chris J