[CS3][JS] How to turn negative number in array into string

Hello,
I have a script that compares the array of the geometric bounds of all text frames to the margins for a document (all pages having the same margins). Any frames that do not match the margins are flagged.
In order to compare the array of text frame geometric bounds to two arrays of margins (because they are facing pages), I have to convert the numbers to strings.
My problem is that in the following snippet of code that creates the two margin arrays, the negative of the variables become numbers again. This would not be too difficult to solve except that all the numbers have to be 4 decimal points before converted to strings.
Thanks,
Tom
var myDoc = app.activeDocument;
var marginY1 = myDoc.pages.item(0).marginPreferences.top.toFixed(4);
var marginX1 = myDoc.pages.item(0).marginPreferences.left.toFixed(4);
var marginY2 = (myDoc.documentPreferences.pageHeight - myDoc.pages.item(0).marginPreferences.bottom).toFixed(4);
var marginX2 = (myDoc.documentPreferences.pageWidth - myDoc.pages.item(0).marginPreferences.right).toFixed(4);
var marginsRHand = [marginY1, marginX1, marginY2, marginX2];
var marginsLHand = [marginY1, -marginX2, marginY2, -marginX1];

Well, I think I have solved it. But I don't know why this solves it.
I would think that in the above script all the variables would be numbers and not strings. But the data browser says they are strings.
The solution is:
var marginsLHand = [marginY1, Number(-marginX2).toFixed(4), marginY2, Number(-marginX1).toFixed(4)]
If someone can explain why now all variables in the arrays are strings and not numbers, I'll be happy.
Tom

