Can't subtract one var from another in js

I have a script which I'm modifying, it resizes an image, adds a black border then adds white borders to replicate the look of a 10x8 inch print.
This line is giving me trouble and I can't seee why!
     docRef.resizeCanvas ( docRef.width + (portraitPrintW - docRef.width), docRef.height, AnchorPosition.MIDDLECENTER);
I've already set
     var docRef = activeDocument; var portraitPrintW = 576;
The script has resized the image to 72ppi and to fit 676ppi long side. Its then added a 2px black border all around. At this point the image should be 454px wide. I want to add a white border to the left and right to give a total width of 576. So the above line should be 454 + (576-454) which is 454+126=576 therefore I'm doing a Resize Canvas 576, 680 (the current height) middle centre (with a white background - set as a var earlier).
What actually happens is the canvas is resized to be 334 wide (height is correct) - how did that happen?
Replacing a couple or vars with real number allows the script to work as expected
     docRef.resizeCanvas ( (docRef.width + (576 - 450) ), docRef.height, AnchorPosition.MIDDLECENTER);
and
     docRef.resizeCanvas ( (docRef.width + (portraitPrintW - 450) ), docRef.height, AnchorPosition.MIDDLECENTER);
also works as expected
Maybe I can't use the same var twice in a calculation, no because even this doesn't work
     var currentWidth = docRef.width;
     docRef.resizeCanvas ( (docRef.width + (portraitPrintW - currentWidth) ), docRef.height, AnchorPosition.MIDDLECENTER);
