[AS] [CS2] Placing images in frames

Hello,
Thank you all for such a brilliant forum. In the past two weeks I've gone from knowing nothing about scripting to compiling two scripts which do exactly as I need thanks mostly to contributors to this forum.
My question is about WHY my script works. I can understand most of the syntax I've been working with (sort of) but I can't get my head around this one....
The script is based on one from the thread "[AS] Indesign CS - place image into existing frame" (thanks Matt McGregor and Shane Stanley).
**begin script**
-- Thanks to all Adobe Forums contributors for generously publishing sections of code which new users can use to build their own
-- This version selects images from a specific folder
-- Script needs to be altered to automatically select the relevant "eps files" folder
tell application "Finder"
set dsFolder to "Macintosh HD:Users:Design:Desktop:Scripting:8076707_Qld WC:eps files:"
set dsPics to every item of folder dsFolder
end tell
tell application "Adobe InDesign CS2"
set dsDocument to active document
set dsLayer to layer 4 of dsDocument
tell dsLayer
set FrameNo to 1
repeat with dsPicItem in dsPics
place dsPicItem as alias on rectangle FrameNo of dsLayer
fit rectangle FrameNo given content to frame
set FrameNo to (FrameNo + 1)
end repeat
end tell
end tell
**end script**
How does the script understand the term dsPicItem when it hasn't been defined?
How does the script know to place one instance of each image (rather than, say, repeating the first image in every frame)?
Thanks in advance,
Dwayne Smith

On 3/7/08 1:46 PM, "myDwayneSmith" <[email protected]> wrote:<br /><br />> How does the script understand the term dsPicItem when it hasn't been defined?<br />> How does the script know to place one instance of each image (rather than,<br />> say, repeating the first image in every frame)?<br /><br />When you say "repeat with dsPicItem in dsPics", you're saying to put a<br />reference to the first item of dsPics into dsPicItem, then next time around<br />put the second item, and so on. It's just a shorter way of saying:<br /><br />repeat with i from 1 to count of dsPics<br />set dsPicItem  to item i of dsPics<br /><br />Sometimes it can cause problems (because of the way references work), so the<br />"longer" way is a better habit to get into.<br /><br />-- <br />Shane Stanley <[email protected]>