Similar Messages

  • How to find Negative number

    can any one pls tell me how to find negative number ?
    Thanks

    1. One easy method is to look for the giveaway dash in front of the number, e.g. "-1" is a negative number, given the "-" instead of the "1."
    2. Negative numbers can also sneakily be found by multiplying i by itself: i^2^ is a negative number.
    3. Negative numbers can hide in the exponent of e as complex numbers. e.g. e^i*pi^ is a negative number.
    4. If we're referring to Java here, perhaps the following could be of some use:
    final int ZERO = 0;
    public static void main(String[] args) {
    int a = 3;
    int b = -13;
    System.out.println(a + " is negative? " + lessThanZero(a));
    System.out.println(b + " is negative? " + lessThanZero(b));
    boolean lessThanZero(int n) {
    return n < 0;
    }

  • Does anyone know how I turn negatives into a positive on Aperture please?  I have scanned  a bunch of negs and want ot make a contact sheet. Would really appreciate some clues on where to start.  Thanks

    does anyone know how I turn negatives into a positive on Aperture please?  I have scanned  a bunch of negs and want ot make a contact sheet. Would really appreciate some clues on where to start.  Thanks

    Yeah, it's simple. You scan your images singly, then import them. Then, one by one adjust them. Under the adjustment brick, pull up the CURVES tool. It is one of dozens available from the pulldown menu on the left side.
    So, with your image in view, you click on the adjustment tool, select CURVES (which will be at the bottom of a few other adjustment sliders such as EXPOSURE) under the Histogram and then grab the bottom of the right hand curve and swing it all the way to the left. Then grab the left hand curve and drag it all the way to the right.
    The right curve represents highlights. The left curve represents shadows. Now the two are reversed. Your negative is now a positive. For added control, you can create mid-tone curves of your own and make finer adjustments. I haven't done this much so the experts might weigh in here with corrections and added advice.

  • How to view po number in sap into t -code f.13

    how to view po number in sap into t -code f.13

    Hi,
    You will able to see under Purchasing Doc Field when you execute F.13 (Actually this program will match the parameters with PO no only with GR/IR doc to get clear.
    Regd,
    Khan.

  • How do I convert visa resource name into string?

    Could please anybody help? I have an ergent need. How do I convert visa resource name into string?
    Thank you in advance.

    Most times you do not need to convert it. Just wire it stright into what ever string input.
    See "Format Into Srting" or "Type Cast" functions
    Omar

  • How to turn a table-based form into a master/detail ?

    Hello, I have a form based on a table on which I have spent quite a bit of time adjusting presentation and adding dynamic actions.
    Now comes the requirement to handle an open number of related records, ideally on the same page.
    Has someone documented the steps needed to turn a record-based form into a master/detail one ?
    I am using APEX 4..2.1

    If you think your are missing something you could create the master detail pages for comparison. And delete these dummy pages when your done.
    I finally got around to working on this. You got me on the right track Nicolette, so thank you for that.
    I also had to fix bits in making processes conditional, and branching, too.
    Mainly this has to do with the "delete checked" button which deletes detail records, and submits the page to itself.
    One also needs to rename the REQUEST used in that case from MUTLI_ROW_DELETE to APPLY_CHANGES_MRD
    (as this pattern will trigger an UPDATE for the master record)
    All in all doable but one needs to be careful and generating a quick example M/D page for reference is useful.
    In my case I reckon this was still faster than re-doing all the layout adjustments and DA's
    (plus I got to better understand how this all works - there are a couple moving parts, all interdependent)

  • How to restrict the number of Records into the Table?

    Is there any way that I can restrict the number of records can be entered into the table?
    For example I have created a table TAB1 with size category 0( zero).
    User dont want to enter more than 100 values, How to restrict the number entries? Whether Basis can do it?
    Regards,
    Prathap

    Hi Prathap,
    You can write a code in table maintenance events to restrict the number of Records added into the Table to constant.
    Solution:
    Se11 -> enter table name (TAB1) -> F6 -> Utlities -> Table maint. generator -> Envirnment -> modification -> events -> write here the form routine name.
    Double click on routine name. You will get into include section of the code. Write here code like:
    IF current_rec_num > 100.
       messgae error 'Entry restriceted to 100'
    ENDIF.
    Somewhat this way you can achieve your target.
    Regards,
    Sachin

  • How to turn a phone 3G pic into a jpeg format?

    How do i turn a iphone 3G pic into a jpeg?

    A photo captured by an iPhone is a jpeg file.

  • How to read contents of an array into a variable?

    Gurus,
    I'm trying to read contents of a table or array into a varray variable. I want to know the syntax of how to accomplish the same. Please help
    Here is what i have,
    v_sub_query varray(10) of varchar2;
    v_sub_query should read contents of an array and hold values. I'm trying to do this and then use each values of v_sub_query(index) into a dynamic sql statement.
    thanks
    SS

    Sign is definately not king when it comes to PL/SQL as his advice is flawed. Row-by-row processing simply causes a lot of context switches from the PL/SQL engine to the SQL engine and back. And this results in a significant performance impact. Never mind that this style of 80's COBOL processing it sadly outdated in the 21st century when dealing with a modern RDBMS likle Oracle.
    The correct way to populate an array in PL/SQL with SQL data, is to bulk collect it. However, a varray data type is not the best suited data type for this - as they are fixed sized. Dynamic arrays are more flexible.
    Simple example:SQL> declare
      2    type TStrings is table of varchar2(30);
      3    cursor c is select object_name from all_objects order by 1;
      4    v_NameTable      TStrings;
      5  begin
      6    open c;
      7    loop
      8      fetch c bulk collect into v_NameTable limit 100;  -- fetch 100 rows at a time
      9      -- process the array
    10      for i in 1..v_NameTable.Count
    11      loop
    12          -- process element v_NameTable(i)
    13          null;
    14      end loop;
    15      exit when c%NOTFOUND;
    16    end loop;
    17    close c;
    18* end;
    SQL> /Refer to the Chapter 5. Using PL/SQL Collections and Records of the Oracle® Database PL/SQL User's Guide and Reference guide.
    As for dynamic SQL - remember to use bind variables. Do not hardcode the array values into the SQL statement as the resulting SQL will not be sharable and will cause performance problems with SQL parsing and shared pool memory fragmentation and malloc errors.

  • How to turn off number sounds when dialing out?

    ?  I have the keyboard sound off already, but, when I dial out the numbers are not silent.

    The keyboard is just that, ...the keyboard, ....used only for text, email and web.  The phone dialing screen is totally different and is uneffected by any changes you make to the keyboard settings.  The only way to silence the phone when dialing out is to either turn the volume all the way down (not logical) or to engage the mute slide on the side of the phone.  **Warning, ...both options also turn the ringer off or down.  I would like to see apple address this in the next update.  Users don't need to hear these loud numbers.

  • [CS3, VB] How to find text and store as a string

    Dear all,
    I'm stymied again with what seems a simple thing. But you hear that a lot.
    I want to find a reference number in a document and then use that to create a filename later on.
    I've got this far, adapting code from another topic:
    myString = "Release No. ^9^9^9^9"
    Set myFileSystemObject = CreateObject("Scripting.FileSystemObject")
    Set myInDesign = CreateObject("InDesign.Application.CS3")
    Set myDocument = myInDesign.ActiveDocument
    myInDesign.FindTextPreferences = idNothingEnum.idNothing
    myInDesign.FindTextPreferences.FindWhat = myString
    set myFounded = myDocument.findText()
    call myInDesign.select(myFounded.item(1))
    I know I shouldn't have to select it as such, but anyway, I'm stuck converting the found text into a string. And then I want to just grab the four digits.
    Also, could you provide the code to put that into a if/then statement in case it doesn't find anything?
    Thanks
    Nigel

    Perhaps we need some clarification.
    Can you post one -> Good Data
    one -> Bad Data
    And, the required output - i mean the way you want to display those bad data. And, also post your exact oracle version by this way ->
    select * from v$version;Regards.
    Satyaki De.

  • How to insert various number of values into a table

    Hi
    Im devoloping application using swing components..How can i insert values from JTextField to table if the form contains number of textfield(more than 30) and JRadioButtons(Radio Buttons are in button group).
    thanks in advance.

    Hi
    i designed a form with 58 Textfields. i want to get data from those fields and i have to store those into a database table. how can i do that .is there any simple way to do that?. do you have any example code? pls give me...

  • How to Ignore Negative Values from taking into consideration while Calculating MTD sales

    Hi Guys,
    I need to ignore negative Sales (Returns) from the Month to Date Sales  and calculate the Average only for those values.
    How can I do that.
    I researched on net but could not find any useful suggestions.
    Please help!
    Regards
    Ajoy

    Hi Mark,
    I have added a screen shot above explaining where I need to put the calculation.
    So basically we have a sales figure either positive or negative every hour.
    I need for every day only positive values and take the average. The count to calculate hours where only positive values works. But Sum doe not work.
    I am using following formula to calculate count of hours where Sales Positive
    Count(Sum([HOUR]) Where ([Sales]>-1))
    And for Sales Sum, following:-
    =Sum([Sales]) Where([Sales]>-1)
    It does not work. In the result set I do not want to see [HOUR] as a column.
    Please suggest something.
    Regards

  • How to extract a number between () in a string

    Dear All,
    I have strings like the following:
    DAC (450) DTO Ops (200) DMC (150) RMC (250)
    BCA (50) RMC (200) DMC (60) DAC (870)  DTO Ops (1530)
    DTO Arp (24.48) DTO Ops (173.8124) DM (5.7848)
    I would like to extract selectively all DAC numbers assuming that the position of DAC number in the string is random but the number is always coming between () after "DAC" and 1 space.
    Thanks
    Regards
    Ehfa Dil

    Thanks Zack and Sanjay for your help! Really appreciated!
    Hi Sanjay,
    Your suggestion is working but I get errors when I have some database records with no "DAC " String
    like this one: DTO Arp (24.48) DTO Ops (173.8124) DM (5.7848)
    I have a 1 TB database with many similar records unfortunately... 
    I am not good in programing but I am wondering if there is a script to avoid such errors. I have a workaround with Select expert in Crystal Reports but it is not convenient If I want to publish reports. Would be good if I can put (if expression or anything that could take such case out of errors) any ideas that could help?
    Thanks Again
    Regards
    Ehfa Dil

  • How to turn the headphone port output into input(MBA)

    ....

    use a HEADSET jack for mic input.
    however professional microphone use should be going thru USB, not the headset jack.

Maybe you are looking for

  • Error while loggin

    Dear ALL, After deployment of some components thr JSPM  I am getting below error Portal Runtime Error An exception occurred while processing a request for : iView : pcd:portal_content/every_user/general/defaultDesktop/frameworkPages/frameworkpage Com

  • IOS8 install

    The iOS8 install killed my Mini!! All I get is the Apple Logo or the iTunes logo with a photo of the usb cord.  I even tried restoring the ipad on iTunes connected to the computer and that FAILED!!! Any suggestions?

  • Fifth Gen Ipod 30GB: songs not uploading

    I've made my list on Itunes and everything is good there but when I uploaded every song came out just static. What is going on? I have all the song names and album covers just no music. It's making me crazy! Can someone please help.

  • Write spreadsheet column limitation

    Hello, I'm trying to use write spreadsheet to save my structure of arrays. I use an insert into array to join some arrays (10). I've got 450 variables (%.3f). But when I read the saved file, it's showed me 30 Columns*15 lines columns instead of 450 c

  • Unable to compress.

    I'm new to Leopard as of two days ago. I am trying to compress a file, but the .zip file that results is the same size as the original, which I can't e-mail. I've checked permissions for the file as recommended by Mac Help, but the file still will no