• 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 11:24:42 -0800
  • Thread-topic: How do I run a javascript/script within an applescript?

On 1/15/07 1:58 AM, Patrik B. wrote:

> Per the book I have I should be able to do the following
>
> tell application "indesign cs"
> tell active document
> activate
> run script alias "G5:Cleanup.js"
> end
> end
>
> This version starts and then in errors stating "Indesign CS got an error:
> A "%" can't go after this some object.
>
> per the book the following should also work
>
> tell application "indesign cs"
> tell active document
> activate
> run script file "G5:Cleanup.js"
> end
> end
>
> Can anyone tell me what I am doing wrong? I remember that I had a similar
> thing working at one point but that script does not work either anymore.
> Does it have to do anything with scripting additions? I removed a bunch a
> while ago such as ACME etc.

The 'run script' command is part of Standard Additions and only works with
AppleScript code, not javascript. You need to use the 'do script' command
from the InDesign CS dictionary with this syntax:
    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.

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: RE: CAPITAL to Upper And Lower Case (revised)
  • Next by Date: Re: Return PDF default reader
  • Previous by thread: How do I run a javascript/script within an applescript?
  • Next by thread: How do I run a javascript/script within an applescript?
  • Index(es):
    • Date
    • Thread