Script to open, set dimensions and save

Hi All,
I'm a newbie in Illustrator. I'd like to find a way to open a pdf file, set its new dimensions and after that, save the file in .AI format. Is that possible ? How could i achieve this ?
Thanks in advance.

OK, so here's another version of a script I posted the other day. Copy and paste into the ESTK or a text editor that will save as plain text. Save with a .jsx file extension. Place it in Adobe Illustrator CS4>Presets>Scripts and restart AI (or you can run it from the ESTK).
#target illustrator
Place_PDF_to_AI.jsx
DESCRIPTION
This script gets files specified by the user from the
selected folder and batch processes them and saves them
as AIs in the user desired destination with the same
file name.
Modified from Adobe supplied scripts and
scripts by Carlos Canto on Illustrator Scripting
by Larry G. Schneider 072911
// uncomment to suppress Illustrator warning dialogs
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var destFolder, sourceFolder, files, fileType;
// Select the source folder.
sourceFolder = Folder.selectDialog( 'Select the folder with target files', '~' );
// If a valid folder is selected
if ( sourceFolder != null )
     files = new Array();
     fileType =  prompt ( 'Select type of files to you want to process. Eg: *.pdf', ' ' );
     // Get all files matching the pattern
     files = sourceFolder.getFiles( fileType );
     if ( files.length > 0 )
          // Get the destination to save the files
          destFolder = Folder.selectDialog( 'Select the folder where you want to save the AI files.', '~' );
          for ( i = 0; i < files.length; i++ )
               var idoc = app.documents.add(DocumentColorSpace.RGB, 400.0, 533.0);  // make new document
               var ilayer = idoc.layers.add();   // make new layer
               ilayer.name = "pdf.file";  // name layer
               //ilayer.zOrder(ZOrderMethod.SENDTOBACK);  // put at bottom of layer stack
               var iplaced = ilayer.placedItems.add();  // add image place holder
               iplaced.file = (files[i]);  // place file
               var docName = (files[i].name.split('.'))[0];   // take the first part of the placed file name for the new document
               var destFile = new File(destFolder + "/" +  docName + ".ai");   // make a new file in the dest folder
               var options = new IllustratorSaveOptions();   // new save options
               options.compatibility = Compatibility.ILLUSTRATOR14;   // save as AICS4
               options.pdfCompatible = false;   // turn off PDF compatibility
               options.useCompression = false
               // Export as AI
               idoc.saveAs(destFile,  options);  // save the file in the dest folder
               idoc.close(SaveOptions.DONOTSAVECHANGES);   // close the file without saving
          alert( 'Files are saved as AI in ' + destFolder );
     else
          alert( 'No matching files found' );
app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS

