Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AppleScript InDesign syntax error.

Status
Not open for further replies.

jjjax64

IS-IT--Management
Apr 27, 2010
39
US
Hi, this script runs fine as is but when I got to edit, it gives me error when compiling. Error I get is on following 2 lines with as text part. If I take it out, I don't get error but script doesn't run. Script was created on a older version of MAC OS and InDesign but someone else.

set contents of myTextFrame to TheList as text

set XML_File to (choose file with prompt XMLstr) as text


Error is Syntax error:" Expected end of line, etc. but found application constant or consideration."

Here is complete script:


try
set CSVstr to "Please locate your CSV file..."
set CSV_File to (choose file with prompt CSVstr) as text
set csvData to read file CSV_File

set csvEntries to paragraphs of csvData

set {CSVItem1} to parseCsvEntry(csvEntries's item 1)
set {CSVItem2} to parseCsvEntry(csvEntries's item 2)
set {CSVItem3} to parseCsvEntry(csvEntries's item 3)
set {CSVItem4} to parseCsvEntry(csvEntries's item 4)
set {CSVItem5} to parseCsvEntry(csvEntries's item 5)
set {CSVItem6} to parseCsvEntry(csvEntries's item 6)
set {CSVItem7} to parseCsvEntry(csvEntries's item 7)
set {CSVItem8} to parseCsvEntry(csvEntries's item 8)
set {CSVItem9} to parseCsvEntry(csvEntries's item 9)

set TheList to {CSVItem1, CSVItem2, CSVItem3, CSVItem4, CSVItem5, CSVItem6, CSVItem7, CSVItem8, CSVItem9}

tell application "Adobe InDesign CS5.5"
set myDocument to active document
tell XML view preferences
set show attributes to false
set show structure to true
set show tagged frames to false
set show tag markers to false
set show text snippets to true
end tell
tell XML import preferences
set allow transform to false
set create link to XML to false
set ignore unmatched incoming to true
set ignore whitespace to true
set import CALS tables to true
set import style to merge import
set import text into tables to false
set import to selected to false
set remove unmatched existing to false
set repeat text elements to true
end tell
set myPage to active page of active window
tell myPage
set myTextFrame to make text frame
set geometric bounds of myTextFrame to {"6p", "6p", "24p", "24p"}

****Error on below line ****
set contents of myTextFrame to TheList as text
****************************
move myTextFrame to {"-30p", 0}
end tell

set Char1 to item 1 of TheList
set Char2 to item 2 of TheList
set Char3 to item 3 of TheList
set Char4 to item 4 of TheList
set Char5 to item 5 of TheList
set Char6 to item 6 of TheList
set Char7 to item 7 of TheList
set Char8 to item 8 of TheList
set Char9 to item 9 of TheList
set AppleScript's text item delimiters to "\"\""
set {LTry} to Char1's text items
set AppleScript's text item delimiters to {}

set placedAsset to place asset asset LTry of library "JetroXMLElements.indl" on myDocument
move placedAsset to {0.363, 0.84}
set placedAsset to place asset asset Char2 of library "JetroXMLElements.indl" on myDocument
move placedAsset to {3.695, 0.84}
set placedAsset to place asset asset Char3 of library "JetroXMLElements.indl" on myDocument
move placedAsset to {6.905, 0.84}
set placedAsset to place asset asset Char4 of library "JetroXMLElements.indl" on myDocument
move placedAsset to {0.363, 3.91}
set placedAsset to place asset asset Char5 of library "JetroXMLElements.indl" on myDocument
move placedAsset to {3.695, 3.91}
set placedAsset to place asset asset Char6 of library "JetroXMLElements.indl" on myDocument
move placedAsset to {6.905, 3.91}
set placedAsset to place asset asset Char7 of library "JetroXMLElements.indl" on myDocument
move placedAsset to {0.363, 6.95}
set placedAsset to place asset asset Char8 of library "JetroXMLElements.indl" on myDocument
move placedAsset to {3.695, 6.95}
set placedAsset to place asset asset Char9 of library "JetroXMLElements.indl" on myDocument
move placedAsset to {6.905, 6.95}
tell myDocument
set XMLstr to "Please locate your XML file..."
****Error on below line ****
set XML_File to (choose file with prompt XMLstr) as text
****************************
import XML from XML_File
end tell
tell application "Adobe InDesign CS5.5"
set find text preferences to nothing
set change text preferences to nothing
set find what of find text preferences to "mykzlplx"
set change to of change text preferences to ""
tell active document
change text
end tell
set find text preferences to nothing
set change text preferences to nothing
set find what of find text preferences to "¬"
set change to of change text preferences to ""
tell active document
change text
end tell
set find text preferences to nothing
set change text preferences to nothing

end tell

end tell
end try
to parseCsvEntry(csvEntry)
set AppleScript's text item delimiters to "\"\""
set {Stuuff} to csvEntry's text items
set AppleScript's text item delimiters to {""}
return {Stuuff}
end parseCsvEntry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top