[JS IDCS5] Reading attribute values to specify Image options

Hello

I want to read the values of imported XML attribute to specify the image adjustment options:

# include "glue code.jsx"

main();

function main(){

if (app.documents.length != 0){
var myDoc = app.activeDocument;
var myRuleSet = new Array (
new findObjAttribute("//*")
);

with(myDoc){
var elements = xmlElements;
__processRuleSet(elements.item(0), myRuleSet);
}
}
else{
alert("You have no document open!");
exit();
}


function findObjAttribute(XPATH){
this.name = "findObjAttribute";
this.xpath = XPATH;
this.apply = function(myElement, myRuleProcessor)
{
with(myElement){
try {
var Name=myElement.xmlAttributes.itemByName("fit").value;
         myGraphics = app.documents[0].allGraphics;   
         if (Name == "frameToContent") {  
         for (i = myGraphics.length-1; i > -1; i--)
         myGraphics[i].fit(FitOptions.frameToContent);
         } 
         if (Name == "proportionally") {
         for (i = myGraphics.length-1; i > -1; i--)
         myGraphics[i].fit(FitOptions.proportionally);
         }
         if (Name == "centerContent") {
         for (i = myGraphics.length-1; i > -1; i--)
         myGraphics[i].fit(FitOptions.centerContent);
         }
     } 
catch(e){};
}
return true;
}
}
}

This script is looping al xml attributes named "worthy" and get the values of it. It then applies the fitOptions of the last value of the attribute on all images in the document.

Now I want the loops of the two attributes, and images go to loop at the same time, so that each image get it's own fitOptions!

Best regards, Sjoerd

Hi Storeee,

I checked in my js code its works very well, I use the Mac ID CS4 version.

If you want to using PC you can change the text of the string CheminMonFichier for correspondents 'glude code jsx '.

Please check and let me know.

#target "indesign - 6.0.
CheminMonFichier = "" / rules/Applications/Adobe InDesign CS4/Scripts/Xml/glue code.jsx ""
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
var myFile = File (myFilePath);
app.doScript (myFile);

If (app.documents.length! = 0) {}
myDocument var = app.documents.item (0);
var myRuleSet = new Array (new anchor);
{with (myDocument)}
var elements = xmlElements;
__processRuleSet (Elements.Item (0), myRuleSet);
}
}
else {}
Alert ("no document open");
}

anchor() {} function
myIdName = 'image ';
This.XPath = "/ / image";
This.Apply = function (myElement, myRuleProcessor) {}
{with (MyElement)}
myName = myElement var .xmlAttributes .itemByName ("fit") .value;
App.Select (MyElement);
try {}
app.menuActions.item ("Go to Item") .invoke ();
} catch (e) {};
If (myName == "frameToContent") {}
App.Selection [0] .fit (FitOptions.frameToContent);
}
Else if (myName == "proportionally") {}
App.Selection [0] .fit (FitOptions.Proportionally);
}
Else if (myName == "centerContent") {}
App.Selection [0] .fit (FitOptions.centerContent);
}
App.Selection = null;
}
Returns true;
}
}
Alert ("Done");

THX,

csm_phil

Tags: InDesign

