Having problem placing a picutre with script

hi all
im kinda new to this
i have 1 pic i want to place in specific coordinate
i opened up a new document A4
and i opened my script
i have a problem with the x and y coordinate
the numbers doesnt make sense
what i did?
i manualy checked for the x and y coordinate
i wrote them down in the script but i didnt came in the place it suppose to be
any idea? im working with pixels and i set up it work also in pixels
here is my code:
thanks!
file = app.openDialog();//opens dialog,choose one image
var doc = app.activeDocument;
for (i=0;i<4;i++) {
    app.load(file[0]); //load it into documents
    backFile= app.activeDocument; //prepare your image layer as active document
    backFile.selection.selectAll();
    preferences.rulerUnits = Units.PIXELS; // tell ps to work with pixels
    backFile.selection.copy(); //copy image into clipboard
    backFile.close(SaveOptions.DONOTSAVECHANGES); //close image without saving changes
var width =850; //width of image
var height = 1100;  //height of image
var x =0; //x pos
var y =0; //y pos
    selectedRegion = Array(Array(x,y), Array(x, width), Array(height,width), Array(height, y));
    doc.selection.select(selectedRegion);
    doc.paste(); //paste selection into your document
    doc.layers[i].name = i; //set your layer's name

Update my script to enable you to paste into more the one column.
/* ==========================================================
// 2012  John J. McAssey (JJMack)
// ======================================================= */
// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.
/* Help
<javascriptresource>
<about>$$$/JavaScripts/PasteImages/About=JJMack's PasteImages^r^rCopyright 2012 Mouseprints.^r^rPaste Images Script^rCreate a document for printing on roll paper.</about>
<category>JJMack's Script</category>
</javascriptresource>
app.preferences.rulerUnits = Units.PIXELS; // tell ps to work with pixels
//Set the following vars for your printer: print resolution, roll paper width and length, # of  columns and image cell size
//Thinking about creating a doalog for the script
var cols=4;                              // Document number of columns
var rows=0;                              // Document rows will be determined by script using columns and # of images selected
var res=300;                              // Document DPI Resolution 
var width=4*res;                    // Document Cell width in pixels inches*res
var height=6*res;                    // Document cell height in pixels  inches*res
var maxpaperwidth=16*res          // Printer paper width in pixels  inches*res 
var maxpaperlnth=100*12*res          // Printer Paper Roll length in pixels
//End Settings
try {
          if (width*cols>maxpaperwidth) { throw "error1"; }
          if (cols==0) { throw "error4"; }
          var file = new Array();
          file = app.openDialog();//opens dialog,choose images
          if (file.length<1) { throw "error2"; }
          rows=Math.round((file.length/cols)+.499);
          if (height*rows>maxpaperlnth) { throw "error3"; }
          var doc = app.documents.add(width*cols, height*rows, res);
          var currrow=0; var pasted=0;
          for (var i=0;i<file.length;i++) {
                    app.load(file[i]); //load it into documents
                    var backFile= app.activeDocument; //prepare your image layer as active document
                    flatten(); //handle layered images
                    if (backFile.width.value<backFile.height.value&&width>height ) { backFile.rotateCanvas(-90.0);  } // Rotate portraits
                    if (backFile.height.value<backFile.width.value&&height>width ) { backFile.rotateCanvas(-90.0);  } // Rotate landscapes
                    if (backFile.width.value/backFile.height.value > width/height) { backFile.resizeImage(null, height, null, ResampleMethod.BICUBIC); } // wider
                    else {backFile.resizeImage(width, null, null, ResampleMethod.BICUBIC);} // same aspect ratio or taller
                    backFile.selection.selectAll();
                    backFile.selection.copy(); //copy resized image into clipboard
                    backFile.close(SaveOptions.DONOTSAVECHANGES); //close image without saving changes
                    var x =pasted*width;
                    var y =currrow*height;
                    var selectedRegion = Array(Array(x,y), Array(x+width,y), Array(x+width,y+height), Array(x,y+height));
                    doc.selection.select(selectedRegion);
                    doc.paste(true); //paste image into masked layer your document
                    doc.selection.select(selectedRegion);
                    align('AdCH'); align('AdCV');
                    doc.selection.deselect();
                    doc.activeLayer.name = i; //set your layer's name
                    var layerRef = app.activeDocument.layers[app.activeDocument.layers.length-1];
                    doc.activeLayer.move(layerRef, ElementPlacement.PLACEBEFORE);
                    pasted++
                    if ( pasted==cols ) { pasted=0; currrow++; }
catch(err){
          if(err=="error1") {alert("Paper width exceeded try reducing the number of columns or cell width");}
          if(err=="error2") {alert("No Images Selected");}
          if(err=="error3") {alert("Paper roll length exceeded try selecting fewer images or reducing cell height");}
          if(err=="error4") {alert("Error number of columns set to zero");}
// flatten Image
function flatten() {
          try{
                    executeAction( charIDToTypeID( "FltI" ), undefined, DialogModes.NO );
          }catch(e){}
// Align Layers to selection
function align(method) {
          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){}
Message was edited by: JJMack

Similar Messages

  • I'm having problems uploading video taken with my iPhone 4 to Photobucket.  FB will not accept the file extension which is ex. IMG_423.  They will play on my computer and will upload to Facebook.  Why is the phone taking video with this file instead of so

    I'm having problems uploading video taken with my iPhone 4 to Photobucket.  FB will not accept the file extension which is ex. IMG_423.  They will play on my computer and will upload to Facebook.  Why is the phone taking video with this file instead of something like .mov or mp4.  How can I change the extension after the fact and avoid it in the future?

    You said, "the 4 also has signal and wifi whereas the 5 has only wifi". By "signal", I'm assuing that you mean cellular signal. If so, that means your iPhone 4 is still active on your cellular number and your iPhone 5 is not. Contact your carrier to sort out which phone is active on your account.

  • I am having problems syncing my ipad2 with my outlook 2010. Any suggestions

    I am having problems syncing my ipad2 with my outlook 2010. I went to ATT& T store and they recommended airplane mode when syncing.  It did not sync Outlook to my ipad 2. Any suggestions?

    You haven't purchased apps with multiple Apple ID's have you? If you have, you can only sync with one Apple ID in the iTunes library at a time. Whichever ID you are signed into on the computer and the iPad would determine which apps would sync.
    Have all of your apps been transferred into iTunes for your iPad?
    iTunes Store: Transferring purchases from your ... - Support - Apple

  • Had to remove itunes from my computer to reset the computer. Now I'm having problems syncing my iphone with the computer. Computer is saying it wants to download updates to the phone but that will delete things I downloaded straight from the phone. Help!

    Had to remove itunes from my computer to reset the computer. Now I'm having problems syncing my iphone with the computer. Computer is saying it wants to download updates to the phone but that will delete things I downloaded straight from the phone. Help!

    iTunes thinks you have a new computer because you restored the OS. Open iTunes and authorize it to the same account you have on the iPhone. Did you restore your iTunes content from a backup after resetting your computer? Have you been syncing regularly with the computer, and does the iTunes library on the computer contain your apps, music and videos? If so just sync and your content will be removed then restored.
    If you have not hopefully you have now learned something. You can recover apps and purchased songs by connecting the phone, without syncing, and choose "Transfer purchases..." from the File menu.

  • HT4972 I am having problem sync my Iphone with pc running window7 after rebuilding pc due virus. Can someone help. Thanks

    Hi Guys
    I am having problem sync my Iphone with pc running window7 after rebuilding pc due virus. Can someone help. Thanks
    Regards
    Harwin Marr
    <Personal Information Edited By Host>

    Try restarting the AMDS >  iPhone, iPad, iPod touch: How to restart the Apple Mobile Device Service (AMDS) on Windows

  • I am having problems configuring airport express with time capsule

    Hi,
    I am having problems setting up airport express (old version) with time capsule. It was working perfectly fine with my old router, Airport Extreme (b/g).
    I have tried to reset the Airport Express, and now I am having problems finding it in my personal networks. Not too sure what exactly is going on, other than it was working less than a day ago, and now I can't even locate it on the network to configure.
    Anyone have any suggestions? I have already tried a hard reset, and no luck so far.

    There are 3 types of resets.
    1. Soft
    2. Hard
    3. Factory
    Try a factory reset.
    http://docs.info.apple.com/article.html?artnum=108044
       Joseph Kriz

  • Having problems on MacBook Pro with Retina Display

    I am having the problem on the display of MacBook Pro Retina Display Mid 2012.
    I bought my MacBook with OS X Lion installed with it. Last year, I got the problem where there is vertical lines in my display. So, I had to replace my whole screen to fix the problem. Today, I rebooted my computer and it got the same problem again. The problem is not severe than last year, but do I need to fix my display each year?? Is anyone having same problem with me?

    As you have just replaced the screen, try checking the warranty. It has something to do with the pixels
    Check this discussion, it might help you.
    https://discussions.apple.com/thread/3566919?start=15&tstart=0

  • Character set conversion problem when importing application with script.

    Our database has character set: WE8MSWIN1252
    We have a region with the following title: Kopiëren. The ë is stored as character 235 in the database.
    When I make an application export the file is in UTF-8. The ë is now stored as hex C3 AB in this file.
    When importing the application using the Apex tool, the ë is again stored as character 235 in the database.
    In our installation script we use some code to load the application. It look something like this:
    declare
    begin
       -- Determine workspace ID
       apex_application_install.set_workspace_id(l_workspace_id);
       -- Determine app ID
       apex_application_install.set_application_id(l_app_id);
       apex_application_install.generate_offset;
       apex_application_install.set_schema(l_schema);
       apex_application_install.set_application_alias(l_schema);
       l_app_id := apex_application_install.get_application_id;
    end;
    @..\apex\f200.sqlThis works fine except that no character set conversion takes place. The UTF-8 character is placed in the database so our region has as title: Kopiëren
    Is there a way to fix this?

    Hi Rene,
    The character set portion of your local NLS_LANG environment variable should be AL32UTF8, and this should be set prior to you importing your application via SQL*Plus.
    Joel

  • Is anyone having problems using pages app with iPad mini?

    I have to use a template report for my job- which other people with normal sized iPads also use- I use pages to convert the word doc - which contains writing and boxes - I complete the report and send it back to work, when they open it all the writing can't be seen down the right hand side, so I'm having to write three words per line in each box so they can read it when they open it, this is not ideal and wondered if its the iPad mini that can't cope ? Wondering weather to get the standard size iPad although I don't really want to do that.
    I also need a way of password protecting my work can anyone help ?
    Thanks

    I have an HP Scanjet 8390 with the same problem ($1600 new when I bought it). Using the "HP Scan.app", I am able to scan but not save - something about a read only file.
    The HP Scanjet 8390 is a business class **DUPLEX document scanner built like a tank, critical to my business (and personal). ie. I scan 100's of duplex pages a day for the last 6 years with no problems. It has a 14" glass for legal documents, 48-bit, +programmable hard buttons to scan and copy, or scan and print, OCR...
    I called 1-800-633-3600.. HP told me they do not support legacy products, have no intention of updating the drivers for legacy products and suggested I buy a new scanner (even though my old scanner works perfectly and is faster and not ).
    What is considered a legacy product? 1 year? 2 years? Am I to buy a new ($1000) scanner every 1-2 years?  What benefit do I get from a new equivalent scanner?

  • Having problem to send email with POP account ...

    Hi,
    I didn't have that problem before upgrading to my new 3GS iPHone. I have 3 email accounts on my iPhone: POP (videotron.ca), GMail and MobileMe. They all work fine except my POP account.
    From the POP account I can receive my email but I cannot send any. Funny enough, my emails are sent when the account is desactivated from my «Mail, contacts and Calendar» preferences on my iPhone.
    Can somebody help me ? Regards.
    Robert

    Hi Robert,
    I upgraded with the Iphone 3Gs a week ago and got the same problem with Videotron. The problem is with videotron as usual. If you want to be able to send email from your Iphone just go to Gmail, open an account FREE with them and then use this account to send Email...Work perfectly OK with me. Then of course you will have to phone videotron to make sure your account is fully available when you go on there Web site open the read email and be able to read your email if not solve the problem with them by phone. unless you will be able to send email easily with gmail and mather of fact it is free.
    Hope this will help from Quebec to Quebec!!!

  • Having problem loading Aol mail with Firefox ver 4. Keep getting error 8 msg. Any ideas?.

    INstalled Firefox 4 and now cannot laod the aol mail website. I can use ms explore with no problem. Get error msg 8 Problem loading application. AOL itself loads fine, just not mail.

    INstalled Firefox 4 and now cannot laod the aol mail website. I can use ms explore with no problem. Get error msg 8 Problem loading application. AOL itself loads fine, just not mail.

  • Having problem running Lightroom 5 with my MacBook Pro

    A salesperson from Bestbuy told me if I get a macbook Pro 13" with 2.5Ghz i5 and 4 GB RAM, I would be able to use Lightroom 5. I used the trial version, but it was slow on my Mac. Does that mean I need to upgrade my RAM?

    Hello! Did you solve the problem? I tried it all, new cable, Apple Store, downloaded what was recommended here: Lion 10.7.2 upgrade and HDMI video issue 
    ...nothing worked. I am frustrated ... My Mac book 2009 didnt have these issues.
    BR Jana

  • Anyone having problems installing Boot Camp with New Mac Pro 2.8?

    I just get blank screen after it restarts with XP disk. I'm using a vga - dvi adapter with a apple 17" display..
    I've phoned apple and read up on here but nobody seems to know. I just wondered whether my 2008 Mac Pro was faulty...
    Please can you help?
    cheers

    Are you getting a white screen after the Mac reboots? If so, try disconnecting all non-essential USB/FW devices.
    I had the exact same problem and I went through a long, stressful process of elimination to get it working, even to the extent of using my MacBook as an external drive through target disk mode!
    It turned out to be my iMage USB camera. Even after successfully installing Windows I have to disconnect it before using Bootcamp.
    I Hope this helps.

  • I am having problems setting up iCloud with Outlook 2007.

    I was able to setup the email with Outlook, but every time I try to setup the contacts.  I get the following error:
    your setup could not be started because of unexpected error
    This error does not occur immediately, but occurs after several steps of downloading and uploading. 
    If I hit the report button, it hangs. So I hit cancel after that in my retries.  I am on Windows 2007 (32-bit). 

    You need to leave more information like what is the ios5 device. I following instructions accidently set up two iclouds and then I couldn't get the contacts in. My mobileme email isn't going to work anymore because I set up an icloud using my store apple ID. Apparently the term apple ID can refer to any apple product ID that you make up not the one you use in the store. So you need to leave more infor on what is your problem to figure out how to help.
    GR

  • Anyone else having problems using Entourage 2008 with port 465?

    Hello,
    We all know by now that Verizon needs us to change our email settings. I've resisted because everytime I change the SMTP server settings to: smtp.verizon.net, enable SSL, and put in port 465, I CANNOT send emails properly.
    I say "properly," because here's what happens. I compose an email and hit send. I then get an immediate error message saying that the email could not sent. But it appears in my outbox. So I open it and hit send again. Same thing. Then I open it a second time from the outbox and hit send and it finally sends. This happens on EVERY email (with or without attachments). And it happens on both of my macs running Entourage 2008. When I change the settings back to: outgoing.verizon.net, no SSL, and port 25 -- everythings works perfectly.
    The new settings do work on my iphone. So I'm wondering if Entourage 2008 is the problem.
    Has anyone else encourntered this problem?
    Thanks for your help. 
    Redfran

    Me too!
    Finally tried to comply with Verizon’s “THIRD AND FINAL WARNING”
    “to change the settings on my email server”; despite numerous postings
    saying it didn’t work, you should keep current settings, sometime in the
    future it will inevitably be required. Tried; New settings don’t work;  now
    going back to old settings DISABLES my outgoing email.
    Verizon doesn’t even recognize the problem, nor give me a human voice
    to talk to. Many frustrating dead-ends trying to navigate their Byzantine
    website: 1.” web-link for guidance just leads to an ad for Verizon’s email.
    2. Their automaton has extensive decision-tree links that do not even let
    you ask about VERIZON’S REQUEST. 3. Verizon’s “chat forum”
    has similar problems checked off as “solved” w/non-solutions.
    4. finally found way to “live chat” = typing to someone in India
    who mostly says “I’m sorry”.
    Still my email is silenced DUE TO TRYING TO COMPLY W/VERIZON
    DIRECTIVE. They caused a problem yet WON’T EVEN RECOGNIZE IT!
    Makes me physically nauseous/dizzy. REMIND YOU OF ANYTHING?
    “Error : Error in sending email An error was reported in response to a recipient address.
    The SMTP server may refuse to handle mail for unknown recipients.
    The following email could not be sent.”

Maybe you are looking for

  • When I try to play a video(any video)the screen turns green and then shows a distorted picture

    When I try to play a video(any video)the screen turns green &plays a very distorted picture picture.

  • Telepresence Licenses, Servers and Personal Multiparty

    Dears, Our customer provide RFP with the following BOQ: LIC-AES-VTS-PMP-K9 AES and HTTPS option for VTS 2 LIC-VTS-PMP-INTOP Order L-VTS-UPG-PAK for e-Delivery Virtual TS Interop Lic 2 LIC-VTS-PMP-K9 Cisco VM TelePresence Server Release Key 2 LIC-VTS-

  • Confused about wiki pages and groups (i'm new to wiki services).

    we set up wiki services on our newly upgraded 10.5 server, but there is something that i can't seem to understand. it seems that the only way to create a new wiki is to create a new group. i don't quite get how you can have some members of one group

  • How to run 2 OSs on Sawtooth

    Hi all! I'm going to be purchasing a Sawtooth G4 soon(I hope!) so I'm posting this question in advance so I can plan ahead with what I need to do with the OSs. I'm going to get one with 10.2(at least) already installed on it. But I'm going to need to

  • MTD problems

    I have a powerpivot report that shows the 12 months of each year.  A sales column is compared to a sales column from the previous year.  Everything works great except for the current month.  It is showing a month end total for January 2013 and I need