• 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: How do I run a javascript/script within an applescript?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I run a javascript/script within an applescript?


  • Subject: Re: How do I run a javascript/script within an applescript?
  • From: Stan Cleveland <email@hidden>
  • Date: Mon, 15 Jan 2007 13:27:02 -0800
  • Thread-topic: How do I run a javascript/script within an applescript?

Title: Re: How do I run a javascript/script within an applescript?
On 1/15/07 12:54 PM, Patrik B. wrote:

>> tell application "InDesign CS"        do script file "G5:Cleanup.js"
>> language _javascript_    end tell
>>
>> You may also replace the file reference with quoted _javascript_ code:
>>     tell application "InDesign CS"
>>         do script "// this is a comment
>>     var thisString = \"Hello, World.\"" language _javascript_
>>     end tell
>>
>> That should get you going down the correct path, so to speak.
>    
> Hi Stan
>
> I tried your variation below but it does not compile for some reason. It
> gives me an error "Expected end of line but found "." What does that mean?
>
> I am using Script editor 2.0 (v43) Applescript 1.9.3
>
> I remember vaguely that this used to run on my machine. Does this require a
> specific scripting addition?
>
> Best, Patrik

Looks like there may have been a text-wrapping problem, so I’ve switched this email to
HTML format to preserve the code. Here it is again.

tell application "InDesign CS"
    do script file "G5:Cleanup.js" language _javascript_
end tell

tell application "InDesign CS"
    -- FYI, the _javascript_ below does nothing but assign a variable
   do script "// this is a comment
var thisString = \"Hello, World.\"" language _javascript_
end tell

Keep in mind that the above code is for executing _javascript_ that is specifically written
for InDesign CS only, which it appeared you’re trying to do, and works only within an
InDesign CS tell block. I use this approach all the time with Photoshop CS2, when some
function is available only using _javascript_, but not AppleScript.

If you are trying to execute _javascript_ in a non-InDesign environment, then this method
won’t do the job and what you need falls outside my experience.

Stan C.
 _______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden

References: 
 >How do I run a javascript/script within an applescript? (From: "Patrik B." <email@hidden>)

  • Prev by Date: How do I run a javascript/script within an applescript?
  • Next by Date: wierd behavior
  • Previous by thread: How do I run a javascript/script within an applescript?
  • Next by thread: Quark Xpress Save As ...
  • Index(es):
    • Date
    • Thread