Similar Questions

  • Read attribute values of criteria see the Date in ViewObjectImpl

    Hello

    I have a View object and have added a view Criteiria that has a bunch of search items added to it. I also added a Date column to the criteria for the view that has the "between".

    Now, I'm reading all the Research Articles coming from the JSF page (query Panel + table). When I try to read the date column it give me only the first Date (what date). How can I get the date 'To' too?

    ViewCriteria vc = this.getViewCriteriaManager () .getViewCriteria ("ReportVOCriteria");

    The list l = vc.getRows ();

    VCR = (ViewCriteriaRow) l.get ViewCriteriaRow (0);

    String myDate = vcr.getAttribute("MyDateColumn").toString ();

    This code could give me a single value, how do the two values 'From' and 'To '?

    JDev 11.1.2.4

    Check the api ViewCriteriaRow (Oracle Fusion Middleware Java QAnywhere for Oracle ADF Model)

    First try to call ViewCriteriaRow (Oracle Fusion Middleware Java QAnywhere for Oracle ADF Model)

    getCriteriaItemArray and check the table to display the elements of criteria. If you get only one item for him between the criteria, check the element by calling the getValues method ViewCriteriaItem (Oracle Fusion Middleware Java QAnywhere for Oracle ADF Model) which should give you all the values.

    Timo

  • Read the values of luminance of the image

    Hello

    I would like to create a plugin that changes the saturation of an image based on luma values, similar to the curve of Lum VS Sam of Davinci resolve.

    How to read the values of luminance of an image? I couldn't find any image manipulation methods in the SDK, but maybe I'm in the right place.

    Thank you

    To attach the Lum VS DR Sam curve.

    lum_vs_sat.png

    The SDK API won't let you change individual values in pixels, i.e. what, I should change the saturation of a pixel from its brightness.

    The SDK lets you change even develop settings can be changed in the UI (for example an exhibition), via picture: applyDevelopPreset (), the:applyDevelopSettings() papers and LrDevelopController photo.  But none of the sliders in the user interface let you accomplish your purpose, if you can not do with the SDK.

    You can write an external editing (for example in C++ or Swift) application which provides such a feature TIFF.  You would be it interface to LR as a 'external editing plugin', as the Nik plugins.   But I don't think that's what you think.

  • How to read the value attribute and put inside?

    What happens if we want to read the attribute value? And want to put the data of runtime on the value of the attribute as

    < psoID ID = "user id" / >

    How to get the value of the ID as the user id. And how to put the run value on it?

    I can think about is that

    /psoID/@ID/value GOLD psoID/@ID/*[local-name () = 'value']

    And how to put the value inside ID ="? »

    Thank you

    Because we are dealing with a structure of type anyType you must use the functions of node (local name) in combination with predicates ([]) to read or write values (node) of the element:

    To read the value for example use the copy rule:




    This wil read:

    /processResponse/result/psoID/@ID

    on the message:





    You will see the value 'B '.

    To write, you use:




    Kind regards

    Melvin

  • How to read the value of the attribute XML using DBMS_XMLSTORE

    the following xml data

    + < ROWSET > +.
    + < ROW > +.
    + < > 2290 EMPNO < / EMPNO > +.
    + < SAL > 2000 < / SAL > +.
    + 31 December 1992 of < HIREDATE > < / HIREDATE > +.
    + < TYPE > +.
    + < ENO > 123456 < / ENO > +.
    + attr_name < ENAME > < / ENAME > +.
    + < / TYPE > +.
    + < / ROW > +.
    + < / LINES > +.

    The above XML data stored underneath table of the object using DBMS_XMLSTORE

    CREATE or REPLACE TYPE typ_dummy AS OBJECT
    (
    ENO NUMBER,
    Ename VARCHAR2 (100)
    );

    CREATE TABLE EMP
    (
    EmpNo VARCHAR2 (25).
    SAL NUMBER,
    HireDate DATE,
    Typ typ_dummy
    );


    DECLARE
    insCtx DBMS_XMLStore.ctxType;
    lines NUMBER;
    xmlDoc CLOB: =.
    ' < ROWSET >
    < LINE number = "1" >
    < SAL > 1800 < / SAL >
    < > 7369 EMPNO < / EMPNO >
    < HIREDATE > 27 August 1996 < / HIREDATE >
    < / ROW >
    < ROW >
    < > 2290 EMPNO < / EMPNO >
    < SAL > 2000 < / SAL >
    < HIREDATE > 31 December 1992 < / HIREDATE >
    < TYPE ENO = ENAME "123456" = "attr_name" / >
    < TYPE >
    < ENO > 123456 < / ENO >
    attr_name < ENAME > < / ENAME >
    < / TYPE >
    < / ROW >
    < / LINES > ';
    BEGIN
    insCtx: = DBMS_XMLStore.newContext ('emp'); -be saved context
    lines: = DBMS_XMLStore.insertXML (insCtx, xmlDoc);
    DBMS_XMLStore.closeContext (insCtx);
    END;



    but I don't know if the XML contains the attribute values for particular node means how to insert in the table (assuming the creation of the structure of the table)


    + < ROWSET > +.
    + < ROW > +.
    + < > 2290 EMPNO < / EMPNO > +.
    + < SAL > 2000 < / SAL > +.
    + 31 December 1992 of < HIREDATE > < / HIREDATE > +.
    * + < TYP ENO = ENAME "123456" = "attr_name" / > + *.
    + < / TYPE > +.
    + < / ROW > +.
    + < / LINES > +.

    You can declare the type of object like this:

    CREATE OR REPLACE TYPE typ_dummy AS OBJECT (
      "@ENO"   NUMBER
    , "@ENAME" VARCHAR2(100)
    );
    /
    

    Oracle will know that XML attributes must be mapped to attributes of the object.

    But personally, I would not use DBMS_XMLSTORE:

    INSERT INTO emp (empno, sal, hiredate, typ, eno, ename)
    SELECT empno, sal, hiredate, eno, ename
    FROM XMLTable('/ROWSET/ROW'
           passing xmltype(xmlDoc)
           columns empno    varchar2(25)  path 'EMPNO'
                 , sal      number        path 'SAL'
                 , hiredate date          path 'HIREDATE'
                 , eno      number        path 'TYP/@ENO'
                 , ename    varchar2(100) path 'TYP/@ENAME'
         )
    ;
    
  • "Error 0xBFF69012 attribute value is out of range" for Point Grey Grasshopper2 GS2-GE-50S5M

    Try to get the camera above to work at MAX. Running on LabView 2010 SP1 with Vision Acquisition software August 2010.

    Errors illustrated: error 0xBFF69012 attribute value is out of range

    Camera works perfectly well on the supplied software advanced Grey. Point Grey Image Filter Driver installed. Turned off the Windows Firewall. Card (http://www.sonnettech.com/product/prestogigproec34.html) Ethernet supports Jumbo Frame.

    Read through the following measures without result:

    http://digital.NI.com/public.nsf/allkb/FCE7506A3AF7636C862576240072716D

    http://digital.NI.com/public.nsf/allkb/A0A1CE4704265BF2862578CA007A4CF8

    How will I know if there is a problem with the XML file?

    What are the possibilities that this device is not compatible with IMAQdx?

    Thank you.

    Problem solved in new firmware version 1.25.3 - 00.

    Contact Gray Point to this firmware.

  • read the value of the item page after filling value pop-up window

    I can't read or insert and also I cannot perform dynamic action of a page element data after the filling of the data page of the window popup (pass back to the point of the page). But I can read and insert, perform a dynamic action data while filling in the data using ajax and PLSQL code...


    How to read the value after the filling of database page popup window?


    SKUD

    Set value using Javascript is that in your browser page but is not yet available in the session. This is why the report does not return the expected results.

    Before you refresh the report, you need to set the session state from this point.

    You can configure after assigning a new value or before the report is updated to the element
    For interactive reports, is available built in
    You can go to report attributes > attributes advanced-> Page elements to submit and specify P2_X1 for the field (and any other page element that depends on the report)

    For standard reports, you can create a dynamic Action that is triggered 'before updating"report region, select PLSQL as action types, give a code BÉGIN END NULL; model and specify the name of the item in the item page to submit the field so that it affects the value of items in the session.

  • How to read the value of an independent textInput element inside the method?

    Hello

    I had a group of detail based on a readonly viewobject. I added an independent element textInput, you say, EndDate to this group that the user can enter a value inside. Now, when I run the app I select a row in the table and press a button that triggers a method inside a bean. My question is how I read the value in independent textInput (EndDate) within the method element?

    getTable () .getRowData () does not print the unbound attribute. It seems that it only contains attributes underlying viewobject

    I use JDev 11.1.1.4

    Kind regards
    Will do

    Will do,

    You can better create a transitional attribute for that in your view object, so you can use a regular expression #{row.bindings...} to get the value.

    Steven Davelaar,
    JHeadstart team.

  • Loading of attribute values

    Hi all

    Can someone please guide me how can I load a sparse dimension attribute values in a typical application. I'm on 11.1.2.0.

    Thanks in advance.

    If you do not specify the path and planning assumes that the .csv exists at Oracle\Middleware\user_projects\epmsystem1\Planning\planning1.
    You will get this error if:
    1. name of the specified file is incorrect,
    2. or the file is not present in Oracle\Middleware\user_projects\epmsystem1\Planning\planning1, if this is the case paste the file at that location or specify the absolute path of the .csv file

    ar_aff wrote:
    Just for reference, we use the following command "/ a: /DA [T] U:admin: Category:Entity I:ATT.csv OutlineLoad.cmd.

    If hyplive2 is the name of the Application and ATT.csv is in the same place then use:
    OutlineLoad.cmd A:hyplive2 U:admin /DAT:Category:Entity I:ATT.csv

    * Ensure that you saved the file under the name of ATT.csv not ATT.csv.txt.

    See you soon... !!!

  • How to read the value of request Http of the filter of the UCM?

    We have an application web connect to the Complutense University of MADRID. I would add some values to the request sent to the Complutense University of MADRID by this application. This value will be read by a filter of the Complutense University of MADRID, I created.

    What is the value of HTTP servlet can be read the filter of the UCM? is it possible to do something like:
    request.setAttribute ("myAttribute", "theValue")

    and retrieve myAttribute UCM filter value?

    Thank you

    AACC,

    When you rexternal application makes the call to the Complutense University of MADRID, all URL parameters or attributes of the request transformed into data variables Local to the Complutense University of MADRID.

    When you create your filter (if all goes well we are talking about the same thing here that filters means something special to the University Complutense of MADRID) you write Java Code. In this Java Code, you can access 'the query' attributes/values with code like this:

    String myval = m_binder.getLocal ("MyKey");

    Your mileage may vary, but this is the Basic code for out, review and/or use the query parameters.

    -Jason
    http://www.corecontentonly.com
    http://www.redstonecontentsolutions.com

  • reading inputbox value application in J dev 11R2 JSF userinterface

    There is an article (no base show all objects) in our JSF page and we want to read its value.
    It gives a because null pointer exception that the element value not read of bean support.

    our code as follows.

    < af:commandButton text = "Cevapla."
    Binding = "#{backingBeanScope.backing_app_yeniEvrak.commandButton24} '"
    ID = "commandButton24".
    action = "#{backingBeanScope.backing_app_yeniEvrak.Cevapla} '"
    immediate = "true" / >

    public String cevapla() {}
    Add the code in the event here...
    Yil string = (String) getInputText15 () .getValue ();
    String evrakNumara = (String) getInputText16 () .getValue ();
    int evrakLength = evrakNumara.length ();


    Thanks for your help.

    The inputText has immediate = "true" as well? I think you have to do all the components accessible by buttons of immediate order immediate as well.

    I'm not too sure that you must link a component (using the 'binding' attribute) to a support for this bean. Why not just a 'value' of the inputText a bean managed value? And do really anything other than property 'action' of the control button, bind what you showed.

  • UI Scripting - attribute value

    Is it possible to get an attribute value when UI scripting?

    Using accessibility Inspector, I see an accessibilityVisibleRows attribute in an AXOutline element, but I don't know how to get their hands on it.

    As a first step, try statements like those below, one at a time:

    say application "System events".

    say process of 'Finder '.

    attributes of Diagram 1 of ...

    the attributes name 1 of ... outline

    the attributes value contour 1 of ...

    value of attribute [attribute name] 1 of ... outline

    end say

    end say

  • How to read the value of list boxes by iteration in a loop For?

    I have a lot of list boxes on the front of my VI. I want to know how to read the value of this combo with a loop boxes For. The point is that I don't know how to get the reference of each combo box in a loop.

    Any information would be welcome. Thank you!

    su27 wrote:

    I have a lot of combo boxes on the front of my VI [...]

    Be sure to close the references that you have finished with them.

  • Cannot read every value of the loop iteration for

    Hiiii...

    I developed a front-end which reads the values of serial port and display on the front panel.

    16 channels, which is a string data value. I've separated this string to read the data of each channel, but at the end of the loop for, I can read data only one channel for an iteration, and also I have to store each value iteration in a text file.

    I'm new to labview. Help, please. I have LabVIEW 8.0.

    Attached is my application code.

    This seems quite inefficient. Why don't you use a business structure? Why don't post it your code.

    In regards to the original code, you try to run by using the run continuously? I ask because I do not see a global loop, so it was not clear whether this was intended to present itself as a simple Subvi or "on-demand". If it's supposed to run continuously until you stop, DO NOT USE CONTINUOUSLY RUN it BUTTON. Use a while loop in your VI. Do not forget to place the initialization and close outside of the loop - you don't need to initialize and close the serial port whenever you loop around.

  • Read channel values

    Hello world

    I have a very common problem. In a SOUTH dialogue box, I load and display channels in a channel-drop-down list box. If everythings perfect so far, but I have a few text strings and I text entries whose length can vary, but I can't understand how to display the text string values in a drop-down list box, after that the corresponding text string is selected. It can be very simple, if there is a command which is sth like "read channel values. I got an idea, which is a lot more time, I can create a dynamic table and use a drop-down-list list box - but I'm in kind of a hurry. So if you have an idea about it, I'll be very grateful.

    Thanks in advance

    Hi fscommand.

    I don't know if it might be useful for you, but if you want to write or read the text values of the channels is a command called CHT.

    For example: reading MyText = CHT(3,"Group1/TextChannel")

    writing for intLoop = 1 to 10 CHT (intLoop, MyChnName (0)) = 'Value' & Next intLoop //for loop writes the values

    Greg

Maybe you are looking for

  • reset password but still open Mac Book Pro

    I forgot the password for my Mac Book Pro.  I have reset my password account iCloud and can't access the account and ping from the laptop through the find my iPhone utility but still get an error saying cela "this account uses an iCloud password to l

  • problem syncing icloud photo library

    Hello I rearrange the folders and photos on my iMac. When I opened my ipad or macbook pro, I see without any photo folders. I understood that rearranged folder and photos in iMac, are mirrored. That is why only created folder shown in other devices.

  • How can I move photos &amp; video library?

    How can I move a few photos and some video clips from one library to another library? I created 2 libraries and want to better organize my photos and videos by moving a selection of photos and videos of the first library in my second library. How can

  • NH-1005 ver 2.2 hub allows you to restore the default settings

    OK, I have a worm hub 2.2 NH 1005 that I used a little more than six months, and I need your advice on restoring the default settings. the web-based configuration page can be accessed through 192.168.2.1 on IE, but my step son was trying to fix the n

  • failure of compression Windows vista

    I have to reduce the files to fit in an attachment to a CV when I followed the instructions of ussual, in the zip file, my file reduced only by 1-2 kb. and it still does not fit into the file to send.  Help, please