Image filepath

Hi have a new animation that works very well, however, it will not show a picture because he put the path to the file as;

manifest: [
            {src:"img/largefront.png", id:"largefront"}
        ]

I tried to put the full URL in, but he added then it several times, how can I fix this so that he knows where the image?

Thank you

If the name/path are correct, try:

./img/largefront.PNG

Tags: Adobe Animate

Similar Questions

  • Weird error with two classes that surrounds picking paths (oraclebook)

    Hi guys! I come here once more to ask for help, please!

    As you may know, im currently studying this book of the oracle, but my two classes that take the paths give me some errors.
    Can anyone have a look for me? I has not changed the codes at all!
    package CapituloII;
    
    /**
     *
     * 
     */
    
    import java.io.File;
    import java.util.ArrayList;
    import java.util.List;
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.input.DragEvent;
    import javafx.scene.input.Dragboard;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.input.TransferMode;
    import javafx.scene.layout.HBox;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Arc;
    import javafx.scene.shape.ArcBuilder;
    import javafx.scene.shape.ArcType;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.shape.RectangleBuilder;
    import javafx.stage.Stage;
    
    /**
     * Creating Images
     * @author cdea
     */
    public class Pagina70 extends Application {
        private List<String> imageFiles = new ArrayList<>();
        private int currentIndex = -1;
        public enum ButtonMove {NEXT, PREV};
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            Application.launch(args);
        }
    
        @Override
        public void start(Stage primaryStage) {
            primaryStage.setTitle("Chapter 2-1 Creating a Image");
            Group root = new Group();
            Scene scene = new Scene(root, 551, 400, Color.BLACK);
            
            
            // image view
            final ImageView currentImageView = new ImageView();
            
            // maintain aspect ratio
            currentImageView.setPreserveRatio(true);
            
            // resize based on the scene
            currentImageView.fitWidthProperty().bind(scene.widthProperty());
            
            final HBox pictureRegion = new HBox();
            pictureRegion.getChildren().add(currentImageView);
            root.getChildren().add(pictureRegion);
            
            // Dragging over surface
            scene.setOnDragOver(new EventHandler<DragEvent>() {
                @Override
                public void handle(DragEvent event) {
                    Dragboard db = event.getDragboard();
                    if (db.hasFiles()) {
                        event.acceptTransferModes(TransferMode.COPY);
                    } else {
                        event.consume();
                    }
                }
            });
            
            // Dropping over surface
            scene.setOnDragDropped(new EventHandler<DragEvent>() {
    
                @Override
                public void handle(DragEvent event) {
                    Dragboard db = event.getDragboard();
                    boolean success = false;
                    if (db.hasFiles()) {
                        success = true;
                        String filePath = null;
                        for (File file:db.getFiles()) {
                            filePath = file.getAbsolutePath();
                            currentIndex +=1;
                            imageFiles.add(currentIndex, filePath);
                        }
                        
                        // set new image as the image to show.
                        Image imageimage = new Image(filePath);
                        currentImageView.setImage(imageimage);
                            
                    }
                    event.setDropCompleted(success);
                    event.consume();
                }
            });
    
            
            // create slide controls
            Group buttonGroup = new Group();
            
            // rounded rect
            Rectangle buttonArea = RectangleBuilder.create()
                    .arcWidth(15)
                    .arcHeight(20)
                    .fill(new Color(0, 0, 0, .55))
                    .x(0)
                    .y(0)
                    .width(60)
                    .height(30)
                    .stroke(Color.rgb(255, 255, 255, .70))
                    .build();
            
            buttonGroup.getChildren().add(buttonArea);
            // left control
            Arc leftButton = ArcBuilder.create()
                    .type(ArcType.ROUND)
                    .centerX(12)
                    .centerY(16)
                    .radiusX(15)
                    .radiusY(15)
                    .startAngle(-30)
                    .length(60)
                    .fill(new Color(1,1,1, .90))
                    .build();
            
            leftButton.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
                public void handle(MouseEvent me) {                
                    int indx = gotoImageIndex(ButtonMove.PREV);
                    if (indx > -1) {
                        String namePict = imageFiles.get(indx);
                        final Image image = new Image(new File(namePict).getAbsolutePath());
                        currentImageView.setImage(image);
                    }
                }
            });
            buttonGroup.getChildren().add(leftButton);
            
            // right control
            Arc rightButton = ArcBuilder.create()
                    .type(ArcType.ROUND)
                    .centerX(12)
                    .centerY(16)
                    .radiusX(15)
                    .radiusY(15)
                    .startAngle(180-30)
                    .length(60)
                    .fill(new Color(1,1,1, .90))
                    .translateX(40)
                    .build();
            buttonGroup.getChildren().add(rightButton);
            
            rightButton.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
                public void handle(MouseEvent me) {                
                    int indx = gotoImageIndex(ButtonMove.NEXT);
                    if (indx > -1) {
                        String namePict = imageFiles.get(indx);
                        final Image image = new Image(new File(namePict).getAbsolutePath());
                        currentImageView.setImage(image);
                    }
                }
            });
            
            // move button group when scene is resized
            buttonGroup.translateXProperty().bind(scene.widthProperty().subtract(buttonArea.getWidth() + 6));
            buttonGroup.translateYProperty().bind(scene.heightProperty().subtract(buttonArea.getHeight() + 6));
            root.getChildren().add(buttonGroup);
            
            primaryStage.setScene(scene);
            primaryStage.show();
        }
        
        /**
         * Returns the next index in the list of files to go to next.
         * 
         * @param direction PREV and NEXT to move backward or forward in the list of 
         * pictures.
         * @return int the index to the previous or next picture to be shown.
         */
        public int gotoImageIndex(ButtonMove direction) {
            int size = imageFiles.size();
            if (size == 0) {
                currentIndex = -1;
            } else if (direction == ButtonMove.NEXT && size > 1 && currentIndex < size - 1) {
                currentIndex += 1;
            } else if (direction == ButtonMove.PREV && size > 1 && currentIndex > 0) {
                currentIndex -= 1;
            }
    
            return currentIndex;
        }
        
    }
    Error generated when I drag-and - drop:

    ATTENTION: It won't let me copy the first two lines and the last two lines of the error:

    >




    java.lang.IllegalArgumentException: Invalid URL: unknown protocol: c
    at javafx.scene.image.Image.validateUrl (unknown Source)
    to javafx.scene.image.Image. < init >(Unknown Source)
    to CapituloII.Pagina70$ 2.handle(Pagina70.java:96)
    to CapituloII.Pagina70$ 2.handle(Pagina70.java:80)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent (unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent (unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent (unknown Source)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent (unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent (unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent (unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent (unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent (unknown Source)
    at com.sun.javafx.event.EventUtil.fireEventImpl (unknown Source)
    at com.sun.javafx.event.EventUtil.fireEvent (unknown Source)
    at javafx.event.Event.fireEvent (unknown Source)
    to javafx.scene.Scene$ DnDGesture.fireEvent (unknown Source)
    to javafx.scene.Scene$ DnDGesture.processTargetDrop (unknown Source)
    to javafx.scene.Scene$ DnDGesture.access$ 6500 (unknown Source)
    to javafx.scene.Scene$ DropTargetListener.drop (unknown Source)
    at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.handleDragDrop (unknown Source)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleDragDrop (unknown Source)
    at com.sun.glass.ui.View.handleDragDrop (unknown Source)
    at com.sun.glass.ui.View.notifyDragDrop (unknown Source)
    at com.sun.glass.ui.win.WinApplication._runLoop (Native Method)
    in com.sun.glass.ui.win.WinApplication.access$ 100 (unknown Source)
    to com.sun.glass.ui.win.WinApplication$ $2 1.run (unknown Source)
    at java.lang.Thread.run(Thread.java:722)
    Caused by: java.net.MalformedURLException: unknown protocol: c
    at java.net.URL. < init > (URL.java:590)
    at java.net.URL. < init > (URL.java:480)
    at java.net.URL. < init > (URL.java:429)
    ... more than 27
    Exception in thread 'Thread of Application JavaFX' E

    Hello

    I think that the string you give to the new Image (string) must be a URL, not a single file path.

    So if you have a file, it would be something like:

    File file = ...;
    Image image = new Image(file.toURI().toURL().toExternalForm());
    

    Hope this helps,

    -daniel

  • Filepath image display in PDF format

    Hello

    I have converted a WebHelp-> Word 2007 document, apply a shape/style layout, then converted to PDF. I converted the Word doc using the "Create a PDF file-> file" option in Acrobat Professional 8.2.3

    When the mouse over images in the PDF file, the path is displayed.  I don't want to. In fact, I don't want anythinig to display!  It is interesting to note the path points to the temporary directory that is created (! doc_tmp_folder_0) on my local machine (so it displays also, C:\Documents and Settings\ < MyName > \My Documents\...\!) SSL! \Etc). And this temp directory is not anywhere on my machine.

    I looked around for some kind of location of the Image, both in Word and Acrobat, but I couldn't find everything I thought solved this problem.

    Thank you!

    There is a solution to http://forums.adobe.com/message/3693331#3693331 but as you will see, it seems to create more problems.

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • Windows Picture and Fax Viewer to open and image on my network - Labview to automate this?

    I tried to do this with a command line, but I can't seem to make it work.  Filepath would be something like this \\Computer\Pictures\image.jpg

    Or

    Is there a way to open the file with the windows default program Association?

    Thank you

    Branson

    LV 8.2

    Try double quotes around the path.

  • Update of ListView dummy image using images from URL http

    Hi guys...

    Please help me with this.

    I have created a ListView in QML file and filled with data received from a webservice. Since this web service provides all the images, I have to place a dummy image at this location. Then I used another method to retrieve images of the url. Now, I got the image in my CPC file. But I could not update my listview. I tried several methods. But failed.

    Here is my code snippet.

     ListView {
                    id: listView
                    objectName: "listView"
    
                    dataModel: ArrayDataModel {
                        id: myListModel
    
                    }
    
                    // Override default GroupDataModel::itemType() behaviour, which is to return item type "header"
                    listItemComponents: ListItemComponent {
                        id: listcomponent
                        // StandardListItem is a convivience component for lists with default cascades look and feel
                        StandardListItem {
                            title: ListItemData.postText
                            description: ListItemData.postDate
                            status: ListItemData.filePath
                            imageSource: "asset:///images/4.png"
                        }
    
                    }
                    layoutProperties: StackLayoutProperties {
                        spaceQuota: 1.0
                    }
                    horizontalAlignment: HorizontalAlignment.Fill
                    verticalAlignment: VerticalAlignment.Fill
    
                }
    

    In the PRC, I get my image like this.

    void PostHttp::imageFetcher(){
    const QUrl url("http:///828/828_20135312012288.png");
    if (flag1 == true) {
        get(url);
    }
    }
    void PostHttp::onImageReply(){
        QNetworkReply* reply = qobject_cast(sender());
        QString response;
        QImage img;
        QString filePathWithName = "data/img/";
        QString imageName;
    
        if (reply) {
                if (reply->error() == QNetworkReply::NoError) {
                    flag1 = false;
                    const int available = reply->bytesAvailable();
                    if (available > 0) {
                    const QByteArray buffer(reply->readAll());
                    response = QString::fromUtf8(buffer);
                    img.loadFromData(buffer);
                    img = img.scaled(40, 40, Qt::KeepAspectRatioByExpanding);
                    const QImage swappedImage = img.rgbSwapped();
                    const bb::ImageData imageData = bb::ImageData::fromPixels(
                            swappedImage.bits(), bb::PixelFormat::RGBX,
                            swappedImage.width(), swappedImage.height(),
                            swappedImage.bytesPerLine());
                    bb::utility::ImageConverter::encode(QUrl(QDir::currentPath() + "/shared/camera/img.png"), imageData, 75);
                    qDebug()<<"current path is "<
    

    Thanks in advance

    You can pass a QByteArray of image data coded directly to an imageView in the image property, set of QVariant::fromValue (). However, in your case you can place the uri to which you saved the image and not the bytes. Advantage: cascades puts these images in cache. If you use deterministic file names, you can avoid any networking calls or loading of images when only the populated list of point sier after be recycled.

    img.loadFromData(buffer);
    img = img.scaled(40, 40, Qt::KeepAspectRatioByExpanding);
    img.save(QDir::currentPath() + "/shared/camera/img.png"), 0, 75);
    

    QImage can do all this for you, without permutation of bytes.

    All you have to do is then updated the datamodel.

  • Display image captured after taking photo

    /*******
    works when "Take Photo" button clicked
    ********/
    function takePicture() {
        var result = blackberry.media.camera.takePicture(successCB);
    }
    
    /*******
    post processing of photo click event
    ********/
    function successCB(filePath) {
        try{
            blackberry.media.camera.close();
            var imagePath = "file://" + filePath;
            document.getElementById('images').setAttribute('src', imagePath.toString());
            document.getElementById("photoDetails").innerHTML = imagePath;
        }
        catch(e) {
            document.getElementById("photoDetails").innerHTML = e.ToString();
        }
    }
    
    
    
    //ConfigFile includes the following,  
    
    • image
    • image

    the imagePath variable print successfully-online "file:///store/home/user/camera/IMG-20120118-00001.jpg." but the picture does not appear.

    I don't understand what the problem with the code I wrote. path of the image was.

    Strangely when I hard imagePath under a src of the image -code, it can show the image. but when I put in successCB() using javascript, it does not work. I tested the functionality of my javascript code in firefox. She works in basic html. I use Blackberry 9700 with os 6 bundle 2921. I need immediate assistance. Please I'm stuck with it for a whole day


  • Get all the images of devices, but how do I know in what images is seclected

    Hello

    in my application I want to show all the images in the first screen, after selecting any image in all we will see in the next screen (full screen) actually I get all images but problem how do I know what image is clicked

    I used this code...

    package mypackage;

    import java.io.IOException;
    import java.io.InputStream;
    to import java.util.Enumeration;
    import java.util.Vector;

    Import javax.microedition.io.Connector;
    Import javax.microedition.io.file.FileConnection;

    Import net.rim.device.api.math.Fixed32;
    Import net.rim.device.api.system.Bitmap;
    Import net.rim.device.api.system.EncodedImage;
    Import net.rim.device.api.ui.Field;
    Import net.rim.device.api.ui.Manager;
    Import net.rim.device.api.ui.component.BitmapField;
    Import net.rim.device.api.ui.component.ButtonField;
    Import net.rim.device.api.ui.container.FlowFieldManager;
    Import net.rim.device.api.ui.container.MainScreen;
    Import net.rim.device.api.util.Comparator;
    Import net.rim.device.api.util.SimpleSortingVector;

    /**
    * A class that extends the class screen, which offers default standard
    * behavior for BlackBerry GUI applications.
    */
    / public final class screen extends MyScreen
    {

    private static final String DEVICE_DIR_PATH = System
    .getProperty ("fileconn.dir.photos");
    private static final String SD_IMAGE_DIR_PATH = System
    .getProperty ("fileconn.dir.memorycard.photos");
    private static final String OS6_CAMERA_PATH = "file:///store/home/user/camera/";
    private static final String OS6_SD_CARD_PATH = "file:///SDCard/BlackBerry/camera/";

    public static final int DEVICE_AND_SD = 0;
    public static final int DEVICE_MEM = 1;
    public static final int SD_CARD = 2;
    public static final int OS6_CAMERA = 3;
    public static final int OS6_SD_CAMERA = 4;
    public static final int DEVICE_ALL = 5;
    private static String [] _allImagePaths = null;
    private EncodedImage [encodedbitmap];
    Private bitmap image in Bitmap [];
    private BitmapField [imagebitmapField];

    int dataSize;
    private ButtonField [] bitmapf;

    /**
    * Creates a new object of MyScreen
    */
    public MyScreen()
    {
    Set the displayed title of the screen
    setTitle ("MyTitle");

    String [] imagePaths = getImagePaths (DEVICE_ALL);
    FlowFieldManager imageFlowField = FlowFieldManager(Manager.VERTICAL_SCROLL | nouveau Manager.VERTICAL_SCROLLBAR);
    If (imagePaths! = null & imagePaths.length > 0) {}
    encodedbitmap = new EncodedImage [imagePaths.length];
    image bitmap = new Bitmap [imagePaths.length];
    imagebitmapField = new BitmapField [imagePaths.length];

    for (int i = 0; i)< imagepaths.length;="" i++)="">
    encodedbitmap [i] = loadEncodedImage ([i] imagePaths);
    [i] bitmap image is scaleImage (encodedbitmap [i], 200, 100);.
    imagebitmapField [i] = new BitmapField(bitmap[i],Field.FOCUSABLE);
    imageFlowField.add (imagebitmapField [i]);
    }
    }
    Add (imageFlowField);

    }

    public Bitmap image scaleImage (EncodedImage img, int width, int height) {}

    int currentWidthF32 = Fixed32.toFP (img.getWidth ());
    int currentHeightF32 = Fixed32.toFP (img.getHeight ());

    If (height == 0) {}
    int requiredWidth = Fixed32.toFP (width);
    int x = Fixed32.div (currentHeightF32, currentWidthF32);
    int y = Fixed32.mul (x, requiredWidth);
    int scaleX = Fixed32.div (currentWidthF32, requiredWidth);
    int scaleY = Fixed32.div (currentHeightF32, y);
    IMG = img.scaleImage32 (scaleX, scaleY);
    } else {}
    int currentWidthFixed32 = Fixed32.toFP (img.getWidth ());
    int currentHeightFixed32 = Fixed32.toFP (img.getHeight ());
    int requiredHeightFixed32 = Fixed32.toFP (height);
    int requiredWidthFixed32 = Fixed32.toFP (width);
    int scaleXFixed32 = Fixed32.div (currentWidthFixed32,
    requiredWidthFixed32);
    int scaleYFixed32 = Fixed32.div (currentHeightFixed32,
    requiredHeightFixed32);
    IMG = img.scaleImage32 (scaleXFixed32, scaleYFixed32);

    }
    Return img.getBitmap ();
    }

    protected EncodedImage loadEncodedImage (String filePath) {}

    FileConnection connection = null;
    Byte [] byteArray = null;
    Image EncodedImage = null;
    Bitmap bitmap image = null;
    Try
    {
    Connection = (FileConnection) Connector.Open (FilePath);
    If (Connection.Exists ())
    {
    byteArray = byte [(int) connection.fileSize (new)];
    InputStream inputStream = connection.openInputStream ();
    inputStream.read (byteArray);
    inputStream.close ();
    image = EncodedImage.createEncodedImage (byteArray, 0, -1);
    }
    Connection.Close;
    }
    catch (System.Exception e)
    {
    System.out.println ("Exception" + try ());
    }
    return image;

    }

    public static String [] getImagePaths (int source) {}

    If get path for all do this recursively
    If (source == DEVICE_ALL) {}
    If (_allImagePaths! = null) {}
    Return _allImagePaths;
    }

    OS6 device Gallery
    String [] os6CameraSDPaths =
    getImagePaths (OS6_SD_CAMERA);

    OS6 Gallery of SD card
    String [] os6CameraPaths =
    getImagePaths (OS6_CAMERA);

    SD card Gallery
    String [] sdCardPaths = getImagePaths (SD_CARD);
    Gallery of the device
    String [] devicePaths =
    getImagePaths (DEVICE_MEM);

    Combine the two in an ImageViewer
    int numOS6CameraSDPaths = os6CameraSDPaths! = null? os6CameraSDPaths.length
    : 0 ;
    int numOS6CameraPaths = os6CameraPaths! = null? os6CameraPaths.length
    : 0 ;
    int numSDCardPaths = sdCardPaths! = null? sdCardPaths.length: 0;
    int numDevicePaths = devicePaths! = null? devicePaths.length: 0;

    int totalNumPaths = numDevicePaths + numSDCardPaths
    + numOS6CameraPaths + numOS6CameraSDPaths;
    If (totalNumPaths > 0) {}
    String of paths [] = new String [totalNumPaths];

    If (os6CameraSDPaths! = null) {}
    System.arraycopy (os6CameraSDPaths, 0, 0, paths)
    numOS6CameraSDPaths);
    }
    If (os6CameraPaths! = null) {}
    System.arraycopy (os6CameraPaths, 0, paths,)
    (numOS6CameraSDPaths, numOS6CameraPaths);
    }
    If (sdCardPaths! = null) {}
    System.arraycopy (sdCardPaths, 0, numOS6CameraSDPaths)
    + numOS6CameraPaths, numSDCardPaths);
    }
    If (devicePaths! = null) {}
    System.arraycopy (devicePaths, 0, paths, numOS6CameraSDPaths)
    + numOS6CameraPaths, + numSDCardPaths,
    numDevicePaths);
    }

    _allImagePaths = sortPaths (paths);

    Return _allImagePaths;
    } else {}
    Returns a null value.
    }
    }

    Set the path to look for
    String imagePath = DEVICE_DIR_PATH;
    If (source == SD_CARD) {}
    imagePath = SD_IMAGE_DIR_PATH;
    }

    If (source == OS6_CAMERA) {}
    imagePath = OS6_CAMERA_PATH;
    }

    If (source == OS6_SD_CAMERA) {}
    imagePath = OS6_SD_CARD_PATH;
    }

    Listed in the directory looking for image files
    ImagePaths vector = new Vector();
    FileConnection imageDir = null;
    try {}
    imageDir = Connector.open (imagePath) (FileConnection);
    If (imageDir! = null) {}
    Enumeration = imageDir.list ();

    imageDir.close ();
    While (enumeration.hasMoreElements ()) {}
    String imageName = (String) enumeration.nextElement ();
    If (isSupported (imageName)) {}
    imagePaths.addElement (imagePath + imageName);
    }
    }
    }
    } catch (Exception e) {}
    XLogger.error (ImagePath.class, "cannot read file:")
    + e.getMessage ());
    } {Finally
    If (imageDir! = null) {}
    try {}
    imageDir.close ();
    } catch (IOException e) {}
    XLogger.error (ImagePath.class, "cannot close the file:")
    + e.getMessage ());
    }
    }
    }

    If there is no images don't return the null value
    If (imagePaths.size)<= 0)="">
    Returns a null value.
    }

    Return the results in an array of strings
    _allImagePaths = new String [imagePaths.size ()];
    imagePaths.copyInto (_allImagePaths);
    Return _allImagePaths;
    }

    private static String [] sortPaths (String [] paths) {}
    Sort the paths of the time, where modified files.
    Class PathAndLastModified {}

    timeStamp long private;
    private String path;

    {} public void setTimeStamp (long timeStamp)
    this.timeStamp = timeStamp;
    }

    {} public void setPath (String path)
    This.Path = path;
    }

    public String GetExtension() {}
    Returns the path;
    }
    }

    Comparator to sort paths
    Comparator pathComparator = new Comparator() {}
    public int compare (Object o1, Object o2) {}
    If (((PathAndLastModified) o1) .timeStamp)< ((pathandlastmodified)o2).timestamp="" )="">
    Return 1;
    } ElseIf (((PathAndLastModified) o1) .timeStamp > .timeStamp (o2 (PathAndLastModified))) {}
    Returns - 1;
    } else {}
    return 0;
    }

    Return (int) (((PathAndLastModified) o2) .timeStamp - .timeStamp (o1 (PathAndLastModified)));
    }
    };

    Add the paths to the vector sorting
    SimpleSortingVector sortedPaths = new SimpleSortingVector();
    sortedPaths.setSortComparator (pathComparator);
    for (int i = 0; i)< paths.length;="" i++)="">
    String filePath = path [i];
    long lastModified = 0;

    FileConnection baseConn = null;
    try {}
    baseConn = (FileConnection), Connector.open (paths [i]);
    lastModified = baseConn.lastModified ();

    PathAndLastModified pathAndLastModified = new PathAndLastModified();
    pathAndLastModified.setPath (filePath);
    pathAndLastModified.setTimeStamp (lastModified);

    sortedPaths.addElement (pathAndLastModified);
    } catch (Exception e) {}
    Do nothing
    } {Finally
    {if(baseConn!=null)}
    try {}
    baseConn.close ();
    } catch (IOException e) {}
    Do nothing
    }
    }
    }
    }
    sortedPaths.reSort ();

    Browse to create an array of sorted paths
    String [] sortedArray = new String [sortedPaths.size ()];
    for (int i = 0; i)
    sortedArray [i] = ((PathAndLastModified) sortedPaths.elementAt (i)) .getPath ();
    }

    Return sortedArray;
    }

    private static Boolean isSupported (image String) {}
    Make sure that the image is of the correct type
    If (image == null) {}
    Returns false;
    }
    check the directory
    If (image.indexOf("/") > = 0) {}
    Returns false;
    }

    int delimiterIndex = image.indexOf(".");
    If (delimiterIndex ==-1) {}
    probably a directory
    Returns false;
    }

    the text is a list of extensions supported
    String [] extensions = {".jpg", ".jpeg"};
    for (int i = 0; i)< extensions.length;="" i++)="">
    If (image.length () > extensions [i] .length ()) {}
    Dim ext = image.substring (image.length)
    (-extensions [i] .length ());
    If (ext.equalsIgnoreCase (extensions [i])) {}
    Returns true;
    }
    }
    }
    Returns false;
    }
    }

    my suggestion was supposed to replace navigationclick on-screen.
    If you want to ignore it for the field that you do not have to use getLeafFieldWithFocus.

    I suggest that you think your code, don't write things and try to operate, fist think about something and then implement.
    our projects at the University were generally 80% design, 20% of coding - it was strange at first, but it produced a lot more code.

  • Recording of images issues

    Hi all

    I am new to Java, Blackberry and Eclipse so please forgive my lack of knowledge on what may be the simple understanding.  I have just a few little random basic questions.

    I use Eclipse with the JDE 4.7 plugin and development for the storm.  I use the Simulator for development.

    I was instructed to write an application that needs to record 2 different pieces of information.  The application must save an array of bool, so it can be accessed on the next time the application is loaded.   For this method, I use persitant store.

    First question:

    Persistent would consider a good method, or should I be save this data in another case?

    Now on the my main concern.  Our application has a bunch of files for a game. After that part of the game is finished, we want the user to then be able to take a picture of the game and store it on the phone so that the user can then select as wallpaper.

    For this method, I've been through a code and I promise you, I searched high and low and have not found a solution that I understand very well.

    I noticed people using a "connector" to open a path to the file system/or create it.  However, I am having a hard time understanding how the Simulator affects its filepath and how the real phone its filepath.

    If someone could help point me in the right direction on how to save a file of our application on the phone, so it can be used as wallpaper, I would be very happy.

    Here's a piece of how I'm saving my code.  I get an exc of IO.  But for an IO exc references claim that the firewall does not allow a connection.  I'm not connect through a firewall, then, how is this possible?

    m_filename = the path to a file in our application.

    The code in bold is were the exception is thrown.

    Thank you in advance for anyone of help.

    Bitmap _bitmap = Bitmap.getBitmapResource(m_filename);PNGEncodedImage _pngEncodedImage = PNGEncodedImage.encode(_bitmap);
    
    try{    String fileDir = System.getProperty("fileconn.dir.memorycard");    if (fileDir == null)    {  Dialog.alert("ERROR:  fileDir = null");    }    else    }        Dialog.alert("fileDir = " + fileDir);    }    FileConnection fc = (FileConnection)    Connector.open( fileDir + m_filename,Connector.READ_WRITE);
    
        if(!fc.exists())    fc.create();    OutputStream oStream = fc.openOutputStream();    oStream.write(_pngEncodedImage.getData());    oStream.flush();    oStream.close();     fc.close();     }    catch(Exception e){    Dialog.alert("EXC in saving image.  EXC = "+e);}
    

    The solution to the half of my problem was this:

    First, I created a directory with a separate connector.  Then I closed this connector and set up a second for the image.

    Then I saved my image in the new directory.

    The call of "connector.open" () looks like this for the two respective calls:

    // to create a directoryConnector.open("file:///SDCard/BlackBerry/pictures/myDirectory/",Connector.READ_WRITE);
    
    // to save myFile in the directoryConnector.open("file:///SDCard/BlackBerry/pictures/myDirectory/myFile.png", Connector.READ_WRITE);
    

    I will mark this as comprehensive and open a new thread to store petrol issues I've had.  That way I hope that someone will learn something.

    If anyone has questions, feel free to post it here or private message me and I hopefully will be able to explain what I did better.

  • Mulitpart post http to download images and string parameters

    It is the first time I use http multipart post to download files. I download the two parameters of string (token source) and a captured image of terminal BlackBerry. I tried the following code but it gives me error.

    I don't know if it's the right way to create the MULTIPART post request.

    StringBuffer buffer = new StringBuffer();
    String boundary = "--@#$--";
    byte[] image = byte[] from camera.getsnapshot;
    
    buffer.append(boundary+"\r\nContent-Disposition: form-data;name=\"token\"\r\n"+token+"\r\n");
    buffer.append(boundary+"\r\nContent-Disposition: form-data;name=\"source\"\r\n"+"Blackberry"+"\r\n");
    buffer.append(boundary+"\r\nContent-Disposition: form-data;name=\"file.jpg\";filename=\""+ filename+"\""+"\n" +     "Content-Type:image/jpeg"+"\n"+ "Content-Transfer-Encoding: binary" + boundary +"\r\n" +new String(image));
    buffer.append("\r\n" + boundary + "\r\n");
    
    String string = new String(buffer);
    
    byte[] post = string.getBytes();
    
    HttpConnection connection = (HttpConnection)Connector.open(url);
    
    connection.setRequestMethod(POS);
    
    connection.setRequestProperty(HttpProtocolConstants.HEADER_CONTENT_TYPE,
        HttpProtocolConstants.CONTENT_TYPE_MULTIPART_FORM_DATA+
        ";boundary="+boundary);
    
    connection.setRequestProperty(HttpProtocolConstants.HEADER_CONTENT_LENGTH,String.valueOf(post.length));
    connection.setRequestProperty("User-Agent", "Profile/MIDP_2.0 Configuration/CLDC-1.0");
    OutputStream postStream =connection.openOutputStream();
    postStream.write(post,0,post.length);
    postStream.close();
    

    If someone has done this before, your help would be very appreciated

    Finally worked,

    private final String boundary = "akfdskdjfkl";
    private final String lineend = "\r\n";
    private final String twoHyphens = "--";
    
    OutputStream pos = connection.openOutputStream();
    
    pos.write(twoHyphens.getBytes());
    pos.write(boundary.getBytes());
    pos.write(lineend.getBytes());
    
    pos.write("Content-Disposition: form-data;   name=\"authenticity_token\"".getBytes());
    pos.write(lineend.getBytes());
    pos.write(lineend.getBytes());
    pos.write(app.userAccount.getUser_auth_token().getBytes());
    pos.write(lineend.getBytes());
    
    pos.write(twoHyphens.getBytes());
    pos.write(boundary.getBytes());
    pos.write(lineend.getBytes());
    
    pos.write("Content-Disposition: form-data; name=\"source\"".getBytes());
    pos.write(lineend.getBytes());
    pos.write(lineend.getBytes());
    pos.write("blackberry".getBytes());
    pos.write(lineend.getBytes());
    
    pos.write(twoHyphens.getBytes());
    pos.write(boundary.getBytes());
    pos.write(lineend.getBytes());
    
    String filename = "blackberry" + filepath;
    pos.write("Content-Disposition: form-data; name=\"Filedata\"; filename=\"".getBytes());
    pos.write(filename.getBytes());
    pos.write("\"".getBytes());
    pos.write(lineend.getBytes());
    
    pos.write("Content-Type: image/jpeg".getBytes());
    pos.write(lineend.getBytes());
    pos.write(lineend.getBytes());
    
    pos.write(image, 0, image.length);
    
    pos.write(lineend.getBytes());
    
    pos.write(twoHyphens.getBytes());
    pos.write(boundary.getBytes());
    pos.write(twoHyphens.getBytes());
    pos.write(lineend.getBytes());
    

    Formatted string is vital, accurate use of hyphens, limit, and new line must be ensured.

  • How to access image stored in Blackberry using Bitmap.getBitmapResource ()?

    I want to access an image stored in Blackberry, say instead of "store/home/user/image.png".

    Now I can access the image as,

    String filePath = "file:///store/home/user/image.png;
    Bitmap image = Bitmap.getBitmapResource(filePath);
    BitmapField bitmapField = new BitmapField(image, BitmapField.FOCUSABLE);
    

    OR

    I have to access

    String filePath = "file:///store/home/user/image.png;
      FileConnection fconn = (FileConnection)Connector.open(filePath, Connector.READ);
      if (fconn.exists())
      {
                    ........
                    ........                           
    
         input.close();
         fconn.close();                            
    
      }
    

    I am able to access the image using the second way, but I want to know that can I access using 'Bitmap.getBitmapResource (filePath)?

    None

  • Display of images in a ListView problem

    Hello world

    I'm trying to display images in a grid (GridListLayout) in a ListView component (as in This example). However, it just displays the paths to the images I try to view (if it is not clear for you take a look at attachment 1). What I am doing wrong?

    In my data model, you can find this method of data:

    QVariant ComicsDataModel::data(const QVariantList& indexPath)
    {
        return QVariant("assets/images/legodude.jpg");
    //return coverList.at(indexPath[0].toInt());
    }
    

    The commented code returns the actual filepaths (absolute paths), but who doesn't either. Of course, I have included the image in the assets/images folder. The ListView is specified as written below.

                ListView {
                    objectName: "coverListView"
                    layout: GridListLayout {}
    
                    listItemComponents: [
                        ListItemComponent {
                            type: "image"
    
                            ImageView {
                                imageSource: ListItemData
                                scalingMethod: ScalingMethod.AspectFill
                            }
                        }
                    ]
                }
    

    Thanks for the help! All of the examples to work with images using XML as datamodel, I use a custom data model.

    Annex 1:

    Probably your datamodel custom does figure not correctly return the correct values in the DataModel::itemType() function - make sure you return 'image' properly in your overload of itemType() - or use the equivalent ListView callback function in QML

  • find all the documents with a link specific filePath

    Hello

    I am trying to find the name of all the documents with a link specific filePath.

    Before you run this script I need to know that nothing bad is going to pass, so please can someone give me some advice?

    var myFolder = file (' A:\Work in progress/Jake/Indd files / ');
    myDocs var = [];
    var myFiles = myFolder.getFiles("*");

    for (i = 0; i < myFiles.length; i ++) {}

    $.writeln (myFiles [i] p:System.NET.mail.MailAddress.DisplayName);
    var doc is myFiles [i] .open ();.
    links documentaries var = doc.links;
    for (j = 0; j < docLinks.length; j ++) {}
    If (docLinks [i] .filePath = 'A:\Work in progress\Jake\Image Links\Aqualimb 100kg\Aqua Limb.eps') {}
    myDocs.push (doc.name)
    }
    doc. Close();
    }

    Try this

    var myFolder = Folder ("A:\Work in progress/Jake/Indd Files/");
    var myDocs=[];
    var myFiles = myFolder.getFiles("*.*");
    for (i=0;i		   
  • use Image catalog script for the current document

    Is it possible to use the script to image catalogue for the current document in which we work instead of leaving the mark of script a new document fees for placed images?

    use,

    //ImageCatalog.jsx
    //An InDesign CS6 JavaScript
    /*
    @@@BUILDINFO@@@ "ImageCatalog.jsx" 3.0.0 15 December 2009
    */
    //Creates an image catalog from the graphic files in a selected folder.
    //Each file can be labeled with the file name, and the labels are placed on
    //a separate layer and formatted using a paragraph style ("label") you can
    //modify to change the appearance of the labels.
    //
    //For more information on InDesign scripting, go to http://www.adobe.com/products/indesign/scripting/index.html
    //Or visit the InDesign Scripting User to User forum at http://www.adobeforums.com .
    //
    //The myExtensions array contains the extensions of the graphic file types you want
    //to include in the catalog. You can remove extensions from or add extensions to this list.
    //myExtensions is a global. Mac OS users should also look at the file types in the myFileFilter function.
    main();
    function main(){
      var myFilteredFiles;
      //Make certain that user interaction (display of dialogs, etc.) is turned on.
      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
      myExtensions = [".jpg", ".jpeg", ".eps", ".ps", ".pdf", ".tif", ".tiff", ".gif", ".psd", ".ai"]
      //Display the folder browser.
      var myFolder = Folder.selectDialog("Select the folder containing the images", "");
      //Get the path to the folder containing the files you want to place.
      if(myFolder != null){
      if(File.fs == "Macintosh"){
      myFilteredFiles = myMacOSFileFilter(myFolder);
      }
      else{
      myFilteredFiles = myWinOSFileFilter(myFolder);
      }
      if(myFilteredFiles.length != 0){
      myDisplayDialog(myFilteredFiles, myFolder);
      alert("Done!");
      }
      }
    }
    //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-1){
      return true;
      break;
      }
      }
      }
      return false;
    }
    function myDisplayDialog(myFiles, myFolder){
      var myLabelWidth = 112;
      var myStyleNames = myGetParagraphStyleNames(app);
      var myLayerNames = ["Layer 1", "Labels"];
      var myDialog = app.dialogs.add({name:"Image Catalog"});
      with(myDialog.dialogColumns.add()){
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Information:"});
      }
      with(borderPanels.add()){
      with(dialogColumns.add()){
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Source Folder:", minWidth:myLabelWidth});
      staticTexts.add({staticLabel:myFolder.path + "/" + myFolder.name});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Number of Images:", minWidth:myLabelWidth});
      staticTexts.add({staticLabel:myFiles.length + ""});
      }
      }
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Options:"});
      }
      with(borderPanels.add()){
      with(dialogColumns.add()){
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Number of Rows:", minWidth:myLabelWidth});
      var myNumberOfRowsField = integerEditboxes.add({editValue:3});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Number of Columns:", minWidth:myLabelWidth});
      var myNumberOfColumnsField = integerEditboxes.add({editValue:3});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Horizontal Offset:", minWidth:myLabelWidth});
      var myHorizontalOffsetField = measurementEditboxes.add({editValue:12, editUnits:MeasurementUnits.points});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Vertical Offset:", minWidth:myLabelWidth});
      var myVerticalOffsetField = measurementEditboxes.add({editValue:24, editUnits:MeasurementUnits.points});
      }
      with (dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Fitting:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myFitProportionalCheckbox = checkboxControls.add({staticLabel:"Proportional", checkedState:true});
      var myFitCenterContentCheckbox = checkboxControls.add({staticLabel:"Center Content", checkedState:true});
      var myFitFrameToContentCheckbox = checkboxControls.add({staticLabel:"Frame to Content", checkedState:true});
      }
      }
      with(dialogRows.add()){
      var myRemoveEmptyFramesCheckbox = checkboxControls.add({staticLabel:"Remove Empty Frames:", checkedState:true});
      }
      }
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:""});
      }
      var myLabelsGroup = enablingGroups.add({staticLabel:"Labels", checkedState:true});
      with (myLabelsGroup){
      with(dialogColumns.add()){
      //Label type
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Type:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelTypeDropdown = dropdowns.add({stringList:["File name", "File path", "XMP description", "XMP author"], selectedIndex:0});
      }
      }
      //Text frame height
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Height:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelHeightField = measurementEditboxes.add({editValue:24, editUnits:MeasurementUnits.points});
      }
      }
      //Text frame offset
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Offset:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelOffsetField = measurementEditboxes.add({editValue:0, editUnits:MeasurementUnits.points});
      }
      }
      //Style to apply
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Style:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelStyleDropdown = dropdowns.add({stringList:myStyleNames, selectedIndex:0});
      }
      }
      //Layer
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Layer:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLayerDropdown = dropdowns.add({stringList:myLayerNames, selectedIndex:0});
      }
      }
      }
      }
            var myResult = myDialog.show();
            if(myResult == true){
      var myNumberOfRows = myNumberOfRowsField.editValue;
      var myNumberOfColumns = myNumberOfColumnsField.editValue;
      var myRemoveEmptyFrames = myRemoveEmptyFramesCheckbox.checkedState;
      var myFitProportional = myFitProportionalCheckbox.checkedState;
      var myFitCenterContent = myFitCenterContentCheckbox.checkedState;
      var myFitFrameToContent = myFitFrameToContentCheckbox.checkedState;
      var myHorizontalOffset = myHorizontalOffsetField.editValue;
      var myVerticalOffset = myVerticalOffsetField.editValue;
      var myMakeLabels = myLabelsGroup.checkedState;
      var myLabelType = myLabelTypeDropdown.selectedIndex;
      var myLabelHeight = myLabelHeightField.editValue;
      var myLabelOffset = myLabelOffsetField.editValue;
      var myLabelStyle = myStyleNames[myLabelStyleDropdown.selectedIndex];
      var myLayerName = myLayerNames[myLayerDropdown.selectedIndex];
      myDialog.destroy();
      myMakeImageCatalog(myFiles, myNumberOfRows, myNumberOfColumns, myRemoveEmptyFrames, myFitProportional, myFitCenterContent, myFitFrameToContent, myHorizontalOffset, myVerticalOffset, myMakeLabels, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle,  myLayerName);
            }
      else{
      myDialog.destroy();
      }
      }
    }
    function myGetParagraphStyleNames(myDocument){
      var myStyleNames = new Array;
      var myAddLabelStyle = true;
      for(var myCounter = 0; myCounter < myDocument.paragraphStyles.length; myCounter++){
      myStyleNames.push(myDocument.paragraphStyles.item(myCounter).name);
      if (myDocument.paragraphStyles.item(myCounter).name == "Labels"){
      myAddLabelStyle = false;
      }
      }
      if(myAddLabelStyle == true){
      myStyleNames.push("Labels");
      }
      return myStyleNames;
    }
    function myMakeImageCatalog(myFiles, myNumberOfRows, myNumberOfColumns, myRemoveEmptyFrames, myFitProportional, myFitCenterContent, myFitFrameToContent, myHorizontalOffset, myVerticalOffset, myMakeLabels, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle,  myLayerName){
      var myPage, myFile, myCounter, myX1, myY1, myX2, myY2, myRectangle, myLabelStyle, myLabelLayer;
      var myParagraphStyle, myError;
      var myFramesPerPage = myNumberOfRows * myNumberOfColumns;
      var myDocument = app.activeDocument;
      myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
      myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
      var myDocumentPreferences = myDocument.documentPreferences;
      var myNumberOfFrames = myFiles.length;
      var myNumberOfPages = Math.round(myNumberOfFrames / myFramesPerPage);
      if ((myNumberOfPages * myFramesPerPage) < myNumberOfFrames){
      myNumberOfPages++;
      }
      //If myMakeLabels is true, then add the label style and layer if they do not already exist.
      if(myMakeLabels == true){
      try{
      myLabelLayer = myDocument.layers.item(myLayerName);
      //if the layer does not exist, trying to get the layer name will cause an error.
      myLabelLayer.name;
      }
      catch (myError){
      myLabelLayer = myDocument.layers.add({name:myLayerName});
      }
      //If the paragraph style does not exist, create it.
      try{
      myParagraphStyle = myDocument.paragraphStyles.item(myLabelStyle);
      myParagraphStyle.name;
      }
      catch(myError){
      myDocument.paragraphStyles.add({name:myLabelStyle});
      }
      }
      myDocumentPreferences.pagesPerDocument = myNumberOfPages;
      myDocumentPreferences.facingPages = false;
      var myPage = myDocument.pages.item(0);
      var myMarginPreferences = myPage.marginPreferences;
      var myLeftMargin = myMarginPreferences.left;
      var myTopMargin = myMarginPreferences.top;
      var myRightMargin = myMarginPreferences.right;
      var myBottomMargin = myMarginPreferences.bottom;
      var myLiveWidth = (myDocumentPreferences.pageWidth - (myLeftMargin + myRightMargin)) + myHorizontalOffset
      var myLiveHeight = myDocumentPreferences.pageHeight - (myTopMargin + myBottomMargin)
      var myColumnWidth = myLiveWidth / myNumberOfColumns
      var myFrameWidth = myColumnWidth - myHorizontalOffset
      var myRowHeight = (myLiveHeight / myNumberOfRows)
      var myFrameHeight = myRowHeight - myVerticalOffset
      var myPages = myDocument.pages;
      // Construct the frames in reverse order. Don't laugh--this will
      // save us time later (when we place the graphics).
      for (myCounter = myDocument.pages.length-1; myCounter >= 0; myCounter--){
      myPage = myPages.item(myCounter);
      for (var myRowCounter = myNumberOfRows; myRowCounter >= 1; myRowCounter--){
      myY1 = myTopMargin + (myRowHeight * (myRowCounter-1));
      myY2 = myY1 + myFrameHeight;
      for (var myColumnCounter = myNumberOfColumns; myColumnCounter >= 1; myColumnCounter--){
      myX1 = myLeftMargin + (myColumnWidth * (myColumnCounter-1));
      myX2 = myX1 + myFrameWidth;
      myRectangle = myPage.rectangles.add(myDocument.layers.item(-1), undefined, undefined, {geometricBounds:[myY1, myX1, myY2, myX2], strokeWeight:0, strokeColor:myDocument.swatches.item("None")});
      }
      }
      }
      // Because we constructed the frames in reverse order, rectangle 1
      // is the first rectangle on page 1, so we can simply iterate through
      // the rectangles, placing a file in each one in turn. myFiles = myFolder.Files;
      for (myCounter = 0; myCounter < myNumberOfFrames; myCounter++){
      myFile = myFiles[myCounter];
      myRectangle = myDocument.rectangles.item(myCounter);
      myRectangle.place(File(myFile));
      myRectangle.label = myFile.fsName.toString();
      //Apply fitting options as specified.
      if(myFitProportional){
      myRectangle.fit(FitOptions.proportionally);
      }
      if(myFitCenterContent){
      myRectangle.fit(FitOptions.centerContent);
      }
      if(myFitFrameToContent){
      myRectangle.fit(FitOptions.frameToContent);
      }
      //Add the label, if necessary.
      if(myMakeLabels == true){
      myAddLabel(myRectangle, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle, myLayerName);
      }
      }
      if (myRemoveEmptyFrames == 1){
      for (var myCounter = myDocument.rectangles.length-1; myCounter >= 0;myCounter--){
      if (myDocument.rectangles.item(myCounter).contentType == ContentType.unassigned){
      myDocument.rectangles.item(myCounter).remove();
      }
      else{
      //As soon as you encounter a rectangle with content, exit the loop.
      break;
      }
      }
      }
    }
    //Function that adds the label.
    function myAddLabel(myFrame, myLabelType, myLabelHeight, myLabelOffset, myLabelStyleName, myLayerName){
      var myDocument = app.documents.item(0);
      var myLabel;
      var myLabelStyle = myDocument.paragraphStyles.item(myLabelStyleName);
      var myLabelLayer = myDocument.layers.item(myLayerName);
      var myLink =myFrame.graphics.item(0).itemLink;
      //Label type defines the text that goes in the label.
      switch(myLabelType){
      //File name
      case 0:
      myLabel = myLink.name;
      break;
      //File path
      case 1:
      myLabel = myLink.filePath;
      break;
      //XMP description
      case 2:
      try{
      myLabel = myLink.linkXmp.description;
      if(myLabel.replace(/^\s*$/gi, "")==""){
      throw myError;
      }
      }
      catch(myError){
      myLabel = "No description available.";
      }
      break;
      //XMP author
      case 3:
      try{
      myLabel = myLink.linkXmp.author
      if(myLabel.replace(/^\s*$/gi, "")==""){
      throw myError;
      }
      }
      catch(myError){
      myLabel = "No author available.";
      }
      break;
      }
      var myX1 = myFrame.geometricBounds[1];
      var myY1 = myFrame.geometricBounds[2] + myLabelOffset;
      var myX2 = myFrame.geometricBounds[3];
      var myY2 = myY1 + myLabelHeight;
      var myTextFrame = myFrame.parent.textFrames.add(myLabelLayer, undefined, undefined,{geometricBounds:[myY1, myX1, myY2, myX2], contents:myLabel});
      myTextFrame.textFramePreferences.firstBaselineOffset = FirstBaseline.leadingOffset;
      myTextFrame.parentStory.texts.item(0).appliedParagraphStyle = myLabelStyle;
    }
    
  • Alert Image if JobNumber do not match

    Hi all

    I need to draw the attention of the image, where the operator link in different location (both the need for job number corresponding).

    Condition, path of the file Indesign & Image File Path job number remains the same.

    for example,.

    InDesign file path: _XXX_ULD/volumes/JobProd/Print/01_LIVE/2016_04/Document/185000042refresh TR

    Image path: _XXX_ULD/volumes/JobProd/Print/01_LIVE/2016_04/185000042r TR/SS_LOGOS/5.12_EXR_1_TR.ai

    var myPath = app.activeDocument.filePath.fsName;
    var mJobNumber;  
      
    var reg = /(\/)([0-9]{8})(_)/;  
    if (myPath.match(reg)){  
        mJobNumber = RegExp.$2;  
    }  
    
    alert(mJobNumber)   //Working Fine
    
    var myGr = app.activeDocument.allGraphics;
    for(i=0; i<myGr.length; i++)
    {
        
        //Problem in below line
       if(myGr[i].itemLink.filePath.match(/mJobNumber/) == null)
       {
         app.select(myGr[i].parent)
         var check = confirm("Selected Images Link Path is Wrong\rDo you want to Continue?"+ "\n") 
        if (check == true)
        {  
            //Proceed Further
            }   
           else
           {  
               exit(0);
               }  
        }
    }
    

    Thanks in advance

    Siraj

    Hi Siraj,

    9 place inside the braces and try,

    var reg = /(\/)([0-9]{9})(_)/;)

    Kind regards

    Cognet

  • How can reedit and rename the image

    Dear friends,

    Hi all, I need to be reprinted full of images - missing - (i.e. "K_MNYCEPT221161_C01PT_002T.ai") (i.e. "K_MNLESE850231_C01PT_002T.ai"). I have listed my coding below, tell a good friends suggestion.

    Application version: indesign Cs6

    var    
      mLinks = app.activeDocument.links.everyItem().getElements(),    
      cLink, cFile;    
     alert(mLinks.length)  
        
    while ( cLink = mLinks.pop() )   
      alert(cLink.length)  
    {    
      if (cLink.status == LinkStatus.NORMAL) continue;    
      cFile = File(cLink.name.replace("K_MNYCEPT221161_","K_MNLESE850231_") );   
      if ( !cFile.exists ) continue;    
      cLink.relink(cFile);    
      }  
    
    

    Thanks in advance,

    This script works on MacOS 10.11.2 & CS6

    I add the log console in the code, give me the result...

    var mLinks = app.activeDocument.links.everyItem().getElements(), cLink, cFile;
    alert(mLinks.length)
    
    while ( cLink = mLinks.pop() ){
      $.writeln('Link path : ' + cLink.filePath)
      if (cLink.status == LinkStatus.NORMAL) { continue; }
      cFile = File(cLink.filePath.replace("page","pages") );
      $.writeln('New Link path : ' + cFile.fsName)
      $.writeln('New file exist : ' + cFile.exists)
      if ( !cFile.exists ){ continue; }
      cLink.relink(cFile);
    }
    

