[cs3] Pass return values to "do javascript" DID

Hi people,

I bet this has been discussed before, but the search engine is batting 0 today, so...

I have an Applescript script that needs to call bridge and show a dialog to the user of the Script interface. Pretty easy, even for a JS fan like me and I have this part works well. However, I think Miss me something in the JS itself or the way in which I am the appellant As such that I get a value passed in As.

My AS code is something like:

set jsPath to alias "Path:To:Scripts:Folder:slugDialog.jsx"
set slugDialogJSX to ""

--Read the javascript
set thisFile to open for access jsPath without write permission
set slugDialogJSX to read thisFile
close access thisFile

--Do the javascript
tell application "Bridge CS3"
    activate
    set jsResults to do javascript slugDialogJSX
end tell

--Process the results
if jsResults ≠ "" then
    --would do stuff, but jsResults is always undefined!
end if

And loose, my Javascript goes like:

#target bridge

var finalVal = metaSlugger();

function metaSlugger() {
    // do stuff
    return someString;
}

I think I just need to do one last step to get the JS, the return value pass, but I'm getting hung up on JS n00bness here.

If I try 'return finalVal' he complains that I'm back outside a function?

Thanks in advance,

Eric.

Have you read ' of the script return values' article in InDesignCS3_ScriptingGuide_AS.pdf (page 7)?

Tags: InDesign

