Image palcement JS

Hi folks
I have one old script and it was working very fine for InDesign CS2. I am learning JavaScript, and I want to convert it in JavaScript. Can any one help me out.
===============
tell application "Adobe InDesign CS3"
tell document 1
set baselineVar to "Yes"
set countVar to 0
set imageCount to 0
set docPath to file path as alias
tell application "Finder"
set imageFolder to folder (choose folder with prompt "Please choose the folder containing the appropriate MathType files")
end tell
activate
set allStories to stories
repeat with s from 1 to count of items of allStories
set theStory to item s of allStories
if class of theStory is story then
set theLim to count of words of theStory
try
repeat with i from 1 to theLim
if word i of theStory contains "<<" then
set theText to contents of word i of theStory as Unicode text
set ImageStyle to "Body"
if name of applied paragraph style of word i of theStory contains "q" then
set ImageStyle to "Test"
end if
if name of applied paragraph style of word i of theStory contains "ans" then
set ImageStyle to "Test"
end if
set theOffset to (offset of "<<" in theText)
set endOffset to (offset of ">>" in theText)
set imageName to characters (theOffset + 2) through (endOffset - 1) of theText as string
set imageFolderPath to ((imageFolder as string) & imageName)
set wholeTag to characters theOffset through (endOffset + 1) of theText as string
if baselineVar = "Yes" then
set baseline shift of characters theOffset through (endOffset + 1) of word i of theStory to -10.2
end if
delete characters theOffset through (endOffset) of word i of theStory
tell theStory
tell word i
tell character theOffset
place imageFolderPath as alias
set countVar to (countVar + 1)
end tell
end tell
end tell
end if
end repeat
end try
end if
end repeat
end tell
activate
if countVar = 0 then
display dialog "No Images were found" buttons "OK" default button 1 with icon 2
else if countVar = 1 then
display dialog "1 lonely Images has been placed." buttons "OK" default button 1
else
display dialog (countVar as string) & " Images have been placed." buttons "OK" default button 1
end if
end tell
===========
Below is the JavaScript for InDesign CS3. Not completed it in process.
=================
//Initializing the front document.
var myDoc = app.activeDocument;
var baselineVar = true;
var countVar = 0;
var imageCount = 0;
var docPath = myDoc.documentPath;
var myGraphicFolder = Folder.openDialog ("Choose Folder which contains images");
var allStories = myDoc.stories;
with (myDoc)
==============

Hi Dave,
Thanks, what side-effect i will get it. I heard that we can do everything with JS as compare to AS.
If really any problem then I will stop myself to work on it. But first I want to know the reason first.
Thanks

