If another script based on the relationship between the height of the document to the width

Sorry I don't know almost nothing about the PS scripts. But, this is my cry for help

I have an 'IF' / 'ELSE' script. Who does something like this...

If

the height of the document to the width ratio is greater than 4:1, then run photoshop action #1

on the other

run the photoshop #2 action.

I want the lot of hundreds of images which are all different sizes and certain tasks must be accomplished if the height report and the width is too important.

I don't check this, but something along these lines should work.

var doc = activeDocument;
if (Math.max(doc.width,doc.height)> 4*Math.min(doc.width,doc.height)){
    //code for action 1
    }
else{//code for action 2
    }

Tags: Photoshop

Similar Questions

  • Script based on the font size

    Trying to figure out if I can implement a conditional script based on the size of the font of a text layer.

    For example, if the font is 10 pt then _, 12 pt then _, 14 pt then___.

    Is it feasible with scripts?

    Thank you

    Tim

    If you use more than one if else statements, you can do it. You can either have a range with each if statement or a cascade range.

    var doc = activeDocument;
    var dL = doc.activelayer;
    var textSize = dL.textItem.size;
    
    //using range if:
    
  • Basic conditional script based on the number of lines in a text layer?

    Just received help here to write a conditional script by using the font size of a text layer. Thank you all for this.

    The next hurdle is a conditional script using the number of lines in a text layer in the differential. Far as I can tell it not the layer details which specify the number of lines. Just '\r' for a return in the idTxt descriptor. Nothing seems to stand for a soft return as far as I can tell. I'll probably have to be able to count the lines with soft and hard returns.

    Any thoughts?

    I was playing around with this a bit and here is a small script to determine the number of rows. This is based on the self in the head, that I calculated to environ.108 times the size of the font.

    #target photoshop
    app.preferences.rulerUnits = Units.POINTS;
    var doc = activeDocument
    var tL = doc.activeLayer
    var h = tL.bounds[3]-tL.bounds[1]
    var per = ((h/5)-(tL.textItem.size))/tL.textItem.size
    var num = h/(tL.textItem.size *1.108)
    
    alert(Math.round( num))
    
  • Amount import the script based on the entity

    I have a data file of local currency with all my features in there. However, because of the way that SAP stores one of the currencies that I need several amounts for a single entity by 100. I have attached the script below in the field amount in the import format, but I'm not having any luck. I know there is not something which only escapes me on the StrEntity variable. Any help would be greatly appreciated.


    Function XAFcurrency (strField, strRecord)

    If StrEntity = "7771.

    XAFcurrency = StrField * 100

    On the other

    XAFcurrency - StrField

    End If
    End Function

    You must analyze the strRecord with the fParseString command or split command before testing the value of the entity.

    For example, your files contain 12 fields delimited by tabs and 10 is the field of the entity. You can then use the following:

    If DW. Utilities.fParseString (strRecord, 12, 10, vbTab) = "7771" Then
    XAFcurrency = StrField * 100
    On the other
    XAFcurrency = - StrField
    End If

  • shell script to determine the width of the file, size, resolution cs5 js

    I use a Script of Michael L Hale (core.quickMetadata "that uses" xmp.getProperty "and the bridge") to determine the size and the resolution of files without having to open or place.

    Unfortunately, it fails with some files (non-Photoshop generated bitmaps, seems).

    (PDF, I treat differently altogether to avoid the problem determination pages pdf counties and potential problems with PDFs containing different size pages.)

    "None of you do not know if and how you can reach resolution with" app.system "in CS5, the height, the width of the files?

    I may have come across before, but is unable to locate such a thread currently.

    Thanks for any input.

    The following 2 options that you can use if you want to clear all information in text file then analyze js. You could see if one of these contain the data that you are after?

    #target bridge
    
    var foo = File('~/Desktop/SomeFile.tif');
    
    getAllXMLSIPS(foo);
    
    //getMetaDataMDLS(foo)
    
    function getAllXMLSIPS(f) {
         if (f instanceof File && f.exists) {
              var shellString = "sips --getProperty allxml ";
              shellString += f.fsName;
              shellString += ' > ~/Documents/StdOut.txt';
              app.system(shellString);
         }
    }
    
    function getMetaDataMDLS(f) {
         if (f instanceof File && f.exists) {
              var shellString = "/usr/bin/mdls ";
              shellString += f.fsName;
              shellString += ' > ~/Documents/StdOut.txt';
              app.system(shellString);
         }
    }
    
  • calculation script based on the value of a radio button

    I wonder if anyone can give me help. I'm doing a calculation script that I can insert in a number field that will calculate only when a radio button is checked. I'm doing an estimate sheet when some check boxes or radio buttons are selected (such as the moving of furniture, pulling up old flooring), it will calculate a supplement based on this selection. Any help would be appreciated.

    Hello

    Paul is right, it's probably something small that is causing the script to fall. Make sure that the things you talk about in your script are correct (to the right name and the full reference in the event of different subforms).

    There is also a syntax button to tick at the top of the script editor. If you click this button, he can identify the problem.

    In which case it might be useful, here is a sample: https://acrobat.com/#d=bUfCkHbTaU0 * GD6Y7pv41w

    Good luck

    Niall

  • How to set the width of the column based on the width of header?

    I have a column that will contain only 1 character. It's good, but I want that column width to match the column header.

    For example,.

    Currently, I get:

    Select * from table;

    I NAME
    - ---------
    1 ROBERT

    The problem is, I want the column heading set out (in this case, it's just the ID)

    ID NAME
    -- ---------
    1 ROBERT

    Better yet,.

    If I did:

    Select the ID "Identification NUMBER", "FIRST NAME" of table name;

    I want to see:

    ID NUMBER NAME
    --------------- -----------------
    1 ROBERT

    (The ID in the column width of centering would be good too, but it's "sauce")

    Any thoughts? I tried:

    FORMAT ID COLUMN A10 (which obviously didn't work!)

    Thank you

    KSL.

    Published by: leonhardtk on August 23, 2010 11:55

    Hello

    You can check [SQL Reference | http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/functions093.htm#SQLRF00663] for syntax.

    SELECT LPAD('A', 10) FROM DUAL;
    
  • Fill a combobox based on the selection of another

    Hi all

    I have a combobox that is filled dynamically. I want to fill an another combox based on the selected item in the combobox first. I use PHP to manage the connection to the database. The drop-down list box cbDivision fills very well.

    Can someone point me in the right direction?

    Here is my code:
    [Bindable]
    public var selectedItem:Object;

    [Bindable]
    private var datalist: ArrayCollection collection;
    private void resultHandler(event:ResultEvent):void {}
    DataList = event.result.data.row;
    }
    [Bindable]
    private var datalist2:ArrayCollection;
    private void resultHandler2(event:ResultEvent):void {}
    Datalist2 = event.result.data.row;
    }

    "" < mx:HTTPService url = " http://127.0.0.1/getDivisions.php"
    ID = "xmlGetDivisions".
    showBusyCursor = "true".
    result = "resultHandler (Event)" "
    method = 'GET' / >

    "" < mx:HTTPService url = " http://127.0.0.1/getFacilities.php"
    ID = "xmlGetFacilities".
    showBusyCursor = "true".
    result = "resultHandler2 (Event)" "
    method = "POST" >
    < mx:request xmlns = "" >
    < DivisionValue >
    {selectedItem.Division}
    < / DivisionValue >
    < / mx:request >
    < / mx:HTTPService >

    "< mx:ComboBox ="116"x ="60"id ="cbDivision"editable ="false"active = 'true' prompt = 'Please select' close ="selectedItem = ComboBox (event.target) .selectedItem, xmlGetFacilities.send ();"initialize =" getDivisions () "dataProvider ="{datalist}"= 'Division' labelField >
    < / mx:ComboBox >

    < mx:ComboBox = "413" x = "60" id = "cbFacility" editable = "false" enabled = "true" initialize = "xmlGetFacilities.send (); ' prompt = "Please sΘlectionner" dataProvider = "{datalist2}" labelField = "Name" > < / mx:ComboBox >


    Thank you in advance!

    No need to answer. I have it working now. It turns out that it was a problem with my PHP code.

  • Navigation based on the input textfield value?

    Hi all.

    I use Captivate4. In my project, I would like to navigate from one slide to another slide based on the value entered in the input textfield (as if as a drop down menu).

    slide1.jpg

    The image shows, if the user enters the values, it must navigate to slides respectively. So, I got a tip in this way action.

    actions-dialog.jpg

    Hello

    Welcome to the Adobe Forums,

    In order to reach the workflow that you specified in your post that you need several "check if ' for all defined slides the tip on the button click Action.

    For Ex.

    For "a" TI will look like this:

    Because if "two" will look like this:

    Rest allows you to change the variable, just make sure that these all will be on this same script for a button

    It could be useful!

    Thank you

    Vikram

  • Order based on the particular values

    Hello

    Here is an example of data from the table I,

    ID CAT_DESC OVERDUE_DAYS

    1 DEPOSIT 45

    1 DEPOT 48

    10 FT 30

    10 FT 40

    10 FT 50

    1 DEPOSIT 40

    2 45 LOAN

    2 43 LOAN

    2 LOAN 40

    My request here is to show records with CAT_DESC = "Pi" FIRST and then sort the another recordset based on the OVERDUE_DAYS DESC.

    I tried the query below and I do a sort, showing all records in FT first with overdue_days desc, and other records also sorted by the column ID of the rest...

    Select * from test_order

    order by case when id = 10 then 1 else 2 end, id, overdue_days desc;

    The result retrieved is

    IDCAT_DESCOVERDUE_DAYS
    10FT50
    10FT40
    10FT30
    1DEPOSIT48
    1DEPOSIT45
    1DEPOSIT40
    2LOAN45
    2LOAN43
    2LOAN

    40

    BUT THE RESULT I WANT IS

    IDCAT_DESCOVERDUE_DAYS
    10FT50
    10FT40
    10FT30
    1DEPOSIT48
    1DEPOSIT45
    2LOAN45
    2LOAN43
    1DEPOSIT40
    2LOAN40

    Help, please... Is this feasible?

    .. Deleted...

    Try

    Select * from table_t

    order by case when id = 10 then 1 other end null, overdue_days desc, cat_desc

  • In: toggle a field based on the State of a checkbox

    Hi all
    I have a tabular form on a single table. The table has a Y/N column type. So to see this checkbox column I followed excellent tutorial http://www.inside-oracle-apex.com/checkboxes-in-tabular-forms-the-easy-way/ Patrick

    It works very well. But now I also want to turn another field based on the question of whether this check box is checked or not. To do this, I followed another post on how to do it and it also works. But the problem is when I try to save the form, I get the dreaded MRU error.

    Tabular form fields
    NAME, SALARY, ACTIVE

    NAME-> Normal text box
    SALARY-> I want this field to be enabled/disabled based on the value of the last column ENABLED_CHECKBOX
    ENABLED_CHECKBOX-> it's a checkbox (created by following the tutorial of Patrick)

    What I did to make SALARY toggle dynamically (it works, but I get error MRU registration)
    Change ENABLED CHECKBOX_
    ENABLED_CHECKBOX-> This is a standard report with the following HTML Expression field:
    "< pre > < input type ="checkbox"#ENABLED_CHECKBOX # value =" "#ROWNUM #" name = "f40" id = "f40_ #ROWNUM # ' class = 'MyClass' / > < / pre >


    Additional dynamic action
    WHEN = change event
    Selection type = jQuery Selector
    JQuery Selector = .myClass
    Condition = no requirement

    Real Action = run Javascript

    Code =
    < pre >
    column_2_id = "f02_000" + $(this.triggeringElement).attr('id').substr (4);

    If (.attr ('checked')) $(this.triggeringElement)
    {
    $("#"_+_column_2_id).attr ("disabled", "disabled");
    }
    on the other
    {
    $("#"_+_column_2_id).attr ("disabled", false);
    }
    < / pre >

    Sylvie,

    You must reactivate the fields before being submitted, because the disabled fields are not subject at all - and that throws what APEX collections uses tabular forms. See my post here.

    Short version: use something like this as an action dynamic javascript before submitting the form:

    $('input:disabled').attr('disabled',false);
    

    -David

  • How to assign the field width based on the screen wdth

    I have my ownfield, I'm adding to the screen, or the Manager

    I want to give the height and the width of field based on the width of Manager screen, when I try I got errors.

    the code I used is

    Field ff;
            int j=(Display.getWidth()>360?4:3);
            int compwid=Display.getWidth()/j;
            int compht=40;
            int posx=0,posy=0;
            int no=this.getFieldCount();
    
            for(int i=0;i
    

    When I do cela in the display main () sublayout, I get the error as "the field is not a child of this Manager.

    Similarly when I add to the Manager sublayout, I get as field must call setExtent and setPostion for available.

    Where I'm going wrong?

    You can help with that.

    Concerning

    Rakesh Shankar.P

    Hi guys, I was able to get this working, pblm is that I called super.sublayout () just before the Codes I have describd in the previous post.

    Concerning

    Rakesh Shankar.P

  • How can I resize an iframe in apex based on the amount of available space on the screen with a button

    Hello.  I have a request to 4.2.2.00.11, llg Server Oracle apex.  The conditions for this application are to hide and display a navigation bar by clicking on the buttons leathers/display on the screen.  The right side of the screen has an iframe that is to fill up whats left of the estate of the web browser.  Search in google, I found a function that works on the laundry.  I need the iframe to resize when the browser hides and shows, but when I tried to create a dynamic action on click to call javascript, hide and show the features of the browser bar break.  The iframe is not also resize.

    Here's the code that I currently use.

    JavaScript in my page header

    <script language="JavaScript">
    <!--
    function autoResize(id){
        var newheight;
        var newwidth;
    
    
        if(document.getElementById){
            newheight=document.getElementById(id).contentWindow.document.body.scrollHeight;
            newwidth=document.getElementById(id).contentWindow.document.body.scrollWidth;
        }
    
    
        document.getElementById(id).height= (newheight) + "px";
        document.getElementById(id).width= (newwidth) + "px";
    }
    //-->
    </script>
    
    

    The source of the IFRAME area.

    < IFRAME SRC = "f? p = & I_FRAME_APEX_APP_ID: & I_FRAME_APEX_PAGE_ID.: & APP_SESSION.

    : NO::ROLE: & ROLE. "width ="100% "height ="200px"id ="iframe1"marginheight ="0"frameborder ="0"onLoad ="autoResize ('iframe1'); "> < / iframe >

    A colleague suggested this, and the width is now set properly.  the height is always not to fit properly in the window.  When I set the height to 100%, the default height for pixels, I put in the iframe.

    
    
    
  • Adjust the width of the text to the width of the image

    Sorry if my English is not 100%.

    Is it possible (and if so, how?) to adjust the width of a text to the width of my image?

    For example: I want to have the text 'Sample Text' in my picture that is the width of 500px. The text that must also be 500px in width. But I have another image, which is the width of the 1800px and that the text "Sample Text" must be addepted over a width of 1800px. So is there an option in Photoshop (I have CS5) which addepts the width of a text to the width of the image?

    Thanks in advance.

    Yes it is possible by using a script, here's an example that will resize the text to the width of the document and place it 5 pixels from the bottom.

    The text layer MUST be the active layer.

    main();
    function main(){;
    if(!documents.length) return;
    if(activeDocument.activeLayer.kind != LayerKind.TEXT) return;
    var startRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    var Percent = 100; //Percentage of width
    var myDoc = activeDocument;
    var LB = myDoc.activeLayer.bounds;
    var docHeight = myDoc.height;
    var docWidth = myDoc.width;
    var LHeight = Math.abs(LB[3].value) - Math.abs(LB[1].value);
    var LWidth = Math.abs(LB[2].value) - Math.abs(LB[0].value);
    var percentageWidth = ((docWidth/LWidth)*Percent);
    myDoc.activeLayer.resize(percentageWidth,percentageWidth,AnchorPosition.MIDDLECENTER);
    align('AdCH'); align('AdBt');
    activeDocument.activeLayer.translate(0,-5); //move the text 5 pixels from the bottom
    app.preferences.rulerUnits = startRulerUnits;
    }
    function align(method) {
    activeDocument.selection.selectAll();
       var desc = new ActionDescriptor();
               var ref = new ActionReference();
               ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
           desc.putReference( charIDToTypeID( "null" ), ref );
           desc.putEnumerated( charIDToTypeID( "Usng" ), charIDToTypeID( "ADSt" ), charIDToTypeID( method ) );
        try{
       executeAction( charIDToTypeID( "Algn" ), desc, DialogModes.NO );
       }catch(e){}
       activeDocument.selection.deselect();
    };
    
  • ObjectChoiceField: how to set the width of the drop-down window

    Hi guys,.

    How would you define the width of the window from the drop-down list (which displays all the elements of choice of the field of your choice)? The application automatically sets the width based on the width of the items of choice.

    Thank you

    Nitin

    Ever need to use it, so have not tried, but I note that the ObjectChoiceField includes a method called:

    getWidthOfChoice();

    Now, I assume that the width is in pixels, and that the normal process would invoke using the field.font and make a getAdvance().  But I have often wondered if, by changing it, I would change the actual width of the field.

    Maybe worth a try.  If you try it, let us know.

Maybe you are looking for

  • Flash Player drain my battery?

    I have a home security camera and you must install it for display on the web while I will not stay at home.  I realize that flash player drains my battery fast.  I decided to uninstall it to save my battery.  A few days later, Apple told me to update

  • Change profile

    Why I can't change my email address in the discussion/support Web site?

  • Automatic stop when you use the CD/DVD on the 1900-803 Satellite player

    Ive had problems with my 1900-803 for the last 3 months. whenever I use the cd/dvd drive, my laptop turns off without warning after 15-20 minutes. It also stops if I try and play all the video files or scan my hard drive for viruses or spyware. is it

  • Acer z5600 Wireless Driver

    I had to reinstall Windows 7 on my Acer Z5600 because of a hard disk crash. I downloaded and installed all the drivers except for the wireless drivers. Drivers Realtek gives me an error message saying that the operating system is inaccurate and it do

  • How to create a VPN file .pcf for the CISCO VPN CLIENT software profile

    Dear all How to create a VPN file .pcf for the CISCO VPN CLIENT software profile Concerning