×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

AppleScript InDesign syntax error.

AppleScript InDesign syntax error.

AppleScript InDesign syntax error.

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close