Similar Messages

  • Office 2011 - Can't use "command v" to paste images or anything

    So in all previous iterations of Office that I've used, when you are in a document (be it Word or the email client, now Outlook) and hit the buttons "command-v" the result is that the program pastes whatever is on your clipboard.  If you have an image on your clipboard, that pastes into Word/Outlook.  If you have a pdf, it tries to paste that.  This is especially useful for an email client and attachments.
    However, when I hit "command-v" in either Word or Outlook, it pastes the image name (e.g., CIMG3279.JPG) rather than the image itself.  I tried this with a pdf as well -- same problem. 
    I first thought this was an Outlook problem, but then it happened in Word.  Then I thought it was a Lion problem, but when I used the mail.app, it pasted as expected.  
    Now, I just upgraded to a new iMac, Lion, and Office 2011 -- all at once.  So I am not positive that it is Office 2011 -- but I am pretty sure given that the paste function works correctly in mail.app.   I googled the **** out of this and did not find anyone with a similar problem.
    Anyone have an idea what setting is off my Office?  Or is this a new "feature"? 
    Any help is appreciated.   Thanks. - M.

    Some things are a bit odd (to me, anyway) in Lion, though I'm getting used to them.
    For example, if you click on an icon on the desktop and press Command-C, then open TextEdit to a blank document set to RTF, then press Command-V you'll get the image; but if you select Paste and Match Style in the Edit menu, you'll get the name of the file instead.
    What usually works consistently across most apps with image files and PDFs is to drag and drop the file into the document you're working with - email, word processing doc, etc. If the source file is an image, you'll get the image palced in the target doc; if the source file is a PDF, you'll get the PDF (usually in its own scrollable window).

  • More insight on divs with fluid grids please!

    Help me come further up the CS6 fluid grid learning curve, please!
    I'm adapting an exiting site to fluid grids. After creating the template for the primary pages, I have two major issues at this point(yeah, only two, SO FAR).
    1- I have a vertically expanding menu in the first layout div. For tablets, I want to preserve the left grid column space for the menu, regardless of its length, and all other content would use just the right gid columns. But when the menu happens to be short, the "excess" content floats left under the menu grid columns. How can I force main page content to only occupy the right grid columns, regardless of the length of the menu?
    As a side point to the menu, what happens when I try to put this (or the footer) all back in an SSI, as it originally was?
    2 - I've seen the note about no support for nested layout divs. Thru trial and error, I'm still trying to figure out just what this means. Pragmatically, what is the greater implication of this?  Can format be controlled only on fluid grid layout divs? Can't I have divs inside of a grid layout div to control image palcement around the text for instance? I've had hit=n-miss experience with this so far.
    Can anybody point me to a more in-depth discussion on this topic?
    Sorry if this ol' dog seems like he's learning div layout all over again. But hey! That IS how it feels!
    Thanks for any education, or pointers to such, that you can provide.

    Not sure I completely understand what you want. But in this example, I have set nav and LayoutDivs 5, 6, 7 to display:none  in smaller devices.
    http://alt-web.com/FluidGrid/Fluid2.html
    I did this inside a media query within my Content.css file:
    /* Special Rules for Mobiles. */
    @media only screen and (max-width: 480px) {
         /**hide some divs**/
         nav, #LayoutDiv5, #LayoutDiv6, #LayoutDiv7 { display: none }
         /**show jQuery buttons**/    
         #togglenav { display: block }
         #showDivs { display: block }
    Then I used a simple jQuery toggle to show/hide divs.
    http://jsfiddle.net/NancyO/AP9Hm/
    Nancy O.

  • Create an action to palce an image into artbox

    I would like to create an action to place an image into the artbox of a pdf document?

    Really a job for InDesign.

  • Image Link Problem with Dreamweaver CS4?

    On my website, I have several images that link to other parts on my website. These work no problem when I preview the site, but after I test the links, the images that had those links have purple outlines that really clash with my website's design. Will users see this if they click on my links, and then return to the page? I'm using CS4 right now, and never recalled having this issue come up when using MX. Thanks for the help.

    I got stuck on this one too - not realising that Dreamweaver automatically palces a border on every image link - but the simplest way I found was to have my "Properties" panel showing on the bottom and input 0 into the "Border" box. By having this panel open you can see if you have accidently applied any styles to the image, where it links to, Image size attributes and the Image name.

  • Pixelated images (with High Quality Display turned on)

    Here's my problem: The images look sharp on the internet, but when I download them, place them in Indesign and print them, the look pixelated!
    Take this one for example: http://media.smashingmagazine.com/images/typefaces/productus.gif
    It's resolution is 72 ppi. But when I place it onto the Indesign A4 page (or Letter format for that matter) it occupys almost entire width of the page.
    Why is it so? Why is it so big by default without enlarging it? It's kinda logic that a small 72 ppi image stretched across the whole page will appear blurry when printed on 300 dpi printer.
    So how can I set the indesign page to 300 ppi/dpi so images with lower restion will appear smaller when placed on the page and - will be printed sharp?

    mike.n03 wrote:
    Where can you specify this preference?
    And you mean there's a script for InDesign? Wow, it would be cool to get it. So far I solved that problem by recording an Action in Photoshop and than apply it to all the images using Batch command.
    Preference is down at the bottom of the File Handling section ...  Check the bos to preserve dimensions and a the relinked file will be scaled back to the same size in ID. Uncheck, and the scale percentage will be preserved.
    Almost anything is scriptable in ID (but I don't write them). I recall a script that was posted a year or two ago that would allow you to select an image and type a desired effective resolution into a dialog. The image would get scaled to reach that effective ppi. Your batch action in Photoshop is fine, and useful if you want to palce everything at 100%, but it isn't required to change the resolution in Photshop to achieve what you want. Scaling in ID is exactly the same thing as changing the resolution without resampling in Photoshop. No pixels are added, removed or altered -- only their dispalyed size is changed. If you want a script to set all images to 300 ppi effective resolution, you should probably pay a visit to the scripting forum.

  • How to retrieve am image from database

    hi ,
    i hav a requirement that, i hav to store and retrive an image from database(postgresql)and palce it on JLabel.i successfully stored an image into database .while retrieving an image from database im not getting the image .please any one can help me how to retrieve an image and place it in JLabel.
    This the code for inserting an image:
    Class.forName("org.postgresql.Driver");
    Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:port/database", "username", "pwd");
    System.out.println("Connection established");
    String INSERT_PICTURE = "insert into imagedata(imageid,data) values (?, ?)";
    FileInputStream fis = null;
    PreparedStatement ps = null;
    try {
    conn.setAutoCommit(false);
    File file = new File("photo.jpg");
    fis = new FileInputStream(file);
    ps = conn.prepareStatement(INSERT_PICTURE);
    ps.setInt(1, 2);
    ps.setBinaryStream(2, fis, (int) file.length());
    ps.executeUpdate();
    conn.commit();
    catch(Exception ex)
    ex.printStackTrace();
    finally {
    ps.close();
    fis.close();This is the code for retrieve an image :
    Class.forName("org.postgresql.Driver");
    Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:port/database", "username", "pwd");
    byte[] imgbytes = null;
    String INSERT_PICTURE = "select imageid,data from imagedata ";
    Statement stmt=(Statement) conn.createStatement();
    try {
    ResultSet rs=stmt.executeQuery(INSERT_PICTURE);
    while(rs.next())
    System.out.println(rs.getString(1));
    InputStream file=rs.getBinaryStream(2);
    System.out.println("FILE : "+file);
    catch(SQLException a)
    finally {
    stmt.close();please anyone can help meee
    thanks

    You basically save a File to the database, so you can just re-write the data from the file back temporarily and load it into the application using the ImageIO class
    // create necessary connection and statement objects
    // retrieve image column
    ResultSet rs = stmt.executeQuery("SELECT Image FROM dataTable");
    rs.next();
    Blob imageData = rs.getBlob("Image");
    if( imageData != null ) {
        try {
            File tmpFile = new File("tmpImage");
            FileOutputStream fos = new FileOutputStream(tmpFile);
                fos.write( imageData.getBytes(1L, (int)imageData.length()) );
                fos.close();
            tmpFile.deleteOnExit();
            ImageIcon icon = new ImageIcon( ImageIO.read(tmpFile) );   
            JOptionPane.showMessageDialog(null, icon);
        } catch(IOException ioe) {
            ioe.printStackTrace();
            JOptionPane.showMessageDialog(null, "Failed To Load Image Data", "Load Error",
                    JOptionPane.ERROR_MESSAGE);
    }ICE

  • Problem setting different width for images using HorizontalList tag

    Hi,<br />I succeeded using HorizontalList in my AdvancedDataGrid,<br /><br />  <mx:groupedColumns><br />...<br />...<br />  </mx:groupedColumns>  <br />  <mx:rendererProviders>            <br />        <mx:AdvancedDataGridRendererProvider   <br />            dataField="Actual" <br />            renderer="ChartRenderer" <br />            columnIndex="3" <br />            />         <br />    </mx:rendererProviders>  <br /><br />My Chartrenderer:<br /><br /><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" <br />     xmlns:local="*"><br />  <mx:Script><br />    <br />          import mx.collections.ArrayCollection;<br />          import mx.controls.Image;<br />          private var images:Array;                <br />          private var catalog:ArrayCollection;          <br />          private static var cat:Array = [<br />              "kpi_overtime_bar_10.png", "kpi_overtime_bar_20.png",<br />              "kpi_overtime_bar_30.png", "kpi_overtime_bar_40.png"<br />           ];<br />          <br />                    <br />           private function initCatalog(items:Array):void<br />           {<br />              catalog = new ArrayCollection(items);<br />              myList.dataProvider = catalog;<br />           }<br />                                     <br />      <br />    </mx:Script><br />     <mx:VBox height="20" width="40%" xmlns:mx="http://www.adobe.com/2006/mxml"<br />          horizontalScrollPolicy="off" <br />          verticalScrollPolicy="off"><br />          <mx:HorizontalList width="100%" id="myList"  <br />               horizontalScrollPolicy="off"<br />               verticalScrollPolicy="off"<br />               columnCount="4" <br />               creationComplete="initCatalog(cat)"><br />              <mx:itemRenderer><br />                    <mx:Component><br />                         <mx:Image width="50%" height="20"<br />                              maintainAspectRatio="false"/>                                <br />                    </mx:Component><br />               </mx:itemRenderer><br />          </mx:HorizontalList><br />     </mx:VBox><br /><br /></mx:Application><br /><br />This is a test I've done to see if I can palce a list of images in a cell,<br />and I can :)<br /><br />I have 2 problems:<br /><br />1. Here the size of each image is contant, I need a way to set each image in the list to be different,<br />Can I do it? <br />2. I need to load the images dynamically and not from a fixed Array,<br />Can I do it?<br /><br />It will be great to get help.....<br />Thanks<br />Jo

    On Sunday 15 Feb 2009, Yossi Bar wrote:
    > I think not all my descussion detailes were shown,
    I think you should be asking on FlexCoders...
    Tom Chiverton
    Helping to collaboratively enable 24/7 plug-and-play portals
    This email is sent for and on behalf of Halliwells LLP.
    Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the
    registered office together with a list of those non members who are referred to as partners. We use the word partner to refer to a member of the LLP, or an employee or consultant with equivalent standing and qualifications. Regulated by the Solicitors Regulation Authority.
    CONFIDENTIALITY
    This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500.
    For more information about Halliwells LLP visit
    www.halliwells.com.

  • Image on Displaying for IBOT in Outlook 2003

    Hey Everyone
    I Succesfully Extecuted the IBOT based on a Conditional Request, Everything is working fine but I am unable to display the Image on the EMAIL ( I am sending the email as HTML Format) , My BI Server and Answers request has an image on it.
    I dont think its an Outlook problem because i chnaged the Configuration settings to download the image from Internet in outlook.
    Do i need to store the images at another palce for IBOT Delivery , Please help me out
    Thanks

    Hi Joe ,
    Thanks for the reply and below is the Information.
    BI Server OS - Linux ,
    Database server OS - Linux ,
    Database type and version Oracle 10.2.0.4.0,
    OBIEE version - 10.3.1.4,
    mail server - SMTP
    Link to the Picture -
    http://picasaweb.google.com/sri.oradev/OBIEE#
    here i want the SPECTRUM Logo to be displayed in my Email , I tried sending the Email as a PDF attachment its sending the Email but it is not decoding the image properly and i cannot open the PDF .
    I Got some Insight of why the problem is coming up - Because we are just referencing the Image Dircetory using @{fmap:images/spectrum_logo.gif} the IBOT doesnt know where to download the picture from ? I tried to give the full path of the Image directory but its not taking the full path of the image in the header i tried to give the location like @{fmap:c01/app/oraclebi/web/app/res/s_oracle10/images/spectrum_logo.gif} but its not recognizing
    Thanks for your help
    Edited by: Srix on Jan 14, 2010 7:46 AM

  • JS InDesign: download and embed image

    Hi,
    I need my script to palce an eps file into myLogoFrame from my desktop. This what I was able to find in OMV:
    myLogoFile.itemLink  = desktop.myFolder("MyLogo.eps");
    myLogoFile.place ("ND MastHead.eps", true, embed) = myLogoFrame;
    I need the file to be placed into specific frame and I need to be able to specify the full path name of the source file, and then embed the file into InDesign.
    I realize that this is might not even be on the right track, I am not sure where to look for more information.
    Your help is highly appreciate.
    Yulia

    Hi,
      We did the same. When we save new .INDD file and open the file in ADOBE, Images does not show up? Any idea
    Vish

  • Placing image as template

    Hi
    I have a constant logo which has to be palced at the left bottom of the image with 10 mm distance.
    The images sizes are differnt.
    Could any help on the above request.
    Regards,
    Vinoth

    You may be able to fix the template by opening it, going to image>resize>image size or resize image, depending on your PSE version, then set the document resolution to 300 ppi with Resample Image unchecked and see if that does what you want.

  • Image with multiple handles

    Hi,
    I cut and paste image from Adobe Illustrator into Indesign. I am puzzled and confused to see 3 various handles. I just want to scale the image however each time I have scaled down wrongly. The image seems to be cropped and hidden. Below is my screen shot. Any help is really appreciated. Thank you.

    Why is this coming from Illustrator? It's a raster image and should be PLACED, not pasted, as an image. The ONLY non-text content you should consider pasting (unless it is copied from palced content in an ID document) is simple paths, never rasters.
    In the sample file you snet me there are a couple of things going on. You have two images. Both need frames when thay are pasted, and the lower image is simply inside the frame that ID created when you issued the paste command with nothing selected. The upper image is more confusing because the image is inside a frame, and THAT frame is inside another frame (this appears to be the case inthe screen shot above, too). I suspect you might have drawn that frame first, then used Paste Into, but I have no way of telling. Depending on the structure, and the tool in use, you can select either the container frame or the content (double-clicking with the selection tool will cycle through container/content selections). In you case all of the frames are on the default layer and their bounding boxes are blue, The images contained inside the frames will have brown bounding boxes when they are selected instead of the container.
    You can move the image around inside the frame that contains it, and if you have one frame inside another you can move the inner frame around inside the outer. Your scaling will be applied (if you are scaling and not just cropping -- use the modifier keys with the mouse as explained to you in another thread if you need to scale, or use the scale fields, scale tool or free transform tool inistead of the Selection tool) to both the frame and its contents if you select the frame, but only to the image if you select it directly.

  • HOW TO: set anchoredObjectSettings for .palce() object?

    Hi, I'm currently working on interesting script for GREP placing, and I'm wondering how I can set anchoredObjectSettings for .palce() object?
    for(i=0; i < found.length; i++)
        foundElem = new File (myFolder + "/" + found[i].contents);
        found[i].place(foundElem); // Placing Ancored Object
        // HERE IS WHERE I NEED SOME HELP: how to set "anchoredObjectSettings" for just placed Ancored Object
        //anchoredObjectSettings.anchoredPosition = AnchorPosition.ABOVE_LINE;
        //anchoredObjectSettings.horizontalAlignment = HorizontalAlignment.TEXT_ALIGN;
    Here you can download example files - script, InDesign file and images, that should be placed into InDesign file with script
    Dropbox - GREP placing.zip
    PS: I believe this script will be very useful, so if anybody have any ideas/suggestions, and want to help me with further development - this would be great!

    Hi Kai, this script is still under development, here is updated version attached (now it can also place files/images by file name only, without extension):
    #target indesign;
    //#include  "! Basic functions.jsx"
        GREP place files.
        This script will ask to select source folder with files to place,
        and then, with dialog box (or prompt) [this is not implemented yet, so I use static GREP value while developing]
        will ask to type GREP find expresion to search for text placeholder, that need to be replaced with file from source folder we just selected.
        TODO: Check how it works with other than image formats
            Also, this might be usefull to make anchored frame with column widh, and fit image proportionally
    scriptName = decodeURI(File(app.activeScript).name.slice(0, -4)); // detect name of current script without expression
    function Alert(msg) // function for native-looking alerts
        w = new Window ("dialog", scriptName, undefined, {closeButton: true});
        w.preferredSize = [300,75]; // window width and height
        w.margins = 15; // window margins
        w.orientation = "column";
        w.alignChildren = ["left", "top"];
        w.add("statictext", undefined, msg);
        close = w.add ("button", [0,0,96,20], "OK", {name: "Ok"});
        close.alignment = ["right", "bottom"];
        close.onClick = function(){exit();}
        w.show();
    main();
    function main()
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
        if(app.documents.length == 0)
            Alert("No documents are open. Please open a document and try again."); exit();
        else
            //> START OF doUndoWraper
            if (parseFloat(app.version) < 6) // "app.version < 6" if it's running under an earlier version than CS4, as earlier versions don't support "Undo" in scripts
                doUndoWrapper();
            else
                app.doScript(doUndoWrapper, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, scriptName);
            //< END OF doUnoWraper
    function doUndoWrapper() // this is the wraper function UNDO everything script made  by single undo
    {// START OF doUndoWrapper
    defaultGREPexpression = "(?i)^[a-z0-9 _-]+\\.\\w{2,4}$"; // Paragraph that starts with upper or lower case latin character, digits, spaces, hyphen or underscore, and ends with .extension
    var myFilteredFiles;
    var myExtensions = []; // initialize array
    myExtensions.push(".jpg", ".jpeg", ".png", ".gif"); // raster images
    myExtensions.push(".psd", ".tif", ".tiff", ".pdf"); // raster images (layered)
    myExtensions.push(".ai", ".eps", ".svg", ".cdr"); // vector graphics
    myExtensions.push(".mp3"); // audio files
    myExtensions.push(".mp4"); // video files
    myExtensions.push(".swf"); // flash files
    myExtensions.push(".doc", ".docx", ".rtf", ".txt"); // text documents
    myExtensions.push(".xls", ".xlsx"); // table documents 
    //Display the folder browser.
    if(app.activeDocument.saved) // our document was saved before - we suggest to start search for source folder from were InDesign file saved
        var myFolder =  Folder(app.activeDocument.filePath).selectDlg("Select the source folder with files for placing", "");
    else // file was not saved before, so we don't know where to search > suggest to start from Desktop
        var myFolder = Folder.selectDialog("Select the source folder with files for placing", "");
    if(myFolder) // if folder was selected
        //Get the path to the folder containing the files you want to place.
        var files = new Object(); // This will assoc array with FILE_NAME => FILE_EXTENSION
        if(File.fs == "Macintosh")
            myFilteredFiles = myMacOSFileFilter(myFolder);
        else
            myFilteredFiles = myWinOSFileFilter(myFolder);
        if(myFilteredFiles.length != 0) // success: we have found supported files to place
            for(i = 0; i < myFilteredFiles.length; i++)
                var filename = myFilteredFiles[i].fsName.toString().replace(/^.*[\\\/]/, ""); // now we get only file names with extenstions
                var file = [];
                file = filename.split("."); // separate file name from file extension         
                files[file[0]] = file[1]; // write FILE_NAME => FILE_EXTENSION as assoc array
        else // error: There is no supported files for placing in specified folder
            Alert("ERROR: There is no supported files for placing in specified folder.");
            exit();
    else // ERROR: we have not choose source folder
        Alert("Folder with source files was not specified"); exit();
    //Windows version of the file filter.
    function myWinOSFileFilter(myFolder)
      var myFiles = new Array;
      var myFilteredFiles = new Array;
      for(myExtensionCounter = 0; myExtensionCounter < myExtensions.length; myExtensionCounter++)
            myExtension = myExtensions[myExtensionCounter];
            myFiles = myFolder.getFiles("*"+ myExtension);
      if(myFiles.length != 0)
                for(var myFileCounter = 0; myFileCounter < myFiles.length; myFileCounter++)
      myFilteredFiles.push(myFiles[myFileCounter]);
      return myFilteredFiles;
    function myMacOSFileFilter(myFolder)
      var myFilteredFiles = myFolder.getFiles(myFileFilter);
      return myFilteredFiles;
    //Mac OS version of file filter
    //Have to provide a separate version because not all Mac OS users use file extensions and/or file extensions are sometimes hidden by the Finder.
    function myFileFilter(myFile)
        var myFileType = myFile.type;
        switch (myFileType)
            case "JPEG":
            case "EPSF":
            case "PICT":
            case "TIFF":
            case "8BPS":
            case "GIFf":
            case "PDF ":
                return true;
                break;
            default:
            for(var myCounter = 0; myCounter<myExtensions.length; myCounter++)
                var myExtension = myExtensions[myCounter];
                if(myFile.name.indexOf(myExtension)>-1)
                    return true;
                    break;
      return false;
    //> START OF GREP expression dialog
    w = new Window ("dialog", scriptName+": specify expression", undefined, {closeButton: true});
    w.preferredSize = [300,75]; // window width and height
    w.margins = 15; // window margins
    w.orientation = "column";
    w.alignChildren = ["left", "top"];
    panel = w.add("panel", undefined, "Find what: (GREP expression)");
    if(app.findGrepPreferences.findWhat != "")
        grepExpression = app.findGrepPreferences.findWhat;
        clearFindWhat = false;
    else
        grepExpression = defaultGREPexpression; // use default GREP expression
        //fgrepExpression = "\\[.+\\]"; // \\< means "begining of the world", and \\> means end of the world;
        clearFindWhat = true;
    var grepExpression = panel.add ("edittext", [0,0,270,20], grepExpression);
    grepExpression.active = true;
    panel.add("statictext", undefined, "GREP expression no need for for double \\\\ escaping");
    ok = w.add ("button", [0,0,96,20], "Continue", {name: "Ok"});
    ok.alignment = ["right", "bottom"];
    ok.onClick = function()
        findWhat = grepExpression.text; 
        w.hide();
    w.show();
    //< END OF GREP expression dialog
    if(typeof findWhat !== "undefined") // check we have not left GREP expression field empy
        app.findGrepPreferences.findWhat = findWhat; // our GREP that search for image placeholder text;
        found = app.activeDocument.findGrep();
        for(i=0; i < found.length; i++)
            if(found[i].contents.indexOf(".") > -1) // we wroking with file name with extension
                foundElem = new File (myFolder + "/" + found[i].contents);
            else // we work with file name only, so we need to add file extension manually
                found[i].contents = found[i].contents.replace(/[^a-z0-9 _-]/gi, ""); // remove all unwanted characters from file name: only letters, numbers, spcaces, minus and underscores allowed     
                foundElem = new File (myFolder + "/" + found[i].contents + "." +  files[found[i].contents]);     
          try
                placedObj = found[i].place(foundElem)[0].parent; // THANKS TO: Jump_Over for help @ https://forums.adobe.com/message/6912489#6912489
                placedObj.anchoredObjectSettings.anchoredPosition = AnchorPosition.ABOVE_LINE;
                placedObj.anchoredObjectSettings.horizontalAlignment = HorizontalAlignment.TEXT_ALIGN;
                placedObj.frameFittingOptions.autoFit = true;
                placedObj.frameFittingOptions.fittingOnEmptyFrame = EmptyFrameFittingOptions.FILL_PROPORTIONALLY;
                placedObj.frameFittingOptions.fittingAlignment = AnchorPoint.CENTER_ANCHOR;         
            catch(e)
                Alert(e);         
        app.changeGrepPreferences.changeTo = "";
        app.activeDocument.changeGrep();
        if(clearFindWhat) // clearing only if typed GREP expression manually
            app.findGrepPreferences = app.changeGrepPreferences = null; // clear Find/Change preferences once we finished
    else
        Alert("Find what GREP expression was not specified"); exit();
    }// END OF doUndoWrapper
    Top part with Windows/Mac filtering was copy-pasted from default InDeign script "ImageCatalog.jsx" as example and modified - I'm not sure if all this stuff is needed, I haven't test if it works the same without those filtering on both OS - if that's not needed - then thanks for tip!
    PS: in your findWhat \l{3,4} will not catch .ai files
    and what means .source at the end? is that doing necessary escaping, so with it it's posible to write \l instead of \\l

  • If image file not exist in image path crystal report not open and give me exception error problem

    Hi guys my code below show pictures for all employees
    code is working but i have proplem
    if image not exist in path
    crystal report not open and give me exception error image file not exist in path
    although the employee no found in database but if image not exist in path when loop crystal report will not open
    how to ignore image files not exist in path and open report this is actually what i need
    my code below as following
    DataTable dt = new DataTable();
    string connString = "data source=192.168.1.105; initial catalog=hrdata;uid=sa; password=1234";
    using (SqlConnection con = new SqlConnection(connString))
    con.Open();
    SqlCommand cmd = new SqlCommand("ViewEmployeeNoRall", con);
    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = cmd;
    da.Fill(dt);
    foreach (DataRow dr in dt.Rows)
    FileStream fs = null;
    fs = new FileStream("\\\\192.168.1.105\\Personal Pictures\\" + dr[0] + ".jpg", FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    byte[] imgbyte = new byte[fs.Length + 1];
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dr["Image"] = imgbyte;
    fs.Dispose();
    ReportDocument objRpt = new Reports.CrystalReportData2();
    objRpt.SetDataSource(dt);
    crystalReportViewer1.ReportSource = objRpt;
    crystalReportViewer1.Refresh();
    and exception error as below

    First: I created a New Column ("Image") in a datatable of the dataset and change the DataType to System.Byte()
    Second : Drag And drop this image Filed Where I want.
    private void LoadReport()
    frmCheckWeigher rpt = new frmCheckWeigher();
    CryRe_DailyBatch report = new CryRe_DailyBatch();
    DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter ta = new CheckWeigherReportViewer.DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter();
    DataSet1.DataTable_DailyBatch1DataTable table = ta.GetData(clsLogs.strStartDate_rpt, clsLogs.strBatchno_Rpt, clsLogs.cmdeviceid); // Data from Database
    DataTable dt = GetImageRow(table, "Footer.Jpg");
    report.SetDataSource(dt);
    crv1.ReportSource = report;
    crv1.Refresh();
    By this Function I merge My Image data into dataTable
    private DataTable GetImageRow(DataTable dt, string ImageName)
    try
    FileStream fs;
    BinaryReader br;
    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageName))
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    else
    // if photo does not exist show the nophoto.jpg file
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    // initialise the binary reader from file streamobject
    br = new BinaryReader(fs);
    // define the byte array of filelength
    byte[] imgbyte = new byte[fs.Length + 1];
    // read the bytes from the binary reader
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dt.Rows[0]["Image"] = imgbyte;
    br.Close();
    // close the binary reader
    fs.Close();
    // close the file stream
    catch (Exception ex)
    // error handling
    MessageBox.Show("Missing " + ImageName + "or nophoto.jpg in application folder");
    return dt;
    // Return Datatable After Image Row Insertion
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

  • Can you show at a glance which event images are in albums?

    Say I had an event containing multiple similar but different images, is there a way to show in the grid view for example which images have already been used in one or more albums?
    Would be handy to be able to select a 'show list of albums containing this image'dialogue box. I guess you could hide images you've used but that wouldn't work automatically, nor would any other tagging/rating.
    Another approach would be to make albums containing everything in a given event, then move the images out of that album once used, just seems fiddly to me.
    AC

    AC
    Would be handy to be able to select a 'show list of albums containing this image'dialogue box.
    Yes it would and many people have suggested tit. Add your voice to the chorus at iPhoto Menu -> Provide Apple Feedback.
    A workaround - and it's no better - is to go to an album and select al, then give all those pics a keyword. Then in grid view you can see which pics have the keyword. (View -> Keywords)
    Regards
    TD

Maybe you are looking for

  • Can't get rid of horizontal lines bordering quicktime

    I am putting a movie slideshow over a white background and the las clip is white to give it a "dissappearing" affect. However there are horizontal black lines bordering the player. How do I get rid of? -paul

  • Bar Code don't show in PDF output

    Hi, I am trying to generate a BI publisher report from Oracle APEX with some text as Bar codes. The report runs perfectly when run from BI publisher but when its run from APEX The Barcodes dont show when I select the output format as .pdf. I tested f

  • HT1414 when i plug my iphone into itunes its not responding or connecting, how do i resolve this issue?

    im having problems with my iphones connecting to itunes. ive just upgraded from 4s to 5s and wanted to back it up before using it. but when i plug it in its just not responding, as usually when u plug in it it starts loading. ive tried installing itu

  • Retina automatic graphics switching

    Have been having problems with MBP with Retina display. Occasionally when using Safari get blocks of missing data when scrolling forwards and backwards. If Safari is quit then ok for a while... Also when in launchpad if clicking on folder link 'other

  • Drill Down Bar Chart Formatting

    Hi; We have a bar chart with conditional formatting on the bars (if % of goal is x, show red, if y show green, etc.) This is built on a hierarchy and has drill down feature from region to stores in the region. When drilling down into the store detail