Maybe you are looking for

  • HP Officejet Pro 8620: printing from iPhone 6

    I just installed an update to my i-phone 6 - ios 10.0.2 and can no longer print.  First of all, I received a message that the printer is paused.  Now, I get a message that the printer is busy.  I can print from my laptop.  I closed my printer, reset

  • Where is my recovery media

    I installed an M-Sata SSD as boot drive using Acronis to clone C: My original HARD drive 320 were still the files then I deleted the recovery on the SSD partition to save space (Intel 310 only 80 GB) Today, I got a 16GB USB and tried to make it a boo

  • Disable &amp; gray a case of structure of the case

    Hello! I use 2 business structure to choose if I want a channel 'create' or not. I don't know if it's the best way to do it but... It s okay if I use this control type to choose the case? and... How can I disable and grey items in the not selected ca

  • Black screen with cursor at Start Up

    original title: trying to fix the 2 systems with KSOD - it's really well I currently have 2 systems Dell with Vista, KSOD (black screen, move the mouse pointer). A desktop and a laptop. Both are standard Intel systems with Intel graphics card. They b

  • Problem HP redemption - Norton IS link not yet received

    I bought a HP Pavilion ENVY 15-J049TX Lot S/N:[personal information] I bought which at the time of the HP DIWALI UTSAV I have not received extention antivirus Norton Code (5 nov 13 - Date of purchase) help me get the Code, since my anti virus has exp