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

Similar Messages

  • How to Call JavaScript using SDK [CS4] - Reg.

    Dear All,
    Here I am successfully run the javascript usig SDK [CS3] coding. But I have some slight modificate then this is not working. Please kindly help me.
    I'm using the SDK Code is :
    CS3:virtual ErrorCode RunFile(const IDFile& idFile, bool16 showErrorAlert = kTrue,
    bool16 invokeDebugger = kFalse) = 0;
    Call to RunFile:
    ErrorCode err = scriptRunner->RunFile(scriptFile, kFalse, kTrue);CS4:virtual ErrorCode RunFile(const IDFile& idFile, const RunScriptParams& params) = 0;
    Call to RunFile:
    RunScriptParams params( scriptRunner);
    params.SetInvokeDebugger(kTrue);
    ErrorCode err = scriptRunner->RunFile(scriptFile, params);
    In CS3:
    PMString jsFullPath("C:\\WINDOWS\\MacID\\BIN\\sample.jsx"); // a path to my java script file
     do {  
    const IDFile outFile(jsFullPath); InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
    ASSERT( scriptManager ) ;
    InterfacePtr<IScriptRunner> scriptRunner(scriptManager,UseDefaultIID());
    ASSERT( scriptRunner ) ;
    if(scriptManager) {
    InterfacePtr<IScriptRunner>scriptRunner(scriptManager,UseDefaultIID());
    ErrorCode err = scriptRunner->RunFile(outFile, kTrue, kFalse); 
    }while(kFalse);
    This above coding is working fine... in Adobe InDesign CS3.
    But I have to change the code as per the CS4 SDK, but this is not working. See the below code:
    PMString jsFullPath("C:\\WINDOWS\\MacID\\BIN\\sample.jsx"); // a path to my java script file
     do {  
    const IDFile outFile(jsFullPath); InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
    ASSERT( scriptManager ) ;
    InterfacePtr<IScriptRunner> scriptRunner(scriptManager,UseDefaultIID());
    ASSERT( scriptRunner ) ;
    if(scriptManager) {
    InterfacePtr<IScriptRunner>scriptRunner(scriptManager,UseDefaultIID());
    RunScriptParams params( scriptRunner);
    params.SetInvokeDebugger(kTrue);
    ErrorCode err = scriptRunner->RunFile(outFile, params);
    }while(kFalse);
    I having the doubt above the below line:
    RunScriptParams params( scriptRunner);
    params.SetInvokeDebugger(kTrue);
    ErrorCode err = scriptRunner->RunFile(outFile, params);
    I used the above line code in CS4 SDK, and run the CS4 Application then Immediatly CS4 Application is quited.
    Because of the code is throwing "R6025 - pure Virutual Function call"... like that.
    Here I have attached the 3 Error JPG files.
    Please kindly any one can help me!, B'coz of I'm struggle to get the answer.
    Anybody can give me the answer then I will appriciate!!
    Thanks & Regards
    T.R.Harihara SudhaN

    Dear Dirk
      Many thanks for quick reply.
    But Still I am not getting the answer, So please give me the correct coding;
    PMString jsFullPath("C:\\WINDOWS\\MacID\\BIN\\sample.jsx"); // a path to my java script file
    do {  
    const IDFile outFile(jsFullPath);
    if(scriptManager)
    InterfacePtr<IScriptRunner>scriptRunner(scriptManager,UseDefaultIID());
    RunScriptParams params( scriptRunner);
    params.SetInvokeDebugger(kTrue);
    ErrorCode err = scriptRunner->RunFile(outFile, params);
    InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
    ASSERT( scriptManager ) ;
    InterfacePtr<IScriptRunner> scriptRunner(scriptManager,UseDefaultIID());
    ASSERT( scriptRunner ) ;
    }while(kFalse);
    This old coding only, So please Modify my coding and send me.... please I need your help!!!
    Thanks & Regards
    T.R.Harihara SudhaN

  • Please tell me how to call javascript(.js) in my vb exe for adobe illustrator cs.

    Could you please please give some sample codings "how to call javascript in my vb exe for adobe illustrator cs". I called through doscript in my vb program, but some time it throws an error. If i run the script directly in illustrator it does not throws error. So Please advice me how to solve this problem.
    Thanks in advance,
    Prabudass E

    I'm not sure if this helps but it's from the CS4 scripting examples:
    Set appRef = CreateObject("Illustrator.Application")
    Set fileSystemObject = CreateObject("Scripting.FileSystemObject")
    ' Creating a folder browser in VBScript can be a problem (relying on either Windows API calls
    ' or use of ActiveX controls which may not be present on a given system). Instead, use
    ' Illustrator's built-in JavaScript to display a file browser. DoJavaScript can return a value,
    ' in this example it's the platform specific full path to the chosen template file.
    doJavaScript = "var templateFile = File.openDialog(""Select CalendarTemplate.ai file:""); if (templateFile) filePath = templateFile.fsName;"
    myFilePath = appRef.DoJavaScript(doJavaScript)

  • How to call javascript function with dynamic data in display tag

    Hi,
    Iam new to pagination concept. Iam using display tag to display rows in jsp by strtus.
    I have a problem when calling the javascript function using ahref in attribute in display tag.
    <bean:define name="form1" property="EditDetails.List" id="ListDisplay"/>
    <display:table name="pageScope.ListDisplay" cellpadding="0" cellspacing="1" pagesize="10" partialList="false" size="listSize" requestURI="">
    <display:column property="poNo" href='javascript:searchEditDetails("./submitOrder.do? actionID=getMISLoadEdit&poNumberSel=<%=((com.po.bean.EditDetails)poListDisplay).getNo()%>&statusIdSelected=<%=((com.po.bean.EditDetails)ListDisplay).getStatusId()%>")'
    title="Number"/>                         
    <display:column property="strDate"title="Date" />
    <display:column property="orderValue"title="Order Value(INR)"/>
    <display:column property="stringRequestedDeliveryDate"title="Suggested Delivery Date"/>
    <display:column property="statusDescription" title="Status" />
    </display:table>
    The above code display the data in row format is working fine when I click the No It thow javascript error and its not redirecting to the other page.
    When I try this with ordinary struts its working fine the code is:
    <logic:iterate id="polist" name="Form1" property="EditDetails.List" indexId="i" type="com.bean.EditDetails">
    <tr>
    <td ><a href="javascript:searchEditDetails("./submitOrder.do?actionID=getMISLoadEdit&NumberSel=<%=((com.bean.EditDetails)polist).getNo()%>&statusIdSelected=<%=((com.bean.EditDetails)polist).getStatusId()%>")"><html:hidden name="polist" property="No" write="true" /></a>     </td>
    <td><html:hidden name="polist" property="strDate" write="true" /></td>
    <td><html:hidden name="polist" property="orderValue" write="true" /></td>
    <td><html:hidden name="polist" property="stringRequestedDeliveryDate" write="true" />     </td>
    <td><html:hidden name="polist" property="statusDescription" write="true" /></td>
    </tr>
    </logic:iterate>
    Please help me how to call javascript with dynamic data.
    Thanks in advance

    The ADF Mobile Container Utilities API may be used from JavaScript or Java.
    Application Container APIs - 11g Release 2 (11.1.2.4.0)

  • How to call javascript function from PL/SQL procedure

    Can anybody advice me how to call javascript function from PL/SQL procedure in APEX?

    Hi,
    I have a requirement to call Javascript function inside a After Submit Process.
    clear requirement below:
    1. User selects set of check boxes [ say user want to save 10 files and ticks 10 checkboxes]
    2. user clicks on "save files" button
    3. Inside a After submit process, in a loop, i want to call a javascript function for each of the file user want to save with the filename as a parameter.
    Hope this clarify U.
    Krishna.

  • How to call serlvet using ftp protocal

    Hai,
    How to call servlet using ftp protocal . if any one having please send that program . because generic servlet will receive any protocal request .

    The basics are to have your Server listen to port 21.
    You would then have to parse the request information to determine what is being asked for and generate an appropriate response.

  • How to call javascript function?

    Hi,
    How to call javascript function for SAP button
    control onclick event?
    Thanks in advance.

    Hi Sundar,
      u can call java script  in design mode.
      Add this code in ur design part inside body and call the function as
    <sap:button id="a" onSelect="javascript:go();"
    Add inside body:
      <script language="javascript>
    function go(){
    alert("hai");
      </script>
    Regards,
    Vinoth.M

  • How do I enable plug-ins for InDesign CS2 - files won't open

    How do I enable plug-ins for InDesign CS2 - files won't open.
    I own CS2.
    I shouldn't have to buy CS6 InDesign.
    How do I open CS 2 files and get the plug ins again.

    Asking the same question over and over will not change the answer.

  • How pinnacle can be used for streaming video for mac app?

    How pinnacle can be used for streaming video for mac app?

    Hi naturalfemale,
    As mentioned in the referring article, closed captioning content has to be specifically added/enabled to a video for closed captioning to function:
    Additional Information
    Not all videos include caption or subtitle tracks. Check the documentation for the video you are using to see if it includes these features.
    OS X: Using captioning features in Mavericks
    http://support.apple.com/kb/HT5910
    At the moment, I do not believe there is an option for universal captioning.
    Regards,
    - Brenden

  • 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>

  • How to call javascript function in Flash

    Please help...
    I have a site that run multiple of domain for example
    Domain (A): raymond.com
    Domain (B): raymond.ca
    The problem is this.. when (B) html page load the flash file
    that locate at (A) it load but non of the buttons work which call
    javascript function using getURL("javascript:showpopup()"); But it
    work fine if all reside on the same domain,eg( (A) html page load
    flash file form (A)). Anyone know how to solve this other than
    create a set of flash files on (B).
    Regards,
    Raymond

    http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?cont ext=Flash_MX_2004&file=00001750.html

  • How to call javascript file in windows?

    I developed javascript for automated pdf files. But i don't know how to call that javascript file from outside of acrobat. Kindly advice me the various way to use that script. This is for acrobat 8.0.

    You can place Acrobat JavaScripts in various form elements, document actions, documents, and the application folder or user application folder. See the Acrobat JavaScript API Reference and Guide fo rmore information, http://www.adobe.com/devnet/acrobat/javascript.html .
    From within Acrobat's JavaScript's debugging console, one can use the following code to locate the JavaScript folders used by Acrobat/Reader:
    function JSInfo() {
    /* define function to report JS information */
    // some basic system information
    console.println(app.viewerType + ' ' + app.viewerVersion + ' is running on ' + app.platform);
    // user level script folder
    try {
    var userJS = 'User level JS folder: ' + app.getPath("user","javascript");
    } catch(e) {
    var userJS = "User has not defined use JS folder level scripts";
    console.println(userJS);
    // application level script folder
    try {
    var appJS = 'Application level JS folder: ' + app.getPath("app","javascript");
    } catch(e) {
    var appJS = "There are no defined application level JS folder level scripts";
    console.println(appJS);
    return;
    } // end of JSInfo function
    JSInfo(); // call the function

  • How to call javascript function in back bean of jsf

    hi,
    i am trying to call java script function in back bean but not done. Is there any code for call javascript function in bean file.

    Java runs at server side.
    JSF produces HTML output.
    Server sends HTML output to client.
    Java stops running.
    HTML runs at client side.
    JS starts to run in HTML.
    Clear? Java is a server side language. JS is a client side language. To run JS using JSF, simply print it out to the HTML so that it get invoked when the HTML runs.

  • How to call webservice using jdev9i

    Hi gurus and experts,
    i need to consume a webservice using oaf. with great effort finally i created stub using axis s/w.
    now i dont know how to use the stub in jdev.where to write the code and what to write.iam strucked :-( .
    since there were no sample tutorial about how to call webservice from jdev9i, iam struggling to make.iam jus a starter.
    and while googling i came to know that stubs can be created using jdev9i .but when i see new-->webservices--web service stub it is greyed out.
    i have 2 questions now:
    1)if stub created using axis can it be used in jdev9i? if yes ,please tell me how? any tutorial links also helps me.
    2)if the stubs should be created only by jdev9i so that webservices can be called using jdev,then please guide me how to make it.
    i need some helping hands from u guys.
    Thanks a lot
    Edited by: 881533 on Oct 25, 2011 2:34 AM
    Edited by: 881533 on Oct 25, 2011 2:37 AM

    Hello sir,
    i got following reply:
    <returnRecordResponse  xmlns="http://xyz" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <returnResult>Error_request</returnResult>
    </returnRecordResponse>
    but correct response is
    <returnRecordResponse  xmlns="http://xyz" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <returnResult>Success</returnResult>
    </returnRecordResponse>
    can you tell me correction in the code which i have put on the forum?or tell me other way to call webservice?

  • How to Call Webservicer using Visuval composure Ce 7.1 server

    Hi ,
    We are created in ABAP , they r exposed in WSDL , if i have to call That web services using visuval composure please ASAP can u send , how to call WSDL In CE 7.1 Serve
    Thnks & Regards,
    Suresh

    Hi
    you can try this links:
    http://help.sap.com/saphelp_nwce10/helpdata/en/9f/9985f72084483cb316a3c2322fb090/content.htm
    (here look for the therm Creating Web Service Physical Destinations that points to :
    http://help.sap.com/saphelp_nwce10/helpdata/en/45/635dd614d73bdbe10000000a1553f7/content.htm
    best regards,
    v s
    Edited by: v s on Dec 4, 2008 12:22 PM

Maybe you are looking for

  • Migrating from 8170 to 11g R2

    Hello team, does anybody have the migration path to migrate an 8170 database to 11g R2? Document id 785351.1 talks about migrating from 92 to 11gr2. but i cant find any document to migrate from 8i. Thanks in advance.

  • How to add coloumns in the static text view

    Hello all, I am using answers and I want to use the static text view Now I want to make my own table. I was thinking somthing like this: <TABLE> <TR> <TD> @1 </TD> </TR> </TABLE> Where @1 is the first column on my answer report. Unfortunately this is

  • Problem updaing a GridLayout JPanel

    Problem updaing a GridLayout JPanel What I want to do in the following method is very straight forward. First, I will remove all components inside the namesPanel, then reset the layout and add new things back to the panel. However, now it does not cl

  • Help editing audio

    I'm trying to edit audio in Final Cut and simply want to chop parts of the audio. I'm editing in the Viewer. The audio does not appear in the canvas when I double click. Is there a way to simply chop audio without using Keyframes? Seems like this sho

  • Why report is always select statement...

    hi guys, when we are dragging the columns from Business Area or in any reporting tool, and when we see the SQL, why it gives always select query. this question is raised by one of my manager having 15+ years of experience in Oracle Apps. Any suggesti