Similar Messages

  • Automatically placing images into frames?

    Hello all, I really hope im in the right part of this forum
    anyway, I work at a print shop, we layout our gang runs in indesign, our files are automatically renamed to 88888-F.xxx and 88888-B.xxx (front/back, xxx being the extension jpg/pdf/tiff/etc)
    the layouts are vertically symmetrical
    is there anyway I can manually drag 88888-F into its frame and have 88888-B automatically be placed into the frame on the other side?
    Thanks in advance!

    I not aware of a process that allows you to use a manual drag and drop.  Not sure if the event listener would work here. What you could do is using the ImageCatalog.jsx that comes in the sample JavaScript is create a script that selects a folder or files and places then in the order you require.

  • How do I align a placed image in a frame using JS?

    I am new both to javascript and to scripting for InDesign, so please bear with me on this question.
    I am trying to align an image in a graphic frame so it aligns to the top right corner of the frame.
    I can do this using the InDesign interface by following these steps:
    1. Create a rectangular frame.
    2. Right-clicking the frame and selecting "Fitting > Frame Fitting Options."
    3. Selecting the top-right square in the "Alignment" area of the Frame Fitting Options dialogue.
    For me, this automatically aligns the image to the top right corner in the selected text frame, even if there is a placed item in the frame.
    I am trying to apply this to the actual image frame using the following code where "modelFrame" is the rectangle that is the parent of the placed image:
              modelFrame.frameFittingOptions.fittingAlignment.anchorPoint = AnchorPoint.TOP_RIGHT_ANCHOR;
    I am not getting an error, but I am also not getting the desired results (in fact, it doesn't change anythign at all). What am I doing wrong?

    Hi lanejd,
    I have got the same issue as you but had just found the solution. Please see below:
    modelFrame.frameFittingOptions.fittingAlignment.anchorPoint = AnchorPoint.TOP_RIGHT_ANCHOR;
    This will only set the properties for the Frame Fitting Options. You will need to call a method/function. Add the below line to your script and it will execute the Frame fitting Options.
    modelFrame.fit(FitOptions.applyFrameFittingOptions);
    Hope this help!

  • CS3-style of placing the images inside frames in CS4.

    Hi everyone,
    I'm trying to find a way to have the cs3 - style of placing the images into frames in the new Indy CS4. I mean when I hit cmd+D and draw a frame I don't want any scaling / fitting of the placed image. I know there's no scaling if you drop an image into existing frame but when you draw one on-the-fly it's either the frame that keeps the proportions of the image or when you hold shift the image gets scaled to fit into.
    I'd rather have the old style placing as an option - but didn't find such a switch anywhere in the prefs.
    Thnx.
    R.

    Interesting request. I wouldn't have thought anyone would want the older way of creating images in frames, but I guess there's always someone who wants the old ways.
    I can't find any preference to restore the behavior back to the pre-CS4 way.
    But if you want to work with images the old way, you can. Your commands are just a little different, in a different order. But you may actually save a step.
    Consider:
    b In CS3 you had to do the following:
    1. Drag to create a frame.
    2. Switch to the Direct Selection tool.
    3. If desired, change the position the image inside the frame
    4. If desired, scale the image inside the frame
    5. If desired, use the Fitting commands to fit the image inside the frame.
    b In CS4 you have to do the following:
    1. Drag to create a frame.
    2. Switch to the Direct Selection tool.
    3. Scale the image inside the frame.
    4. Position the image inside the frame.
    However, step 5 is probably eliminated as you already started with the image fitting inside the frame.
    I agree no one likes to need to learn new work habits, but it's not such a big deal.

  • Add Strokes to Placed Images in Illustrator

    Hi All,
    I'm having a problem to add a stroke "frame" around my tiff image in Illustrator. My image is a "traced picture" from Photoshop. I used the following technique:-
    Technique: Use an Effect
    Choose File > Place and select an image to place into Illustrator document.
    Choose File > Place and select an image to place into Illustrator document.
    The image is selected. Open Appearance panel and from the Appearance panel flyout menu, choose Add New Stroke.
    With the Stroke highlighted in the Appearance panel, choose Effect > Path > Outline Object.
    However, the result I got was the stroke around the image NOT the frame around the image.
    How do I  achieve it. Any help and tips are greatly appreciated. Thanks in advance.

    Technique #1: Use a Mask
    This technique requires Illustrator CS3 and works only when your keyline will be rectangular in shape.
    Choose File > Place and choose an image to place into your Illustrator document. You can either Link or Embed the image. Once you've chosen the image, click the Place button.
    The image is selected (if your image already exists in your document, select it now), so if you look in your Control panel at the top of the screen, you'll see a button labeled "MASK". Click on it. This creates a mask at the exact bounds of the image.
    Press the "D" key for Default. This gives the mask a black 1 pt stroke attribute. Adjust the stroke per your design needs.
    NOTE: An additional benefit to this method of using a mask is that you now have the elements in place to simulate a "frame and image" paradigm like InDesign. Once you've created your mask, you can decide to "crop" your image by double clicking anywhere on the photo. This will put you into Isolation Mode. Now click on the frame edge and resize at will. When you're done, double click outside the image to exit isolation mode and continue working. This method works wonderfully when you're using the Selection tool (black arrow) and have the Bounding Box option turned on (in the View menu).
    Technique #2: Use an Effect
    At first, it may seem that applying a keyline with the use of an Effect is a tedious process. But we all know that once we've applied an effect, we can store it as a Graphic Style, at which point applying our keyline will become a single click. Go ahead, ask me why Adobe doesn't ship Illustrator with such an effect as a default setting in the NDPs (New Document Profiles). Go ahead, ask me why Adobe doesn't allow us to assign keyboard shortcuts to styles like InDesign does. I don't have answers to either of those questions (sorry). But let's get on with the styles, shall we?
    There are two separate effects that we can use, and each provides a different benefit.
    Choose File > Place and select an image to place into your Illustrator document. You can either Link or Embed the image. Once you've chosen the image, click the Place button.
    The image is selected (or if your image already exists in your document, select it). Open your Appearance panel and from the Appearance panel flyout menu, choose Add New Stroke. We can't see the stroke yet, because all we have is an image. But we'll change that in short order.
    With the Stroke highlighted in the Appearance panel, choose Effect > Convert to Shape > Rectangle. Check the Preview button, select the Relative option, and set both the Extra Width and Extra Height to zero (0). (Be careful not to press Tab after you enter the second value, or it will switch back to Absolute.) Click OK to apply the effect. Style the stroke attribute to match your design preference.
    Now make this easier to apply in the future. With the object still selected, open the Graphic Styles panel and click the New Graphic Style button at the bottom of the panel. Give the style an appropriate name. If you then add this style to your NDPs, it will be readily available in all new files that you create.
    Add Strokes to Placed Images in Illustrator | CreativePro.com

  • My InDesign program is printing my placed images lighter than illustrator.

    I am trying to print a colour logo in Indesign with black type on my inkjet printer.  The colours are appearing fine on screen and so is the black but when I print everything is washed out.  I tried just printing a black box and it appears black on screen but in print it is grey.  I have tried changing the preferences Appearance of Black to rich and accurate but that did not make a difference.  Do I need to do anything in color management I am using Indesign CS2.  How can I solve this problem?

    Acrobat worked, thanks for that advice.   I set my Convert to Profile under the Edit Menu to  Color
    Match RGB.  That helped a little bit but it is not printing like the
    pdf.  I would like to get this problem resolved. I normally use
    illustrator most of my work.  But I would like to have InDesign working
    properly as I need it to do other jobs.
    Take Care,
    Jen
    Take Care,
    Jen
    Date: Fri, 14 Aug 2009 14:24:47 -0600
    From: [email protected]
    To: [email protected]
    Subject: My InDesign program is printing my placed images lighter than illustrator.
    Jen,
    This is a problem that you have no time to fool with, correct?
    When printing from InDesign and all looks hopeless, export to PDF and print from the PDF.
    Why?
    I don't know for sure but it seems all printers made recently accept PDF better than straight from InDesign. It could be the printer driver and it could be InDesign but you don't have time to mess with it now. Wait for some free time to sort it out, but for now output to PDF and print from Adobe Reader or Acrobat.
    >

  • Strange stiching white lines in placed images...

    Hi,
    I'm having some problems with Illustrator CS2.
    When i place a .PSD file (1 layer, photo, transparent background) with 300 dpi / CMYK 8bit into my main page, i get these strange stitching white lines over the image.
    Not only that, but after working on my arrangement some more, if i click my placed image, i notice how Illustrator has sliced it into 2 or more parts..
    This is annoying, since getting those white stitching lines doesn't really make me safe for print, and also bothers me that Illustrator slices the image into 2 or more parts without asking or confirmation.
    Anyone knows how i can fix this problem?
    Thanks,
    John

    Hi,
    I'm having some problems with Illustrator CS2.
    When i place a .PSD file (1 layer, photo, transparent background) with 300 dpi / CMYK 8bit into my main page, i get these strange stitching white lines over the image.
    Not only that, but after working on my arrangement some more, if i click my placed image, i notice how Illustrator has sliced it into 2 or more parts..
    This is annoying, since getting those white stitching lines doesn't really make me safe for print, and also bothers me that Illustrator slices the image into 2 or more parts without asking or confirmation.
    Anyone knows how i can fix this problem?
    Thanks,
    John

  • Placed image hides graphic objects on master

    Mac OS 10.8 \ ID CS5
    Rectangular frame created on master \ photo corners created in InDesign for each of the four corners
    In the document page when an image is placed in the frame, the image hides the portion of the corners that lie within the frame
    I tried bring to front for corners - no joy - can't seem to send frame to back
    I can copy the corners from the master page and paste in place on the document page - works fine - full corners show with image below
    With 50-75 anticipated pages and about 75 photos, I need a better way. Help, please?
    Message was edited by: FroggyGreen

    Make a new layer (above the current one).
    Go to your Master page and move the elements you want in front to the new layer.

  • Placing images at an exact scale in Indesign CS5?

    Hi all,
    I'm hoping someone can clue me in here... I've just updated from Indesign CS3 to CS5. I was hoping in the upgrade Indesign would give you an option for placing images in picture frames at an exact scale (like you can in Quark), for instance if you place an empty picture box on the master pages and enter 55% scale you would drop in images on each page of the layout at 55% scale.
    In Indesign CS3 the closest I could get to that was to place an "FPO" image in the picture boxes on the master pages at 55% scale, then when I'd replace each FPO on the layout pages with my images they would drop in at 55% scale. It worked pretty well.
    With CS5 I'm finding that when I replace an FPO image it will still drop in at the same scale the FPO is at, but ONLY if you load and place one image at a time... if you load, say, twenty images and drop them into the layout replacing the FPO images, they come out as prorortionally fitted to the picture frame... NOT as 55%.
    this is a real issue for me as I routinely work on layouts where I need to place 400 and up images at an exact scale...
    Anyone know a work around here, or any tips?
    Thanks in advance.

    As far as I know, you can't set scaling for a empty frame. You can use a placholder image and scale that, and if you turn off relink preserves dimensions relinking to a new image would preserve the scaling, but only if you do it one at a time through the links panel. Using the Place command and replacing theimages will not preserve the scaling, so through the interface there isn't much help.
    On the other hand, I think this could be scripted. If you need all the images to be the same scale it should just be a matter of looping through the document images and setting the scale. If none of the scripters are taking notice here, ask over in the scriping forum.

  • Cant' move images from frame to frame inside a Grid in InDesign. Please Help

    When creating a grid in indesign there is an option to move images from frame to frame, and having them rotate around the frames to see where each image is best to be placed. Example I created a grid with 6 images (2 rows and 3 columns) and now i want image 1 to be where image 6 is. I know there's a way by hitting the arrows and some other keys and have all the images start rotating. I did it once I just can't remember. Please help. How do you move the an image from one frame to another frame without having to go to edit place?
    Thanks,
    Paola

    Swapping images

  • Ctrl + D, Placing images

    Hi,
    I am very new to InDesign. I have a question on placing images in CS 4. In the pages I create a frame 420 x 320 and then I place a image of the same size into the frame. The images are all the same size as the frame, it is a photo album, all images are JPEGs. 80% of the time the images paste perfectly, the other 20% they are a thumbnail and I have to drag them to size. Why does that happen? Any ideas?
    Thank you in advance for any input you can give me.
    Keith

    You give the measurement of the frame size, but not the units. This suggests that you are referring to pixels, which is a unit unavailable (and inapplicable) in InDesign. The likely cause of your problem is that these images have different pixel-per-inch (ppi) settings. Open each in Photoshop or another image editor and go to Image Info. Then give them consistent resolution, as measured in PPI. Be sure to turn OFF "Resample", then save. If they are JPEGs save as another format, like PSD or TIF.

  • Difference between CS3 and CS4 when placing images, percentage not kept

    There is some kind of difference between CS3 and CS4 when placing images. The images I've dealt with right now were vector images but it might apply to all kinds of images.
    When replacing an existing image, the CS4 behaviour is to let the image fill up the frame. In CS3 the percentage was set to 100% as default (the % you see when selecting the image, not the container).
    Also when replacing an impage in CS4, the "inner" image frame is kept, while in C3, the percentage was kept.
    Is there some kind of placement preferences / settings to let CS4 act the same wat as CS3 did, when placing an image?
    -- Andreas

    Yes, the behavior was changed in CS4 (and many users, like me, prefer the new system).
    If you click and drag a loaded image place cursor the entire image will be be scaled to fit the proportionally drawn frame -- a huge timesaver if you mostly place uncropped art. If you want 100% of the image at 100% scale, just click and release -- same as before, or as before you can pre-draw a frame and place into it and your image will come in cropped at 100% (unless you've changed the fitting options for the frame before placing).
    Peter

  • How to find out the Pixel Dimensions and Document Size of placed images?

    Is it possible to find out the placed image details like Pixel Dimensions(Width,Height) Document Size(Width,Height) in illustrator through scripting. Kindly advice me with some examples.

    http://www.adobeforums.com/webx/.3bbaa316.59b84fd8
    I hope the snippet therein will get you started.
    But after all, when you place an image via pi=layer.placedItems.add() it should pop in with its default dimensions, so that you have pi.height and pi.width ready.
    Is this what you are aiming at?

  • SCRIPT TO IMPORT MULTIPLE PLACED IMAGES..AND OUTPUT MULTIPLE IMAGES TO SINGLE PDF.

    Anyone got a script to import multiple placed images into CS4? or is this possible in CS5?
    and can we output multiple layers into a single PDF in illustrator?  Or multiple layers into single JPEGS from illustrator with one command instead of individually saving out each page... would be a huge time saver for me.
    Currently I output each completed layer individually and then right click those outputted jpegs in their output folder and choose "combine supported files into acrobat..." to make a single acrobat file..
    I`d also like to be able to CTRL click multiple layers and go save as... only those layers get saved out...
    And so adding something in the Save for PDF output dialogue box to save layers to multiple pages would be a helpful time saver..

    In CS 4 and CS 5 you can drag and drop fro m the finder or the Bridge, and I guess any other similar type viewer, multiple number of image files to a document. You can configure the bridge in such a way as to allow you to see the Bridge and your document at the same time for this very purpose.
    If you just drag and drop the files are linked if you drag while holding the shift key then the files will be embedded.
    ID and PS CS 5 have a minibridge which works the sam way but is an actually panel and will stay in the front.
    I separate the images but they import one on top of another.

  • Create Pattern Swatch from Placed Image in Javascript

    I need to create a large number of pattern swatches from some .jpg file on disk. I've figured out how to script the insertion of the .jpgs into my AI document as placed images:
         // Embed the image into the document.
         file = new File("MyImage.jpg");
         var document = app.activeDocument;
         var newPlaced = document.layers["swatches"].groupItems.createFromFile(file);
         newPlaced.name = "MyImage_Placed";
    This works fine and the item shows up in the correct layer as an embedded image.
    Now I want to create a PatternSwatch (I think) from that Image.
    To create a new swatch the code starts out as:
         newSwatch = document.swatches.add();
         newSwatch.name = "MyImage_Swatch";
    but now I'm stuck! How do I associate the new PlacedItem with the swatch I just created? I can see the swatch in the palette so I'm partway there.

    When you say you would drag the image itself into the Swatch Palette and it would show the image itself? How would then use this swatch? Can you give an example of what you would apply a jpeg to as a swatch? The only palette that I can think of off the top of my head that you can drag a jpeg into and have the icon appear as the jpeg is the Symbols Palette. Is is possible that you were using the Symbols Palette in the past and not the Swatch Palette?

Maybe you are looking for