Similar Messages

  • Batch script to open multiple excel and doc files

    Hi Everyone,
    Could anybody please provide a batch script to open multiple excel and doc files at a time.
    Appreciate ur quick response.
    Regards,

    You have several scripting choices within Windows. At a basic level you've got "batch files" - which run a series of command interpreter commands, and have a file extension of .BAT or .CMD. If you just wanted to open a list of Word documents, then assuming that the path to Word is correct (something like this below) you could list these in a file with a .BAT extension and run this (e.g. double click on it):
    "C:\Program Files\Microsoft Office\Office\Winword.exe" "C:\Documents and Settings\All Users\Desktop\File1.DOC"
    "C:\Program Files\Microsoft Office\Office\Winword.exe" "C:\Documents and Settings\All Users\Desktop\File2.DOC"
    "C:\Program Files\Microsoft Office\Office\Winword.exe" "C:\Documents and Settings\All Users\Desktop\File3.DOC"
    "C:\Program Files\Microsoft Office\Office\Excel.exe" "C:\Documents and Settings\All Users\Desktop\File1.XLS"
    "C:\Program Files\Microsoft Office\Office\Excel.exe" "C:\Documents and Settings\All Users\Desktop\File2.XLS"
    Another script language is VBScript, which was the example I gave. VBScript is available on most Windows platforms and can be run from a command prompt or within Windows. If you save the text I gave you above to a file with a .VBS extension you can double-click to run it (Windows) or open a command prompt and type CSCRIPT MyVBScript.VBS (assuming that's the name of the your .VBS file).
    Other script languages are available to achieve the same thing, including Powershell, however you'd need to have Powershell available on your PC.

  • Cubes - how to extract a single dimension and save it in a table

    Hi,
    I am new to the cubes concept, although I've used it several times in the past to analyse the data but never explored options beyond that. using excel, I can get different dimentions from the cube such as customer information, location, etc.
    is there a way to extract (automatically) a single dimension and save it in a table...? e.g I want to pull customer name and revenues only from the cube, how would I do it?
    Thanks

    Hi,
    tparvaiz wrote:
    Hi,
    I am new to the cubes concept, although I've used it several times in the past to analyse the data but never explored options beyond that. using excel, I can get different dimentions from the cube such as customer information, location, etc.
    is there a way to extract (automatically) a single dimension and save it in a table...? Sure, you can do that.
    Say you had a table with many customers, and you were interested in only one of those customers: what would you do? You'd write a query with a WHERE clause that included only the customer you wanted to see.
    A cube is a table with many dimensions. You're interested in only one of those dimensions, so what can you do? You can write a query with a WHERE clause to include only the dimension you want to see.
    e.g I want to pull customer name and revenues only from the cube, how would I do it?Exactly how to do it depends on the table(s), your requirements and your Oracle version. As the others have said, post a little sample data (CREATE TABLE and INSERT statements to simulate what your real table looks like), and the results you want from that data.
    Always say which version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • HT3529 can you set up and save groups of more than 10 contacts for imessages for future use?

    can you set up and save groups of more than 10 contacts for imessages for future use?

    It can be done by creating a contact for that group which includes all their email addresses all separated by a comma or semicolon. You may have to format it just right depending on the email service you're using. Also, you will have to type this out in Notes first in order to be able to get the punctuation in there, then copy & paste the entire list into the email field of the new contact.

  • I converted from a PC to a Mac Mini.  I have my PC documents backed up on a DVD disk.  I have an external DVD drive connected to the Mac Mini.  I want to open them up and save them to the Mac, BUT....when I put the DVD disk in the Mac is NOT reading it!

    I converted from a PC to a Mac Mini.  I have my PC documents backed up on a DVD disk.  I have an external DVD drive connected to the Mac Mini.  I want to open these documents up from the DVD storage and save them to the Mac, BUT....when I put the DVD disk in the Mac is NOT reading it!

    Hi Joe,
    Thanks for your quick response.  I should add....it worked before.  When I previously inserted the two DVDs into this remote drive, and I went into finder, I could click on the "remote device" line and see all my saved documents (excel, word, etc) on the DVD and open them on the Mac.  Now I cannot see them, when I try to open them on the Mac, nothing happens, nothing is displayed.  I just re-tested the remote DVD drive with a CD and, no problem, it opened up the CD via iTunes and I cold play the CD.  SO......I know the remote DVD drive (it's an LG by the way) is fine, it's something to do with some settings on my mini mac,especially where I could open it previously.  I do not remember changing any settings since then. 
    When I go into system preferences and click on CD/DVD it gives me options of how to open up a music CD (default is iTunes), a DVD (default is iMovie), etc.  The problem is my DVD is all miscellaneious files/documents.  I just want to be able to see them in the finder.  I also tried to open them via microsoft word, from the remote disk and again, it could not open the drive, even though some of the documents were microsoft word documents.  Again, I was able to open them previously and the DVD is not corrupted in any way.  
    Any additional advice? 
    Thank you!

  • Programmatically open a file and save it in a new directory

    To start off, I'm relatively new to LabVIEW and did a couple searched about this and couldn't find anything pertaining to what I wanted.
    Right now I have an event structure where I click a button and the file dialog comes up.  I then select a CAN database file.
    After that is done I'd like to save the file to the program's directory and save the relative path to an array/spreadsheet/whatever (I haven't decided what would be the most appropriate yet).  Saving the relative path is the easy part.  After opening the file, I can't seem to find anything that will let me programmatically save it to another location.
    Does anyone know how to do this?  Thank you for the help.

    Thanks for the help.  Apparently, I didn't look aroun good enough or missed it.

  • Script to open a file and zoom to pixel

    Hi, I work for a mapping company and one of our digital camera has a fault with the lens resulting in a small black mark appearing in exactly he same location of every image we capture what I would like is a script that can be used to open a file set the zoom say to 100% and move to pixel 3324x5493 so I user can repair it.
    I thought this would be simple but I've been looking all evening without finding anything
    Thanks
    Stu

    I have something started but it isn't quite finished. It will center on the pixel and zoom in, but the only holdback is it increases the canvas size which will need to be cropped later. If you first set the Background layer to a non-Background layer your extra canvas will be transparent which will allow for a simple trim to return to the normal image later.
    function centerON (x,y) {
        var startRulerUnits = app.preferences.rulerUnits;
        var startTypeUnits = app.preferences.typeUnits ;
        var startDisplayDialogs = app.displayDialogs;
        app.preferences.rulerUnits = Units.PIXELS;
        app.preferences.typeUnits = TypeUnits.PIXELS;
        app.displayDialogs = DialogModes.NO;
        var centerDoc=app.activeDocument;
        w=centerDoc.width.value;
        h=centerDoc.height.value;
        hdiff=Math.round(Math.abs((x-w/2)*2));
        vdiff=Math.round(Math.abs((y-h/2)*2));
        if (x>w/2) {var hor="LEFT";}
        else if (x<w/2) {var hor ="RIGHT";}
        else {var hor="CENTER";}
        if (y>h/2) {var ver="TOP"; }
        else if (y<h/2) {var ver="BOTTOM"; }
        else {var ver="MIDDLE"; }
        newwidth=w+hdiff;
        newheight=h+vdiff;
        switch (ver) {
            case "TOP":
            switch (hor) {
                case "LEFT": anchor=AnchorPosition.TOPLEFT; original=[0,0,w,h]; break;
                case "RIGHT": anchor=AnchorPosition.TOPRIGHT; original=[hdiff,0,hdiff+w,h]; break;
                case "CENTER": anchor=AnchorPosition.TOPCENTER; original=[0,0,w,h]; break;
            }; break;
            case "BOTTOM":
            switch (hor) {
                case "LEFT": anchor=AnchorPosition.BOTTOMLEFT; original=[0,vdiff,w,vdiff+h]; break;
                case "RIGHT": anchor=AnchorPosition.BOTTOMRIGHT; original=[hdiff,vdiff,hdiff+w,vdiff+h]; break;
                case "CENTER": anchor=AnchorPosition.BOTTOMCENTER; original=[0,vdiff,w,vdiff+h]; break;
            }; break;
            case "MIDDLE":
            switch (hor) {
                case "LEFT": anchor=AnchorPosition.MIDDLELEFT; original=[0,0,w,h]; break;
                case "RIGHT": anchor=AnchorPosition.MIDDLERIGHT; original=[vdiff,0,vdiff+w,h]; break;
                case "CENTER": anchor=AnchorPosition.MIDDLECENTER;original=[0,0,w,h]; break;
            }; break;
        app.runMenuItem(charIDToTypeID("FtOn"));
        centerDoc.resizeCanvas(newwidth,newheight,anchor);
        app.runMenuItem(charIDToTypeID("ActP"));
        app.refresh();
    //    centerDoc.trim();
    //    centerDoc.crop(original);
        app.preferences.rulerUnits = startRulerUnits;
        app.preferences.typeUnits = startTypeUnits;
        app.displayDialogs = startDisplayDialogs;
    centerON(234,3500);
    For centerON(234,3500); you would of course input your own x,y coordinates where you want to center the image.
    The issue I'm having is that if I trim or crop the image, it will sometimes re-center the image elsewhere. I've tried using a crop with hide to center on the pixel then Reveal All to show the whole image again, but that also re-centers the image. Though, that may actually be a better way for you to do it afterall. Instead of increasing the canvas size, you could crop with hide to put the center on the pixel you want, then when finished just Reveal All.
    It would just be easier if Photshop kept focus centered during a crop.

  • Generate Script from table with Clob and save other Database

    Hi
    How can I to read data from Clob column and insert into other table in other Database,
    The fist Table is in Test Quality and second in Production
    Are there way without to use Export/ Import ?
    Can I to use Loader ?
    Using 9i

    3360 wrote:
    muttleychess wrote:
    mschnatt wrote:
    than you only can try the db-link
    CREATE DATABASE LINK <dblink-name> CONNECT TO <user> IDENTIFIED BY <pwd> USING '<tnsnames-entry>';
    and make table
    create table ....
    as select ....Thank , but too no work :-( :-(
    SQL> select id,clob_data from myclob@teste;
    select id,clob_data from myclob@teste
    ERRO na linha 1:
    ORA-22992: cannot use LOB locators selected from remote tables
    Well you didn't do what the reply said to do
    and make table
    create table ....
    as select ....Also in the manual, you could save yourself a lot of time if you would open it.
    http://docs.oracle.com/cd/B14117_01/appdev.101/b10796/adlob_wo.htm#1006314
    >
    The following syntax is supported on remote LOB columns:
    CREATE TABLE t AS SELECT * FROM table1@remote_site;
    INSERT INTO t SELECT * FROM table1@remote_site;
    UPDATE t SET lobcol = (SELECT lobcol FROM table1@remote_site);
    INSERT INTO table1@remote_site select * from local_table;
    UPDATE table1@remote_siteset lobcol = (SELECT lobcol FROM local_table);
    DELETE FROM table1@remote_site <WHERE clause involving non_lob_columns>
    This is the only supported syntax involving LOBs in remote tables. No other usage is supported.
    >[h1]Thank you very much, very very good [h1]

  • Can I open a PDF and save it as a JPG or GIF?

    I asked on the PageMaker forum about creating a jpg or gif of a book cover I created in PageMaker. The suggestion was to create a pdf of it (no problem), open it in PhotoShop, then save it in the format I need. I don't own PhotoShop, so downloaded the Album Starter Edition. For the book cover with photos on it, only the photos are imported; for the book cover with only text and solid-color boxes, nothing at all is imported. Does anyone know how to get the entire pdf into PhotoShop so it can be saved, intact, as a jpg or gif? Thanks!

    I think Downloader in PSE organizer has capabilty to extract images from PDF.
    Collin- Is there any other way in PSE to extract images from PDF. Pls tell us how hat can be done.

  • Need help with easy script for open / close app and move files

    Hi,
    I'm not a scripter.. never done anything special perhaps more complicated than /shutdown -s on cmd..
    I actually learned ASCII C language on university but never used it in real.
    I'm trying to create a basic script that perhaps you could help me or guide me how to do it..
    The commands are
    1) Close a running app (end task it or force kill it, I prefer end task it)
    2) delete files from x location
    3) run .exe app from y location
    4) close that running app 
    5) move files from z to y
    Perhaps adding few "wait few seconds" commands in between each, so the apps will launch successfully..
    My first question will be whats the easiest script language to do that?
    I tried VBScript but couldn't find commands for open or close apps.. also for controlling files..
    And what commands can do that? I could google them up for better understanding no need for rough guide
    And lastly, does it too hard? If it takes more than hour to make it (learn and process) than it ain't worth it..
    Thanks alot ahead!
    Jordan.

    hmm 2 questions:
    1) taskkill.exe causing me access deny error.. I used "taskkill.exe /IM softwarename.exe"
    how do I get permission or something to fix that?
    2) on the "move" command..
    First, its a "copy" instead.. but I easily figured that out.. 
    but more important is that I want to copy a folder.. with unknown list of way too long files and sub folders..
    and all I see is ability to move a file..
    Is this possible?
    Thanks

  • In C#, how can I detect an opened PDF file and save it into disk?

    he WebBrowse componente in C# opened an PDF file inside. The file came from the Internet. So, the Adobe Acrobat Reader was called and opened the file correctly. I want to save this file to disk. How can I do it?
    The WebBRowse component does not have access to the PDF content.

    PDFs are not designed to be editable. Your engineers can make comments using Adobe Reader without any extra steps provided they use the highlight and sticky note comments. If you want them to have access to the full range of comment markup you will need to use Acrobat to apply extended rights to the file.

  • How to set dimension and another parameters of received dataSource to rec?

    I have a small problem with set the dimension of recording video from received dataSource.
    It always have dimension of original dataSource :/
    I have done something like this:
      FileTypeDescriptor ftd = new FileTypeDescriptor(FileTypeDescriptor.MSVIDEO);
      Format[] formats = new Format[] {new VideoFormat(VideoFormat.CINEPAK, new Dimension(1024,768), Integer.MAX_VALUE, Format.byteArray, (float)30)};
      ProcessorModel pm = new ProcessorModel(datasource, formats, ftd);
       processor = Manager.createRealizedProcessor(pm);
      DataSource outputDS = processor.getDataOutput();
       MediaLocator ml = new MediaLocator("file:capture.avi");
       datasink = Manager.createDataSink(outputDS, ml);
       datasink.open();
       datasink.start();
    I see that Datasource is not changed.
    But when I try to something like this:
    FormatControl formCont=((CaptureDevice)ds).getFormatControls()[0];
       VideoFormat formatVideoNew = new VideoFormat(null,null,-1,null,(float)camFPS);
       formCont.setFormat(CapFormat.intersects(formatVideoNew));
    I have an exception with casting Clonable dataSource to CaptureDevice:
    java.lang.ClassCastException: com.ibm.media.protocol.SuperCloneableDataSource$PushBufferDataSourceSlave cannot be cast to javax.media.protocol.CaptureDeviceThis works only when I'm operating od datasource taken from capturedevice, not received from another computer.
    The question is simple: How can I change dimension, frameRate etc. of record from received dataSource.

    FormatControls are only available on capture devices that have the ability to capture in multiple formats. The FormatControl is used to control the device itself, not the stream. The concept of using a FormatControl on a DataSource that isn't reading from a capture device doesn't make sense, which is why you're having problems.
    In order to change the resolution or other format characteristics of a video stream that isn't coming from a capture device directly, you'll need to transcode it from the existing format to the new format.
    [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/Transcode.html]
    Which is achieved by passing it through a Processor...

  • Open as .JPG and save as .JPG?

    Hello everyone!
    I were just wondering if there was a way I could save them as .JPG as I did with .PSD? Because when I do save with the .PSD file, it saves without have to chose name, etc., will that be possible on the .JPG files?  I open them as a .JPG picture, and puts in a .PNG file, but thats maybe why? Please, I could really need this..
    Program and System:
    Adobe Photoshop CS6 Extended
    Macintosh

    Haha, somehow I found out how.

  • Is there any way to cut & paste a group of links from a Word dod into a Bookmark/Folder, or must I open each link and save one at a time?

    computer crashed; system restored old IE Faves but not Mozilla Bookmarks so I have to re-create them

    It is much easier if you save the file with those links as an HTML file with A href="http" links in MS Word and import that file in Firefox.
    (Firefox >) Bookmarks > Show All Bookmarks > Import & Backup > Import HTML : "From File"
    * http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox

  • TS3991 If i produce a document on my PC in WORD.  Can I open it, edit and save in CLOUD

    Can anyone tell me if I produce a document on my PC in WORD can i edit it on my laptop and is it then saved in ICLOUD??

    Welcome to the Apple Support Communities
    If you have purchased Pages for the iPhone, iPod touch or iPad, you can. Open http://www.icloud.com, login with your Apple ID, select iWork and drag your documents to the browser window, so they will be uploaded to iCloud as Word documents.
    If you haven't purchased Pages or you don't have any Apple device, instead of using iCloud, you should use a cloud service as Dropbox or, better, Microsoft SkyDrive

Maybe you are looking for