Call JavaScript from AppleScript using InDesign CS2

Can this be done?
The following script:
tell application "Adobe InDesign CS2"
tell active document
do script "var thisNumber = 5;" language javascript
end tell
end tell
results in the error:
tell application "Adobe InDesign CS2"
do script "var thisNumber = 5;" language javascript
"Adobe InDesign CS2 got an error: \"var thisNumber = 5;\" doesnt understand the do script message."
Why doesn't this work and what can I do to fix it?
William

On 4/12/08 5:41 AM, "Olav Kvern" <[email protected]> wrote:<br /><br />> These sorts of things are hard to see in AppleScript, because the dictionary<br />> browser(s) don't group methods with their parent objects. Sal Soghoian at<br />> Apple has long said that this needs fixing.<br /><br />And in fact it has been fixed -- it just needs app developers to write their<br />dictionaries appropriately. For a good example, have a look at the<br />dictionary of Script Debugger 4.5 -- you'll see classes listed with<br />elements, properties, and "Responds to". And none of that truncation ID's<br />dictionary is full of.<br /><br />-- <br />Shane Stanley <[email protected]><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>

Similar Messages

  • Just starting to use InDesign CS2 and can't pull up my previous Pagemaker files; what do I do?

    Just starting to use InDesign CS2 and can't pull up my previous Pagemaker files; says "damaged and cannot be recovered"
    How can I retrieve those?

    I have no idea what "diagnostic recompose" is...
    Step 3 in this linked technote will show you how to do a diagnostic recompose - on a Mac. Instructions for doing it on Windows are out there somewhere, I'll try to find 'em if you can't. The technote tells you to remove graphics from master pages; I'd also unembed graphics (make sure all graphics are linked, not stored in the PageMaker doc) in order to try to get it to open up in ID.
    I'm sure there are more things you can try, if that doesn't work, but my broken-PageMaker-doc skills are pretty rusty.
    Also, you may want to edit your response on the forums webpage, and delete it from your future email-replies, so your email address and phone number aren't preserved for all to see on the forums, forever.
    Edit: Step 3, not step 4

  • Calling javascript from 10g Forms

    Hi,
    RE: How do I call Javascript from Forms 10g (v 10.1.2.0.2)
    Sorry if this post is to the wrong audience but was wondering (as I haven't had an update from the Forms forum) if anyone could tell me how to know
    when a user was navigating away from the current open form because they had entered a new URL in the address bar and were trying to navigate to it?
    The reason for this is that i would want to prompt the user to confirm that they wanted to exit the form as potentially they would have a record (in the form)
    flagged as being updated and as such no other user (including themselves) could susbequently access it.
    So, I'm basically wanting to know if there is a way (by using Javascript?) to catch the fact that the user is about to navigate to another web page.
    Kind regards,
    Tom

    Hi John,
    Well, I'm chasing my tail about this one as not getting any response from any area.
    Apart from the Oracle Forms forum, any other one that you would suggest?
    Kind regards,
    Tom

  • Using InDesign CS2 on OS 10.6

    We bought some new Macs running on OS 10.6. Unfortunately, our editorial system is still using InDesign CS2. And when we print, Indesign CS2 crashes. This has happened in all the Macs running on 10.6.
    Has anyone experienced this and solved it? We do have InDesign CS4 but it's a hassle opening the CS2 page just to print it.

    Has anyone experienced this and solved it? We do have InDesign CS4 but it's a hassle opening the CS2 page just to print it.
    If you're going to stick with an editorial platform that only runs well on PowerPC architecture with old versions of the OS, you are buying into the idea of keeping old hardware running until such time as you upgrade or abandon the editorial platform.There are ways to buy obsolete Mac hardware - I suggest you spend some time on lowendmac.com and start developing your old-hardware-maintenance plan.
    You might be able to find a better workaround (can you export PDFs and print those?) but no matter what you do, you will be duct-taping something together. Ever since 10.6 came out, we've been seeing these threads on a regular basis, and never once has anyone posted a fix that was not made out of duct tape.

  • Calling Javascript from JApplet

    Does anyone know of a foolproof way of calling Javascript from an Applet on a Web page. I have heard of the JS Object but can't find much aboout it. Does anyone have any ideas?

    or...
    http://turtle.ee.ncku.edu.tw/~zulu/research/seminor02/
    http://turtle.ee.ncku.edu.tw/~zulu/research/
    JRG

  • Calling BRM from UDF using JNDI lookup with @EJB annotation

    Hi Experts
    I am trying to implement a UDF to invoke my BRM Rules set via JNDI Lookup instead of a SOAP Channel lookup.
    I have had a look at the following links/docs:
    Calling BRM from UDF using Public API
    http://www.gleanster.com/system/resources/W1siZiIsIjIwMTIvMDgvMDcvMjAvNDcvNTAvNDMvVGhpbmdzX1lvdV9TaG91bGRfS25vd19hYm91dF9TQVBfTmV0V2VhdmVyX0JSTS5wZGYiXV0/Things%20You%20Should%20Know%20about%20SAP%20NetWeaver%20BRM.pdf
    For item 1 above, the example looks really good, but it doesnt explain how I get access to the following required imports from my UDF:
    import com.sap.brms.qrules.ejb.*;
    import com.sap.brms.qrules.engine.AbstractProject;
    import com.sap.brms.qrules.engine.RuleEngine;
    import com.sap.brms.qrules.engine.RulesetContext;
    import javax.ejb.EJB;
    The second document is really good as well, but I could not figure out how to get it to work from my UDF.
    So, can anyone help me to understand specifically what is required to get this to work?
    Is is possible to invoke the rule set from my UDF?
    How do I give my UDF access to all the required jars/imports?
    I have manage to create a new DC (Development Component) with a public part and this enables me to get my code to compile on my local PC but I am not able to activate it due to the server not having access to the same java packages as my local copy.
    Any help would be greatly appreciated.

    You resolve the dependency by importing the required jars with using the dependency tab for the mapping program.
    As stipulated before, I have managed to resolve the dependency issue but I have now getting the same error as in the forum: Calling BRM from UDF using Public API
    The specific error is:
    com.sap.engine.services.cross.PortableRemoteObjectContainer.narrow(PortableRemoteObjectContainer.java:238)
    Has anyome manage to get invoke a BRM Ruleset using JNDI?

  • How to call javascript using applescript in InDesign cs2 Mac

    Hi,
    I need to integrate javascript with my apple script??? how to use it???please help me...i need it immediately..........

    Hi Andrew,
    Here is an example for you – a snippet from my script:
    global myBridgeLabel
    -- function that runs on clicking the button in adobe script studio project
    on clicked theObject
    if name of theObject is "b1" then
    set processName to "Started working"
    set myBridgeLabel to "Red"
    set myLabel to 1
    else if name of theObject is "b2" then
    set processName to "Started doing this"
    set myBridgeLabel to "Green"
    set myLabel to 2
    else if name of theObject is "b3" then
    set processName to "Started doing that"
    set myBridgeLabel to "Yellow"
    set myLabel to 3
    else if name of theObject is "b4" then
    set processName to "Finished doing this"
    set myBridgeLabel to "Blue"
    set myLabel to 4
    else if name of theObject is "b5" then
    set processName to "Finished doing that"
    set myBridgeLabel to "Purple"
    set myLabel to 5
    end if
    tell application "Adobe InDesign CS2"
    set mydocument to active document
    set myDocumentPath to full name of mydocument
    set workerName to "Kasyan"
    tell metadata preferences of mydocument
    set theDate to current date
    set myWeekday to weekday of theDate as string
    set myDenNedeli to my convertWeekday(myWeekday)
    set myRecord to (processName & " – " & workerName & " – ") & myDenNedeli & " " & text 1 thru -4 of time string of theDate & " \r"
    set myHistory to get property namespace "http://ns.adobe.com/photoshop/1.0/" path "History"
    set property namespace "http://ns.adobe.com/photoshop/1.0/" path "History" value myHistory & myRecord
    end tell
    set myJavaScript to "var myLabel =\"" & myBridgeLabel & "\"; app.activate(); var bt = new BridgeTalk; bt.target = \"bridge\"; myScript = 'app.displayDialogs = \"none\"; var t = new Thumbnail (File (\"" & myDocumentPath & "\")); var mdata = t.metadata; mdata.namespace = \"http://ns.adobe.com/xap/1.0/\"; mdata.Label = \"' + myLabel + '\";'; bt.body = myScript; bt.send();"
    do script myJavaScript language javascript
    In this javascript I use pares of single and double quotes.
    The main java script – myJavaScript – (inside double quotes) contains another java script – myScript – (inside single quotes) which runs in Bridge via BridgeTalk.
    I also put variables from AppleScript into JavaScript by using two pares of double quotes – the outside pare I escape with slashes:
    set myBridgeLabel to "Red" -- a variable I defined in AppleScript
    set myJavaScript to "var myLabel =\"" & myBridgeLabel & "\"; app.activate();
    -- the contents of myBridgeLabel variable now becomes part of the JavaScript
    Kasyan

  • Calling Javascript from ABAP webdynpro application

    Hai All,
    I want to call a Javascript from ABAP-Webdynpro application. If anyone has done this. Please let me know.
    Thanks & Regards,
    H.K.Hayath Basha.

    go to window
    create suspend outbound plug and resume inbound type
    when create an outbound plug of Suspend type a parameter Url is automatically created,
    fire the outbuond plug with the Url to a BSP page where you have JavaScript.
    and fromt he BSP navigate back to WDA again which you can do using by reading the url parameter sap-wd-resumeurl, which contains the WDA URL
    Abhi

  • Calling javascript from a button

    Good morning everyone!
    I need to add a message box that asks the user a confirmation to delete information. So I want my delete button to call the javascript necessary to confirm the delete and then delete.
    My problem is in calling the javascript. I'm able to do so by using an image for my button and in the image attributes add:
    onclick="javascript:confirmDelete('Are you sure you to delete?');"
    This works perfectly, except for one thing: I don't want to use an image for the button. It doesn't fit with the rest of the application.
    I know it can work, because Oracle is using it on this page:
    http://apex.oracle.com/pls/otn/f?p=37719:8:3069181226556730::NO:::
    So how can I call my javascript from an ordinary button?

    I have a related question:
    How can I access the BROWSER_LANGUAGE in javascript? With my method of calling javascript, I didn't find a good way to pass variables to the function that I call.

  • How to call javascript from java application

    How can we call a function written in javascript from java application (core java not applet)? How will java identify javascript?
    Is there any such options ?

    Try creating a page called launcher.html (for example). That does this:
    <html>
    <head>
    <script language="javascript">
    windowHandle=window.open("http://www.javasoft.com", "", "height=700,width=1000,status=no,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,top=5,left=5");
    </script>
    </head>
    </html>Now you launch IE (or whatever) with this page using the Runtime class. After x seconds (after the second window has been launched) try killing the process. Hopefully it will kill the original window you opened and not the window you popup (the one without toolbars etc)
    It might kill both windows but I can't be bothered to test it. If it does you'll have to try and find a workaround.

  • Calling javascript from subdomain

    I have the swf file on the main domain and I call them from a
    subdomain. All works fine except javascript. Does anybody ahve an
    idea why? The same code that I use on a subdomain I use on the main
    domain too, and there javascript calls work.
    Thanks

    or...
    http://turtle.ee.ncku.edu.tw/~zulu/research/seminor02/
    http://turtle.ee.ncku.edu.tw/~zulu/research/
    JRG

  • Embedded .swf's calling javascript from air container

    1) I have an html/ajax air app version 1.5.1
    2) This air app embeds .swf files from an external source / web server & plays the embdded .swf inside air.
    3) The embedded .swf file has a button with an onClick event
    function onClick(event:MouseEvent):void {
    ExternalInterface.call("someJavascriptMethod()" );
    4) The javascript method to be called is already parsed inside the containing Air app and is waiting to be triggered.
    5) When the onClick is triggered, the following error is thrown.
    Error: Error #2067: The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX,
    Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime.
    at Error$/throwError()
    at flash.external::ExternalInterface$/call()
    at stress_fla::MainTimeline/onClick()
    6) On investigation I found on your livedoc's website that Air does not support the ExternalInterface.call method.
    http://livedocs.adobe.com/labs/air/1/aslr/flash/external/ExternalInterface.html
    Look for Note: Adobe AIR currently does not support the ExternalInterface class.
    7) Does anyone here know how I can get an embbeded .swf file to call javascript methods in the containing air application? I have had a look at the getUrl method but this is now longer supported & even the FS command but still to no avail. I may have a work around by inserting a DOM element over the top of the embedded .swf but this is not an elegant solution & want the .swf to talk directly to the air app container.
    All help & comments welcome
    Thanks
    Kyle
    Additionally I have found
    http://help.adobe.com/en_US/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7ed4 .html
    Using the Html Loader so that Actionscript can call/manipulate the dom objects. At first I was whopee but then I tried the examples listed in the help. The HTMLLoader class is only available in Air. When trying to use import flash.html.HTMLLoader; Flash C4 complains that the Definition cannot be found on compile time & therefore does not export my movie correctly. Has anyone else had this problem or have a solution??
    More additions:
    The reason the htmlLoader class was not compiling was due to the source action script provided being ActionScript 2.0 - the htmlLoader class is a 3.0 library.
    However, after more investigation I have found the current structure.
    The air app has an html base/root doc. On periodic javascript events - .swf files are downloaded via
    videos = new air.Loader();
    netStream     = new air.URLRequest(path + file);
    videos.load(netStream);
    So now I have a html container in my air app that creates a new air.Loader which downloads the external .swf file in which I want an onClick event in the action Script of the downloaded .swf file to call a Javascript method of the parent air container. Simple yea?
    Or am I making life to hard for myself? Have been looking at the security snadboxes but I don't see how I can get the .swf file to talk nicely with the outer air container. Please help if able.
    Thanks
    Kyle

    Hi Kenneth,
    Your explanation makes sense.
    I have a big JavaScript file full of special mathematical functions written by a mathematician who only knows how to program in Javascript.
    I need to call the Javascript functions from within an ActionScript library, which obviously has no UI, and thus HTML and/or HTMLLoader are not an option.
    Any ideas?
    TIA,
    mlavie

  • Calling javascript from procedure

    Hi folks
    I am trying to call in a javascript from an onSubmit procedure after computations and validations. This process is conditional and fires on a button click.
    Heres the procedure body :
    begin
    htp.p('<script language =javascript'>)functiondoSomeThing(1,2);</script>');
    end;
    This is not working. I tried removing the branch from the on click of that button as well but, then it says error no page to branch to. Any possible way in which I can see the effects of the above procedure ?
    I want this javascript to be in procedure only, since this is supposed to act after computations and validations.
    Thanks
    Shantanu

    Hi Shantanu,
    Javascript is client-side code; computations, validations, processes and branches are server-side. In order for the javascript to run, therefore, it has to be on the rendered page - you can not call it after computations and validations without reloading the page with the javascript in it somewhere.
    If the script should only be on the page after the user clicks a specific button, you should set the button to set a value for a hidden item and use this to conditionally display the javascript. I tend to put scripts into a region on their own and use Conditional Display appropriately.
    What should the script do "after computations and validations" that can not be done by a page process?
    Andy

  • CS4 do javascript from AppleScript

    Hi all,
    Consider this AppleScript snippet:
    tell application "Adobe Illustrator"
    do javascript myFile with arguments {"one", "two"}
    end tell
    The file "myFile" is executed OK, but how does myFile (a JavaScript script) get the arguments passed in from AppleScript? I don't see this documented anywhere.
    Thanks,
    Chuck

    Since nobody answered this:
    In your Javascript, you will find an arguments array containing the arguments you passed from Applescript or VBscript
    So, using your example, if you added this line to your JSX file:
    alert(arguments[0]);
    You would get an alert saying "one" when you ran your Applescript.

  • "ReferenceError: "myIpAddr"  is not defined, when call JavaScript from java

    Hi developers,
    My java application was trying to issue a http request via proxy auto-config. So, I did below jobs
    1. Read URL of *.pac from registry
    2. Call FindProxyForURL from java, the code is like below
                   ScriptEngineManager factory = new ScriptEngineManager();
                   ScriptEngine engine = factory.getEngineByName("JavaScript");
                   engine.eval(autoProxyScript);
                   Invocable inv = (Invocable) engine;
                   Object obj = inv.invokeFunction("FindProxyForURL",
                             "http://java.sun.com/",
                             "java.sun.com");
    However, I got "ReferenceError: "myIpAddress" is not defined
    I can not change the script on server to add a function like "myIpAddress", I am wordering why IE or mozilla can call it successfully and get proxy server, while Java failed to do that.
    I got a ugly solution by calling "pacparser" by jni. But I really hope I can get a better solution.

    A .pac file is a JavaScript, but it requires some functions to be defined in the executing context to work (i.e. you must define those).
    From the example on the Wikipedia page there's at least "shExpMatch" and "isInNet". "myIpAddress" seems to be another such candidate.

