• 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
Quotes in strings sent to JavaScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Quotes in strings sent to JavaScript


  • Subject: Quotes in strings sent to JavaScript
  • From: Rob Lewis <email@hidden>
  • Date: Wed, 28 Nov 2007 22:37:46 -0800

I'm assembling an XML metadata record in AppleScript (using Satimage's XMLLib). Since XML contains lots of double quote marks, there are lots of escaped quotes (\") in the string variable containing the record. 

To insert the metadata into a PDF file, Acrobat offers the AppleScript command:
do script "some _javascript_ code"

When I try this: 
set the_JavaScript to "this.metadata = " & my_XML_string & ";"
tell application "Adobe Acrobat Professional" to tell active doc to do script the_JavaScript

I get: "Acrobat got an error: "this.metadata = <my XML stuff including escaped quotes>;" doesn't understand the do script message". 

I believe the exact actual string that Acrobat's _javascript_ interpreter wants to see is like this (WITHOUT overall enclosing quotes): 
this.metadata = "<metadata XML>;"

including the quote marks. 

I suspect the \" escaped quotes are messing up the _javascript_ interpreter but I don't know how to get rid of them. 

By the way, this works fine to extract the XML string from the PDF:
tell application "Adobe Acrobat Professional" to tell active doc to do script "this.metadata;"
set the_XML_string to the result

Thoughts? 
 _______________________________________________
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: Quotes in strings sent to JavaScript
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: Need to export data to another program
  • Next by Date: Re: Timed loop
  • Previous by thread: Re: Creating a script that can set its own modification date
  • Next by thread: Re: Quotes in strings sent to JavaScript
  • Index(es):
    • Date
    • Thread