So why does ( docRef.width + (portraitPrintW - docRef.width) return 334, not 676?
Thanks for any clues.

I think I'm already setting the ruler units to pixels, here I'm saving them to a var in order to reset them after the scrip is finished.
        var strtRulerUnits = preferences.rulerUnits;
        var strtTypeUnits = preferences.typeUnits;
        preferences.rulerUnits = Units.PIXELS;
        preferences.typeUnits = TypeUnits.PIXELS;
and that appears to be working. The calculation returns the expected answer when using numeric values in place of some vars, as I say:
     docRef.resizeCanvas ( docRef.width + (portraitPrintW - docRef.width), docRef.height, AnchorPosition.MIDDLECENTER);
returns a different answer from
      docRef.resizeCanvas ( (docRef.width + (576 - 450) ), docRef.height, AnchorPosition.MIDDLECENTER);
even though var portraitPrintW is set to 576 and docRef.width (should) be 450.
Thanks again.

Similar Messages

  • My new Photoshop Elements 12 has a RAW file plug-in, but when I try OPEN to select a photograph, there are only generic icons instead of pictures-- I can't tell one photograph from another! How can I fix this so I can tell which photograph I want to open?

    My new Photoshop Elements 12 has a RAW file plug-in, but when I try OPEN to select a photograph, there are only generic icons instead of pictures-- I can't tell one photograph from another! How can I fix this so I can tell which photograph I want to open? Thank you!

    Thanks R_Kelly:
    Adobe Photoshop Elements Version: 12.0 (12.1 (20140303.12.1.49334)) x32
    Operating System: Windows Vista 32-bit
    Version: 6.0 Service Pack 2
    System architecture: Intel CPU Family:6, Model:15, Stepping:11 with MMX, SSE Integer, SSE FP, SSE2, SSE3
    Physical processor count: 4
    Processor speed: 2400 MHz
    Built-in memory: 3069 MB
    Free memory: 1631 MB
    Memory available to Photoshop Elements: 1598 MB
    Memory used by Photoshop Elements: 69 %
    Image tile size: 128K
    Image cache levels: 8
    Video Card: ATI Radeon HD 4800 Series
    Video Mode: 1680 x 1050 x 4294967296 colors
    Video Card Caption: ATI Radeon HD 4800 Series
    Video Card Memory: 512 MB
    Application folder: C:\Program Files\Adobe\Photoshop Elements 12\
    Photoshop Elements scratch has async I/O enabled
    Required Plug-ins folder: C:\Program Files\Adobe\Photoshop Elements 12\Required\
    Primary Plug-ins folder: C:\Program Files\Adobe\Photoshop Elements 12\Plug-Ins\
    The first thing I did was UPDATE. I have all the latest updates available (according to the updater). The Camera Raw Plug-in says it is version 8.0.
    The RAW files are from a Canon T3i. It's a very common camera, I can't believe it wouldn't be supported.

  • My slide presentation (with sound) is done. How can I change one song from another?

    My slide presentation (with songs) is done. How can I change one song from another?

    Do you still have your Aperture Slideshow project? Then open the slideshow and select the one of the green audio file clips in the film strip that you want to replace. Press the "delete" key and drag another audio file from the Media Browser directly onto the slide, where the sound should start.

  • Trying to subtract one image from another

    I am a graduate student in a biology laboratory and I have been given the task to remove autofluorescence from our fluorescent microscopy images and I have found a way to do it, but I would like to improve it.  Unfortunately, I know very little about photoshop (mostly learned by playing around with things).
    What I need to do is take two pictures which show the same section of tissue but with different wavelengths of light (one picure in green, one in red) and subtract one image from the other.  So far I have converted the two images to greyscale then did "Apply Image" to subtract image 2 from image 1.  Then I convert Image 1 back to RGB and adjust the channels so I only have one color showing (green).  It has been effective but I would like to adjust things a bit.
    First, is there an easy way that I can adjust the brightness/contrast/levels of the image 2 to match the images levels to image 1--both images have certain parts of the image that are conserved.  Can I get photoshop to look at a specific area on image 1 and allow me to adjust that same area in image 2 to the same brightness/intesity?
    Second, I tried to make an action for this process, so I can give it to the other people in the lab so they can quickly do the same technique.  When I get to the Apply Image step it asks for the name of the image that I am working with which should change each time I do this technique.  Is there another approach other than using the Apply Image feature which will allow me to subtract image 2 from image 1 that would work in an action.
    If you need anymore clarification or an example of the pictures let me know.

    Put both images on individulal layers, and set the blending mode of the topmost one to "Difference". Adjust layer transprency as desired.
    If you add an adjustment layer, you can link it as a clipping mask to one layer. You can then paint on the associated layer mask to make it only affect certain areas.

  • How can I see one mac from another mac?

    I have two macs, an imac at home and a MBPro.
    If I have them both at home, how can I see one Mac´s hard drive from another?
    Is this possible? with back to my mac??
    thanks
    J

    Do you have a home network?
    Personal File Sharing: You can connect Macs on a local network with Tiger’s Personal File Sharing, which allows you to mount folders from the sharing Mac on the master Mac—note that the slave Macs do the sharing; the master Mac doesn’t have to. To turn on Personal File Sharing on the slave Mac, do this:
    Open System Preferences.
    In the System Preferences window, click Sharing.
    In the Sharing pane, click Services.
    In the Select a Service to Change Its Settings list, select the Personal File Sharing checkbox.
    Now that the slave Mac has sharing turned on, you can mount it on the master Mac’s Desktop:
    In the Finder, choose Go -> Network.
    In the Network window, select the sharing Mac.
    Click Connect.
    In the Connect to Server window, click Registered User, enter the user account name and password for the sharing Mac, and then click Connect.
    In the window that appears, select the volume that contains the folder you want to sync with, and then click OK.
    LN

  • How do I subtract one sum from another and show a balance in another box

    In numbers how do I show the difference in total from one column and another as a balance amount?

    =SUM(range_one)-SUM(range_two)
    Details available in iWork Formulas and Functions User Guide.
    Yvan KOENIG (VALLAURIS, France) samedi 9 juillet 2011 15:45:36 iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Can we run one report from another Report in reports 6i

    Actually my requirement is i want to run 4 reports from another report(driver report) by passing parameter same as the driver report.
    i want to see the out put on the screen report by report next to driver report output.is it possible?? actually i got the solution for printing or taking file. but i want to show the output on the screen.
    Edited by: user9165808 on Feb 16, 2010 3:21 AM

    I used SRW.RUN_REPORT () . But my question that is it possible to show report in batches on screen??
    Edited by: user9165808 on Feb 19, 2010 4:23 AM

  • How can i call one report from another report (Drill Down Approach)

    Hi Friends,
    I've two reports in completely different layout format.
    One is in Crosstab & another is in Tabular.
    Now i want to call my Tabular report(report 1) from my Crosstab (report 2) without using BO's default drill down feature. Or, you can show using BO's feature if it supports my requirement.
    How to do that?
    Is it at all possible?
    Please share your thoughts. Thanks in advance for your time.
    Regards.
    Satyaki De.

    hi
    you can use openDocument for this.
    [http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_url_reporting_opendocument_en.pdf]
    I would suggest to use variables that build the HTML code for the hyperlinks dynamically, and display them in your crosstab. Set the display option for the related cells (ie. the cells where your variables are displayed in) so that the cell's contents as interpreted as HTML code.
    Regards,
    Stratos

  • Formula to deduct one cell from another cell - simple equation - cant find the answer, formula to deduct one cell from another cell - simple equation - cant find the answer

    Could anyone tell me how to deduct one cell from another cell in the numbers application.
    Thank you!

    to subtract one cell from another you enter a formula in a cell by:
    1) click the cell where you want the result to be
    2) click the cell that contains on of the operands
    3) type the minus sign ("-")
    4) click the other cell with the other operand
    e.g.  if cell A1 contains 5, cell B1, contains 2 and you want the difference of those two cells to be in cell C1....
    you would click cell C1 and then type: "=A1-B1" then type the enter key OR
    click cell C1 and then type "=", then click cell A1, then type "-", then click cell B1, then type the "enter" key

  • If I imported a CD into my iTunes library from one computer how can I listen to it from another computer?

    If I imported a CD into my iTunes library from one computer how can I listen to it from another computer?  I imported music from a CD into my compter at work and when I got home and went to my iTunes account none of the songs were in my library.  I also noticed that on my Work computer there were a couple songs that I had to click on the little 'cloud' icon before I could listen to them (these were not songs I imported they were songs that were already in my library).  Not sure if this makes semse...help.

    jamie171 wrote:
    My question is since I have imported them into my iTunes library from one computer why can't I access them from my iTunes library from another computer that I have authorized to access whats in my library?  Is there no way to import songs only once into the library and then access them from all my authorized computers?
    Only if you have iTunes Match or of the computers are on the same local network.

  • How can I edit my website from another computer? and how can I create a new website next to the one, I have already? Can anyone help, please?

    How can I edit my website from another computer? and how can I create a new website next to the one, I already have? Can anyone help, please?

    Move the domain.sites file from one computer to the other.
    The file is located under User/Library/Application Support/iWeb/domain.sites.  Move this file to the same location on the other computer and double click and iWeb will open it.  Remember, it is your User Library that you want and not your System Library, as you will not find iWeb there.
    Just create a new site on the same domain file and it will appear below the other site.  If you want them side by side then duplicate your domain file and have one site per a domain file and they can then be side by side.

  • How can i access all the objects of one schema from another schema

    Dear All,
    How can i access all the objects(Tables,Views,Triggers,Procedures,Functions,Packages etc..) and do the modifications of one schema from another schema (Without using synonyms concept).
    Thanks in advance,
    Mahi

    First of all, synonyms only help you easy reference the object. It doesn't have any implication of object privilege.
    As long as you have proper privilege on target object. You can access it with or without synonyms.
    Assuming you have proper privilege of objects, you can use following command to assume schema owner.
    ALTER SESSION SET CURRENT_SCHEMA = Schema_owner

  • Can I Call method on one JVM from another through a dll?

    Let me explain.
    I have this java jar file that I can only have one instance of running at any given time. I'm using a shared data segment in a dll to store a bool indicating whether the program is already running or not. If it's already running, I have to not run the second instance and give focus to the current running instance.
    The jar file calls a native method "canInstantiate()" on a dll to see if there's already an app running. If there isn't, the env and obj are stored in the shared data segment of the dll and we return true. If there is already an instance of the program running, I want canInstantiate call a function on the current instance of the jar (like a callback) to tell it to request focus. It's not working. Can someone tell me if my code is right?
    The .h file
    #include "stdafx.h"
    #include <jni.h>
    #include "CardServer.h"
    #pragma data_seg("SHARED") // Begin the shared data segment.
    static volatile bool instanceExists = false;
    static JavaVM *theJavaVM = NULL;
    static JNIEnv* theJavaEnv= NULL;
    static jobject instanceObject = NULL;
    static jmethodID mid = NULL;
    static jclass cls = NULL;
    #pragma data_seg()
    #pragma comment(linker, "/section:SHARED,RWS")
    jdouble canInstantiate(JNIEnv *env, jobject obj);
    jdouble instantiate(JNIEnv *env, jobject obj);
    jdouble uninstantiate(JNIEnv *env, jobject obj);
    void grabFocus();
    </code>
    The .cpp file:
    <code>
    #include "MyFunctions.h"
    #include <string.h>
    #include <stdlib.h>
    #include "stdafx.h"
    #include <iostream.h>
    jdouble canInstantiate(JNIEnv *env, jobject obj)
    printf("In canInstantiate!!");
    if (!instanceExists)
    printf("No instance exists!!");
    return (jdouble)0.0;
    else
    printf("An instance already exists!!");
    grabFocus();
    return (jdouble)1.0;
    jdouble instantiate(JNIEnv *env, jobject obj)
    printf("**In CPP: Instantiate!!\n");
    cout << "At start, env is: " << env << endl;
    cout << "At start, obj is: " << obj << endl;
    if (instanceExists == false)
    instanceExists = true;
    theJavaEnv = env;
    instanceObject = obj;
    theJavaEnv->GetJavaVM(&theJavaVM);
    cls = (theJavaEnv)->FindClass("TheMainClassOfTheJar");
    if (cls == 0) {
    fprintf(stderr, "Can't find Prog class\n");
    exit(1);
    mid = (theJavaEnv)->GetMethodID(cls, "grabFocusInJava", "(I)I");
    if (mid == 0) {
    fprintf(stderr, "Can't find grabFocusInJava\n");
    exit(1);
    printf("About to call grabFocusInJava\n");
    grabFocus();
    printf("CPP: After the grab focus command in instantiate!!\n");
    cout << "At end, env is: " << env << endl;
    cout << "At end, obj is: " << obj << endl;
    return 0.0;
    else
    printf("CPP: Finished Instantiate!!\n");
    return 1.0;
    jdouble uninstantiate(JNIEnv *env, jobject obj)
    printf("CPP: In uninstantiate!!\n");
    if (instanceExists == true)
    instanceExists = false;
    theJavaVM = NULL;
    instanceObject = NULL;
    printf("CPP: Finishing uninstantiate!!\n");
    return 0.0;
    else
    printf("CPP: Finishing uninstantiate!!\n");
    return 1.0;
    void grabFocus()
    printf("In CPP::GrabFocus!!\n");
    instanceObject = theJavaEnv->NewGlobalRef(instanceObject);
    cls = (theJavaEnv)->FindClass("CardFormatter");
    if (cls == 0) {
    fprintf(stderr, "Can't find Prog class\n");
    exit(1);
    printf("Got the cls id again!!\n");
    if (cls == 0)
    printf("IT'S INVALID!!\n");
    mid = (theJavaEnv)->GetMethodID(cls, "grabFocusInJava", "(I)I");
    if (mid == 0) {
    fprintf(stderr, "Can't find grabFocusInJava\n");
    exit(1);
    theJavaEnv->CallIntMethod(instanceObject, mid, 2);
    printf("Called grabFocusInJava\n");
    </code>
    thanks in advance

    Can I Call method on one JVM from another through a dll
    ...The rest of your question merely expands on your title.
    And the answer to that question is no.
    When you call a method you are executing a "thread of execution." A thread of execution exists only in a single process. It can not exist in another process.
    If the dll is doing some interesting things then you could call a method that sets a flag. Data can move between instances. But you would then have to have a thread in that different process monitoring that flag. And sharing data in a dll is not a normal process, so it would have to be coded appropriately.
    If all you want to do is set the current focus to the existing application, then that can be done with existing windows functionality. You don't need to do anything special in your dll. You can probably search these forums to find the exact code. If not there are countless examples in windows repositories (like MSDN) on how to do that.

  • Update column in one table from another

    I've got two tables:
    t1:
    con_num
    con_code
    ex
    elin
    addressee
    a few other columns
    t2:
    con_num
    con_code
    elin
    addressee
    contact
    a few other columns
    I just got about 300 rows into t2 using sqlloader, and now I need to use t2 to update t1. t1 will have 3 rows per ex||elin, but t2 can have more or less rows per elin (which is the same as ex||elin in t1). If t2 has 4 rows per one elin, then that is 4 distinct pieces of data, and I need to make sure that t1 reflects 4 rows in its ex||elin, each containing the addressee||contact from t2. So I'll need to add a row to t1, as well as update 3 rows. Is this possible with just SQL, or do I need to write PL/SQL?
    The following is the code I've been trying:
    update t1
    set t1.addressee =
    (select addressee from t2
    where t2.con_num = 'number'
    and t1.con_code = t2.con_code
    and t1.ex ||t1.elin_num = t2.elin_num)
    This code is not correct, it returns more than one row from t2. Also, I'd need to concatenate contact onto addressee with a space in the middle, not just addressee, into t1.addressee.
    Any ideas, pointers?
    Thanks!

    Forgot some info: Ora8.1.5 on win2kpro. Also, I was wanting to combine addressee||contact in the insert/update statement to differentiate one addressee from another in t1 after the data is inserted. We can have several addressees that are the same, but each one goes to a different contact for each record.
    Thanks!

  • How to Call one EJB from another

    Hi all
    I am trying to call one EJB in one system from another EJB residing on diferent system...
    Both are Stateless session beans ...
    I can't use No-args Intialcontext() as i need to specify the Ip address of other system to be looked up.....
    So i am using properties Dorg.omg.CORBA.ORBInitlalHost....
    But its not looking up..Its telling not bound...But i called it from standalone client remotely...
    Am i wrong..?
    I hope I am in right path....
    I hope ill get reply as fast as possible...
    Gopal V

    Hi ken Thanks for replying....
    Ya i packed it as a jar (using Export tool in Eclipse3.2)....
    I am using SUN AS 9.....
    I packed bean1 and bean2 as two different jars in the same domain...
    Here is my code...
    Bean1:
    @Stateless(mappedName="ejb/Second")
    public class SecondIMPL implements SecondRemote {
         public FirstRemote obj;
         public String connect() {
              try{
                   InitialContext ctx= new InitialContext();
                   FirstRemote obj =(FirstRemote)ctx.lookup("ejb/First");
                   System.out.println("Client :"+obj.bMethod());
              }catch(Exception e){
                   e.printStackTrace();
              return "Check server Log";
    }Bean2 :
    @Stateless(mappedName="ejb/First")
    public class FirstIMPL implements FirstRemote {
         public String bMethod() {
              return "From First Bean";
    Client:
    public static void main(String[] args) {
              try{
                   InitialContext ctx= new InitialContext();
                   SecondRemote obj =(SecondRemote)ctx.lookup("ejb/Second");
                   System.out.println("Client :"+obj.connect());
              }catch(Exception e){
                   e.printStackTrace();
    Here is my Stack Trace...
    [#|2007-05-24T18:35:17.214+0530|WARNING|sun-appserver-pe9.0|javax.enterprise.system.stream.err|_ThreadID=18;_ThreadName=p: thread-pool-1; w: 19;_RequestID=bb4848e7-829a-421d-a560-93659898eb02;|
    javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.SecondRemote[Root exception is java.lang.ClassNotFoundException: com.SecondRemote]
         at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:350)
         at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:61)
         at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:314)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at com.FirstBean.rediff(FirstBean.java:16)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
         at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
         at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
         at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
         at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:190)
         at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
         at $Proxy36.rediff(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
         at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)
    Caused by: java.lang.ClassNotFoundException: com.Second
         at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:701)
         at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.java:614)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:568)
         at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:320)
         ... 31 more
    |#]

Maybe you are looking for