Maybe you are looking for

  • Can I have multiple Game Center accounts with one Apple ID?

    My wife and I use the same Apple ID but want to have individual game enter accounts. Is this possible? Or does my wife need to set up her own Apple ID? Any one got any ideas?

  • Oracle 9i installation error on AIX 4.3

    Hi Dears, i am trying to install oracle 9.0.1 on iBM-AIX 4.3.but when i run runInstaller script i got the follwonig below error error in writting to directory /tmp/Oinstall. please ensure that this directory is writable and has alleast 25MB of disk s

  • You can't open Mail, Contacts & Calendars preferences because it doesn't work on an Intel-based Mac.

    I updated my Mac to Mavericks and after that, I can't open the Mail, Contacts and Calendar preferences. Every time I try, I get the following message: "You can't open Mail, Contacts & Calendars preferences because it doesn't work on an Intel-based Ma

  • [SOLVED] How to limit cpu usage by makepkg?

    I tried cpulimit -l 30 makepkg but the cpu usage still reaches 100% + 100% due to conky (i have 2 core cpu). OK, I've found out that cpulimit does not restrict child processes but cgroup is promised to do that. So I installed it from AUR and did the

  • Feeback for Acroread 9.X.X and Solaris10_x86

    Thank you for porting Acrobat Reader 9.3.3 to Solaris10_x86. This what I am observing with 'acroread' on Solaris10_x86 When I launch it, acroread is responsive for 3-5 seconds and then it gets completely unresponsive. trussing it reveals that it is o