Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
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>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.