Similar Questions

  • AppleScript - return value of "do Javascript".

    I am running a JavaScript via Applescript, and I want to return a value to the appellant applescript. When I try the following test:

    Tell application "Adobe Illustrator"

    Set theScript "return"Test ";

    Set theResult do Javascript theScript

    tell the end

    I get a message ' ' illegal 'return' outside the body of a function.

    Is there a way to return a value to the applescript?

    It is, look in the script reference, this is what it says in the VB version, there must be something similar for ACE

    This example returns the number of open documents.


    Set myNumberOfDocuments = appRef.DoJavaScript("documents.length;")

    MsgBox myNumberOfDocuments

  • Pass the value using javascript:modalpage()

    Hello

    Apex 4.2

    I need to know, is it possible to do the following.

    I have 4 buttons on the page as (Suspend, end, restoration, Add) and whenever you press a button and then MODAL_REGION will appear and I m using this javascript:openModal('Open_Page');

    within the action of the button - URL redirect for all the buttons. I did not create DAs for it as I create four DAs for each button.

    So my question is? I can pass the value in the code above. like javascript:openModal('Open_Page'); $s(P6_ITEM1,'S');


    but above does not work. I can just do a few DAs for him but don't want that for all buttons. Thus, when the press "SUSPEND" button hidden point P6_ITEM1 should take the of ' as a value, if the press which ENDED then take 'E' and so on.

    Please advice?

    Thank you very much.

    RI

    Hi Irha10,

    There is no need to use a DA to pass values to it. In the redirect URL

    javascript:$s('P6_ITEM','S');
    openModal('Open_Page');
    document.forms[0].P6_ITEM.focus();
    

    Hope this helps

    Kind regards

    Benjamin.

  • Pass the value to the process of request through javascript

    Hey everybody,

    I am currently struggling with the call to an application process and passing a value to it through javascript. Ideally, my javascript is triggered by a dynamic action, which itself is triggered when a user changes the value of a selection list. Below is the javascript code that is relevant:

    for (k=0; k<active_array.length; k++){
          var request = new htmldb_Get(null, &APP_ID., 'APPLICATION_PROCESS=CAL_COLORS', 0);
          request.add('x01', check_array[j]);
           var ajaxResult = ajax.get();
           alert(ajaxResult);
          active_array[k].parentNode.style.backgroundColor=document.getElementById('P14_TEST_COLOR').value;}
    

    And she calls the application process is also shown below:

    declare
    v_color varchar2(20);
    begin
    select color into v_color from cal_colors where other_user = apex_application.g_x01 and user_id = :USER_ID;
    :P14_TEST_COLOR := v_color
    end;
    

    The issue seems to be that online 03 my JavaScript, especially since my array element is not spent properly in my process. In an attempt to debug this, I added the alert message, however, instead of any relevant information, the alert shows just the HTML page! I'm at a loss as to what I'm doing wrong here, so if anyone has any input, I would very much appreciate it.

    Basically, you need to rewrite in the http buffer, using htp.p:

    DECLARE
      v_color VARCHAR2(20);
    BEGIN
      SELECT color
        INTO v_color
        FROM cal_colors
       WHERE other_user = apex_application.g_x01
         AND user_id = :USER_ID;
    
      htp.p(v_color);
    EXCEPTION WHEN no_data_found THEN
      htp.p('white');
    END;
    

    You could potentially make it much more efficient also. At the present time you loop on what is probably an array of elements, so from a tabular form probably. Rather than call an ajax for each line, you can group together them and make a call.

    Example:

    JS, you can use this to create an array with values to be placed on the server:

    var lArray = [];
    $("input[name=f03]").each(function(){
    lArray.push($(this).val());
    });
    

    And you can use the apex.server.process api to call a process on demand:

    apex.server.process("MYPROCESS", {f01: lArray}, {success: function(pData){console.log(pData);}})
    

    As you can see, the table with the values is put in the table in the f01. You must use the option of success well since it will be asynchronous (htmldb_Get.get is a synchronous call).

    With respect to the CLASS code:

    DECLARE
      l_return VARCHAR2(4000);
    BEGIN
      FOR i IN 1..apex_application.g_f01.count
      LOOP
        l_return := l_return || '"VALUE' || i || '",';
      END LOOP;
    
      l_return := RTRIM(l_return, ',');
      IF l_return IS NOT NULL THEN
        l_return := '[' || l_return || ']';
      END IF;
    
      htp.p(l_return);
    END;
    

    It will loop through the items in the table-f01 and build a new JSON notation and write it back to the http buffer so it returns to the client. It will look like this:

    ["VALUE1", "VALUE2", "VALUE3", "VALUE4", "VALUE5", "VALUE6", "VALUE7", "VALUE8", "VALUE9", "VALUE10"]
    

    I say this because when users use your application, you do not want such a quantity of calls. A single call by treatment action would save a lot of resources. You may have to loop twice on your items to apply your backgroundcolor, but I don't voluntarily not too mention jQuery since you is perhaps not familiar with it and get scared by him.

  • [JS CS4/CS5/CS5.5] How to get the return value from Javascript using doScript

    Hi all

    I'm calling javascript from COM (c#) and it works fine. Passing parameters to javascript and playback by using the syntax of the [x] arguments also works very well.

    What I can't seem to get to work is to know how to move something from javascript to the calling COM Summoner, in this case, c#. How and where should I place the return value in javascript?

    Thanks in advance.

    Rachiud

    doScript() evaluates an expression, so just make sure that your Javascript is an expression.

    For instance "(3 + 3)" 6 "

  • How to pass the value of the item Application Javascript function.

    Hello

    I have the JavaScript in the properties attribute of the HTML Form element

    I'm on page 1 and passing the value of the item page P1_DEPT_NO. It is perferctly working very well and I am able to get the exact value of the element on the page
    onchange="javascript:function1($x('P1_DEPT_NO').value);"
    I'm on page 1 and passing the value G_DEPT_NO of the Application element .
    The problem here is, I don't get the point of Application inside the javascript function value.
    I tried to use alert(); and it gives me the undefined value
    onchange="javascript:function1($x('G_DEPT_NO').value);"
    I just want to know, How to pass the value of the Application in Javascript element.

    Thank you
    Deepak

    Deepak,

    I'm not a Javascript expert, but the suggestin I did was because the javascript is a case-sensitive... language and thats why onChange is not the same thing as onchange.
    Not sure if this is causing the problem.

    Application elements not associated with a page and have therefore no properties user interface.
    So, as mentioned in another post, the rendering would not work for the elements of the application.
    If it is for a single item, used only on this page, you might create a hidden page element and use it fo your goal

    If you want to keep watching objects application and AJAX, this page contains examples of using AJAX to solve problems like the one you mentioned.
    http://www.Oracle.com/technology/OBE/hol08/apexweb20/ajax_otn.htm#T1B

    Thank you
    Rajesh.

  • Pass a value from a PL/SQL function to a javascript (html header)?

    Hey guys,.

    Have a question on how to pass a value of a PL/SQL to a JavaScript function in the HTML header.

    I created a PL/SQL function in my database, which makes a loop.
    The reason is: on my apex page when the user selects a code, it should display (or highlight the buttons) the different project id is present for that particular code.

    example = code 1
    a project id = 5, 6, 7

    code 2
    a project id = 7.8

    Thank you for your help or Suggestions
    Jesh

    The PL/SQL function:

    Contact_details (ACT_CODE1 in NUMBER) of the FUNCTION to CREATE or REPLACE RETURN VARCHAR2 IS
    Project_codes varchar2 (10);
    CURSOR contact_cur IS
    SELECT ACT_CODE, PROJECT
    OF ACTASQ. ASQ_CONTACT where ACT_CODE = ACT_CODE1;
    currec contact_cur % rowtype;
    /******************************************************************************
    NAME: contact_details
    PURPOSE:

    REVISIONS:
    Worm Date Description of the author
    --------- ---------- --------------- ------------------------------------
    1.0 06/25/2009 1. Created this function.

    ******************************************************************************/
    BEGIN
    FOR currec in contact_cur LOOP
    dbms_output.put_line (currec. PROJECT | '|');
    Project_codes: = currec. PROJECT | '|' || Project_codes;
    END LOOP;
    RETURN Project_codes;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHILE OTHERS THEN
    -Consider recording the error and then re-raise
    LIFT;
    END contact_details;
    /
  • Who knows how to pass a value from the form on the next page of javascript?

    I have a simple drop-down list. Maybe this isn't the best way, but I use the MM_goToURL function on the onchange event. It works very well so he can redirect without clicking on the submit button.
    What I need to do, it's pass the value selected on the next page and grab it so I can use Coldfusion to manipulate the results.

    Help, please.

    The answer is too simple. Just use javascript to submit the form onchange.



  • Passing variables ActionScript 2 using javascript

    Hello

    I tried to pass variables to a flashdrive with on the page refreshes. In doing my research I fell I cross things like externalinterface and others.

    I found a javascript + actionscript who spent ariables flashing without updating the code page:

    I have therefore 8 flash with actionscript 2.0.

    HTML:

    <SCRIPT LANGUAGE=JavaScript>

    <!--

    function callJavascript() {}

    Mathias var = inputValue.vars.value

    window.document.myMovie.SetVariable ("testValue", Mathias);

    }

    ->

    < /SCRIPT>

    <object classid=' clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 ' codebase="""http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8, 0,0,0" " " width="550" height="100" id="myMovie" align="middle"> "

    <param name="allowScriptAccess" value="sameDomain" />

    <param name="movie" value="setplay.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffcc00" /><embed src="setplay.swf" quality="high" bgcolor="#ffcc00" width="550" height="100" name="myMovie" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
    </body>
    <p>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=button value="Pass the variable to Flash" onClick="callJavascript()">
    <form name="inputValue">

    <a href="javascript:callJavascript()"> flash one</a><input type="hidden" name="vars" value="1.flv"/>
      </form>
    </html>

    I have a flash drive with a movie player instance name of myVid:

    ActionScript:

    var testValue:String = "";

    watchCallback = function (id, oldval, newval): String {}

    result_txt. Text = newval;

    myVid.play (newval);

    return newval;

    };

    _root. Watch ("testValue", watchCallback);

    The code gets the variable var in the html page. Pass vars to actionscript using javascript, displays text on result_txt and play flv video with similar name to a variable passed.

    The problem is:

    I have several a href links that I would like to have the different variables that they would pass to the flash drive.

    < a href = "javascript:callJavascript ()" > flash < /a > < input type = "hidden" name = "var1" value = "1.flv" / >

    < a href = "javascript:callJavascript ()" > flash two < /a > < input type = "hidden" name = "var2" value = "2.flv" / >

    < a href = "javascript:callJavascript ()" > flash three < /a > < input type = "hidden" name = "var3" value = "3.flv" / >

    < a href = "javascript:callJavascript ()" > flash four < /a > < input type = "hidden" name = "var4" value = "4.flv" / >

    How can I change the code so that if someone clicks on a flash of the value of var1 is passed to flash.

    and if two flash is clicked var2 are passed to Flash.

    Thank you.

    http://circlecube.com/2008/02/ActionScript-JavaScript-communication/

  • Passing a value around JS for element Page JS does not

    I have several lines being generated by the region of PL/SQL code that creates several objects of apex_item. An identifier unique is assigned to each element by adding the line number to a name, i.e. item_nbr_1, item_nbr_2, new_item_1, new_item_2, etc. The item_nbr_n column has a JS that are associated with onChange. Within the JS I get the line number and assign to a variable as in
    <script type="text/javascript">
      function checkItem( pThis ) {
        var l_ndx = pThis.id.substring(9);
       $s('P1115_NDX', l_ndx);
        var l_itemnbr = $v('item_nbr_' + l_ndx);
    .
    .
    .
    This $s ('P1115_NDX', l_ndx); is it so I can keep the line number to view later if necessary. More on that later.

    In the end, if the item_nbr is entered exactly matches one and a single item in our product list, the checkItem function makes a call AJAX to a level application process and passes the value entered in the field item_nbr generated dynamically, through the item_nbr and line number, alias l_ndx. The APA process. then fill other fields of the line identified by l_ndx, such as description, cost, price, etc.

    If the item_nbr is entered corresponds to the first characters more of an element or does not match any at all, the user is presented with an area of search criteria with which they can modify the entered item_nbr and/or add other search criteria. On this area of search, the user also has the option to request that this item be sought by purchases and added to the list of products.

    It all works well so far, with the use of a variety of functions in JS and AJAX calls. The problem is the process of a new element. If the user clicks on the button new item in the search criteria area, I want a JS call to check the new_item_n on the appropriate line. However, at this time I have more the line number to add to the 'new_item_' so that I can "check" the box.

    So, back to the $s ('P1115_NDX', l_ndx); escaped to above. I show the point of P1115_NDX, so I can confirm that the value is used. However, the newItem function does not seem to be able to read the value of the page element:
      function newItem() {
        var l_ndx = $v('P1115_NDX');
    /*    l_ndx = 5;*//* Test for correct operation if the value is hard coded. It works */
        alert("The index of the check box is " + l_ndx);
        $x('new_item_'+l_ndx).checked = true; /* This courtesy of Hari from Trying to Set an APEX_ITEM.CHECKBOX with JavaScript */
      }
    With the hard-coded test line commented, the alert does not return a number and the check box is unchecked. When the test line is not commented, this code works fine.

    Thus, the result is, how should I store and subsequently make reference to the number line which began a series of events?

    Thanks, especially for reading this,

    Gregory

    Published by: Gregory Hansen on October 21, 2010 09:06

    Gregory,

    In your function newItem try to get use of the page variable value

    var l_ndx = $x('P1115_NDX').innerHTML
    

    Based on your statement:

    Gregory Hansen wrote:
    So, back to the $s ('P1115_NDX', l_ndx); escaped to above. I show the point of P1115_NDX, so I can confirm that the value is used. However, the newItem function does not seem to be able to read the value of the page element:

    It seems that P1115_NDX is a display only element so you can see what is happening. In this case the above should work.

    Note that if you switch to a hidden item I think you need to go back to the $v (without the .innerHTML) rating.

    HTH
    Brother

  • How to use the return value of TestComplete (using COM) as a variable in the conditional statement (for example loops) TestStand

    Hello

    I have setup a COM interface for TestStand (TS) to run some scripts in TestComplete (TC).  Normally, when TestComplete has finished executing the script, it returns a 0 or 1 to designate the success/failure during the TestStand step (step test for example String value).  It worked well.

    However, now I need TestComplete to regain a vaule (e.g. 32) TS and TS need to assess this value in a while statement. So if the TC value is 32, I would have some statement in TS ike:

    While (return value! = 30)

    Do something...

    Thank you

    Jigg,

    No, the program does not have a new thread.  It's just a single sequential thread. She called other sequential files, and that's all.

    I think I'll have some luck with the StationGlobal.  It seems to work (for example by setting the StationGlobal a single sequence file automatically updates the Stationglobal in another movie file, sort of like passing the reference value)

    Thank you!

  • Use the return value to do step digital multiple success or failure

    Hello

    I use a multiple digital step to check several measurements by an external DMM through a function created in CVI.  I would like to use the return value of the function to replace the global status of the step. The reason is that the return value indicates a communication error, while steps are being taken, and which would lead to a "fake" fake or false 'Pass '.

    What I would do is more or less this >

    If the return value is 0, then check if the measuremets are between the limits

    If return value! 0 = there was a communication error so step continues to operate independently of the measure.

    I tried combining multiple digital step with a step of pass/fail, but it does not work.

    I also trie to change the expression of the status of the multiple digital steps but basically ignores him.

    Any ideas?

    Thank you

    Javier

    Why don't you just make that return the value limits for multiple numerical limit stage.  Comparison of the EQ value and the low limit to 0.

    That would make the most sense.

  • How to return values in calls to subsequence?

    I want to call a sous-suite. I pass parameters to this subsequence but I want too return values. Is it possible to return values other than using globals?

    -Pat

    Hello

    You can set the parameter as "pass by reference". Right mouse click on the setting you are interested in and you will find this setting.

    Concerning
    Ray Farmer

  • Waterfalls by passing the value between QML

    Hi, I have the main.qml with a display list, on, click on any element of the display of the list, I want to pass the value to another QML which is a leaf to change or remove, I followed what is on the tutorial to use the alias property to the second page to set the alias for the fields that I want to access another page and have the main.qml to create the object in the worksheet and assign value and open. Right now, it's say those alias not found. Here is the excerpt code sheet QML import bb.cascades 1.0 sheet {id: content newEventSheet: Page {id: addEventPage... eventNameText.text = ' '; eventTimePicker.value = eventTimePicker.dateFromTime("00:00:00"); newEventSheet.close (); mainObj.addData (eventName, selectedHour, selectedMinute, selectedSecond);}} Container}}} {layout: StackLayout {orientation: LayoutOrientation.TopToBottom} container {container {layout: StackLayout {orientation: LayoutOrientation.LeftToRight} leftPadding: 20.0 topPadding: 50.0 bottomPadding: 50.0 Label {text: preferredWidth 'Event name': 200.0} TextField {property alias txtEventName: eventNameText id: eventNameText hintText: preferredWidth 'Enter event name': 500.0}} container {layout: StackLayout {orientation: LayoutOrientation.LeftToRight} leftPadding: 20.0 Label {text: preferredWidth "Event time": 200.0} DateTimePicker {property alias pickEventTime}}} {{: eventTimePicker id: eventTimePicker mode: DateTimePickerMode.Timer minuteInterval: 1 preferredWidth: 500.0 onValueChanged: {}}} hand QML Container {id: eventListContainer ListView {id: eventList dataModel: eventsModel / / use a ListItemComponent to customize the appearance of the list function itemType view (data, row) {console.log ("Calling itemType:" + row);}}} return "item"; return (indexPath.length == 1? ("head": "item"); } listItemComponents: [ListItemComponent {type: 'the point' StandardListItem {title: "event:"+ ListItemData.EventName; "}}] Description: "time:" + ListItemData.EventHour + ":" + ListItemData.EventMinute + ":" + ListItemData.EventSecond ;}}] "." onTriggered: {console.log ("Calling onTriggered:" + row);} var selectedEvent = dataModel.data (row); var eventDetailPage = eventDetailDefinition.createObject (); eventDetailPage.txtEventName.text = selectedEvent ['EventName']; eventDetailPage.pickEventTime.value = picker.dateFromTime(selectedEvent["EventHour"]+":"+selectedEvent["EventMinute"]+":"+selectedEvent["EventSecond"]); eventDetailPage.open (); }} the device connect by default to the 14:44:50.432 com.example.IntervalTimer1.testDev_ervalTimer1a7a2c2e2.11214974 may 28 9000 REVIEWS asset:///main.qml:122: TypeError: result of expression 'eventDetailPage.txtEventName' [undefined] is not an object. Can someone help me? Thank you

    Have you tried to put the alias property in the root of the sheet in the TextField?

  • How can I pass a value to a variable binding in a report query?

    I did a query of report to print a PDF report, with a dinamyc source query that has a connection variable, like this:

    SELECT EMPNO, EMPNAME, EMPDEPT

    FROM EMP

    WHERE EMPNO =: PARAMETER;

    I want to call the report print directly from a page, by using the url print showed by apex:

    f? p = & APP_ID.:0 : & SESSION. : PRINT_REPORT = MYREPORT

    How can I pass the value of the variable binding: PARAMETER using this URL?

    I don't think you can use the url parameter passes in a report query.

    the binding variable: PARAMETER must be a page element or an element of the application.

    use the "include session information and application" in the defination of report query to bind the value when the report is run

Maybe you are looking for