Illustrator Macros/Scripting

Hey guys is it possible to create macros in illustrator, or how would this be achieved via the scripting.
Basically i have a c# application that contains alot of pictureboxes all with images in them. i want to be able to right click an image and select vectorise. Which will send the image to illustrator live trace the image, resize it, then copy the resulting image back into my c# app.
How would this be best done
thanks
r

hey
thanks for the reply, i found the actions and managed to record a macro. however have a problem i have recorded the following actions
1. Create a new document
2. Paste image from clipboard
3. Live trace the image
However when i play the macro back it doesnt appear to have saved the live traceing i done.
any ideas why this is or how to overcome it ?

Similar Messages

  • How can get Information of Exfect in Illustrator by Script?

    Illustrator can setting Effect: Illustrator Effect, Photoshop Effect to Object,
    But i find in document not exist attributes can get their information.
    How can get Information of Exfect in Illustrator by Script?

     

  • Problems with Freehand Illustrator CS4 script for Macs

    A couple of us just downloaded the new Freehand to Illustrator CS4 script for Macs that was released on 5/17/10. Sometimes it works okay, but more often than not we get errors like 'ERROR: 1, Access is denied'. If we instead just open the Freehand file, the file comes in fine. What have been other people's experiences using this new script?
    Mac OS X 10.5.5

    Is the problem there only at the time of conversion or even the FH files are not opening after running the script
    Here is what I have done and may be you can follow the exact steps :
    1) Create a folder FH on Desktop and paste only the FH files in the folder( My folder does not contain any other file apart from FH files)
    2) Create a Folder AI  on Desktop and keep it empty
    3) File-> Scripts-> FreehandToAI
    4) Select the source folder( FH)
    5) Now select the destination folder(AI)
    It gives the message after conversion "N freehand files are converted to AI".

  • Illustrator VBA scripting 101 - via Excel

    This post will attempt to introduce newcomers to Illustrator Visual Basic Scripting (well, not actually vbs, but rather tru VBA, Visual Basic for Applications). I personally prefer vba over bvs for a number of reasons. First, I always have Excel and Illustrator open, so it makes sense for me use it to drive Ai. Second, I usually need to transfer data between the two programs. Third...I love the Excel IDE...ok, let's get right into it.
    - Open Excel
    - hit Alt+F11, to bring up the editor
    - in the Tools menu, click on References...
    - add a reference to "Adobe Illustrator CS5 Type Library"
    - in the Personal.xls (or in any other book) add a Module. Personal is a global workbook that is always available. If you don't see it, go back to Excel and record a macro, anything will do. That will create the Personal file.
    - and type the following in that module
    - we have to continue the tradition and do the "HelloWorld" script
    Sub helloWorld()
        Dim iapp As New Illustrator.Application
        Dim idoc As Illustrator.Document
        Dim iframe As Illustrator.TextFrame
        Set idoc = iapp.ActiveDocument
        Set iframe = idoc.TextFrames.Add
        iframe.Contents = "Hello World from Excel VBA!!"
        Set iframe = Nothing
        Set idoc = Nothing
        Set iapp = Nothing
    End Sub
    - save Personal book
    - open Illustrator and create a new document first
    - to run, move the cursor anywhere inside the Sub...End Sub and hit F5
    that's it for now...in the following posts we'll move the text to the middle of the page, create new documents, get data from an Excel Range to Illustrator, get data from Illustrator text frame to an Excel Range...and more, hopefully.
    questions? comments?

    Lesson 4: Creating Shapes, Working with Selections, writing data to Excel
    In the Illustrator world a shape is a....well, I'm not going to bore you with technical terms only rocket scientists would understand....let's just say a Circle is a shape, as well as a Rectangle or a Star, there much better than the actual definition. Then in the scripting lingo all shapes are pathItems.
    There are a number of ways of creating shapes, in this exercise well focus on using the various Methods of the PathItem Object.
    to create a Circle we'll use the Ellipse Method, all arguments are optional, if we don't supply any, the method uses default values.
    Ellipse
    ([top as Double]
    [, left as Double]
    [, width as Double]
    [, height as Double]
    [, reversed as Boolean]
    [, inscribed as Boolean])
    Dim icircle As Illustrator.PathItem
    Set icircle = idoc.PathItems.Ellipse(300, 300, 100, 100)
    similarly, to create a square, we use the Rectangle Method
    Dim isquare As Illustrator.PathItem
    Set isquare = idoc.PathItems.Rectangle(200, 200, 100, 100)
    and to make a star we use the...hum...the Star Method
    Dim istar As Illustrator.PathItem
    Set istar = idoc.PathItems.Star(400, 400, 100, 50, 5)
    now lets select the square and read some of its properties and write them down to Excel
    isquare.Selected = True
    get properties of the top most selection, in case we have many items selected, for now it should only be the square
        w = idoc.Selection(0).Width
        h = idoc.Selection(0).Height
        y = idoc.Selection(0).top
        x = idoc.Selection(0).left
    and lets write those values to Excel, using the Cells object this time. Make sure you have a blank Excel book open, it will write data to the first 4 rows, 2 first columns
        Cells(1, 1) = "width: "
        Cells(1, 2) = w
        Cells(2, 1) = "height: "
        Cells(2, 2) = h
        Cells(3, 1) = "top: "
        Cells(3, 2) = y
        Cells(4, 1) = "left: "
        Cells(4, 2) = x
    here's the complete code, from now on, we'll start every exercise with a blank Excel book and a blank Illustrator document, so please do that before runing.
    Sub lesson4shapes()
        Dim iapp As New Illustrator.Application
        Dim idoc As Illustrator.Document
        Dim icircle As Illustrator.PathItem
        Dim isquare As Illustrator.PathItem
        Dim istar As Illustrator.PathItem
        Set idoc = iapp.ActiveDocument
        Set icircle = idoc.PathItems.Ellipse(300, 300, 100, 100)
        Set isquare = idoc.PathItems.Rectangle(200, 200, 100, 100)
        Set istar = idoc.PathItems.Star(400, 400, 100, 50, 5)
        isquare.Selected = True
        w = idoc.Selection(0).Width
        h = idoc.Selection(0).Height
        y = idoc.Selection(0).top
        x = idoc.Selection(0).left
        Cells(1, 1) = "width: "
        Cells(1, 2) = w
        Cells(2, 1) = "height: "
        Cells(2, 2) = h
        Cells(3, 1) = "top: "
        Cells(3, 2) = y
        Cells(4, 1) = "left: "
        Cells(4, 2) = x
        Set istar = Nothing
        Set isquare = Nothing
        Set icircle = Nothing
        Set idoc = Nothing
        Set iapp = Nothing
    End Sub
    Note that the code we just wrote is not the most efficient way of doing things, we don't have to select an object in order to work on it (get the properties for instance). We did it for illustration purposes, we could also use a loop to write data to Excel. We'll do that in the next lesson.
    also, note that the top/left values don't match exactly with the values we entered (200, 200), homework, can you tell why?

  • Creating Multi-Page PDF from a Layerd Illustrator file (script)

    Often times when designing a logo I create different versions and variable options on layers. This can result in several layers in one Illustrator file. Is there an easy way or an existing script that will allow me to (with one click) create a multi-page PDF consisting of all the layers within my .ai file? The current method is turning on each layer, performing a save-as (PDF), then turning off said layer and turning on the next layer and repeating the task and so-on-and-so-forth, etc … It becomes tedious and quite often I save over the previous version, forgetting to re-name it or forget to perform a save on a certain layer. Can anyone help with some advice? I have never written my own script before but am not opposed to trying, where do I begin?
    Any help is appreciated.

    You don't say what OS you are using and which scripting language you are thinking of doing this in…
    This is a sample that may get you started done in JavaScript so it's platform independent with the exception of my 'mac style' file paths.
    If your on a PC it may just be a typo to set to C drive or whatever you call them things…
    If you are on the mac OS then it should just dump a load of PDF's on your desktop.
    You say about a multi-page PDF but don't think Illustrator can do this unless its been added with multi-artboards in CS4?
    Others would have to let you know that…
    #target illustrator
    var docRef = app.activeDocument;
    with (docRef) {
    var docName = baseName(name)
    var pdfOptions = new PDFSaveOptions();
    pdfOptions.pDFPreset = '[High Quality Print]';
    // Turn all layers off
    for (var i = 0; i < layers.length; i++) {
    layers[i].visible = false;
    // Turn each layer on
    for (var i = 0; i < layers.length; i++) {
    if (i == 0) {
    layers[i].visible = true;
    redraw();
    var layerName = layers[i].name;
    var saveAsPath = new File('~/Desktop/' + docName + '_' + layerName + '.pdf')
    saveAs(saveAsPath, pdfOptions);
    } else {
    layers[i-1].visible = false;
    layers[i].visible = true;
    redraw();
    var layerName = layers[i].name;
    var saveAsPath = new File('~/Desktop/' + docName + '_' + layerName + '.pdf')
    saveAs(saveAsPath, pdfOptions);
    //close(SaveOptions.DONOTSAVECHANGES);
    function baseName(fileName) {
    var nameString = '';
    var extOffset = fileName.lastIndexOf('.');
    if (extOffset == -1) {
    nameString = fileName;
    } else {
    nameString = fileName.substr(0, extOffset);
    return nameString;

  • Illustrator extend script save() changes file extension

    If I open a PDF in Illustrator, make a change, and save using the menu option or shortcut, the file is saved as expected.
    If I try to use extend script (i.e. app.activeDocument.save(), or .saveAs()), the file extension is renamed to .ai. How do I keep my original filename when saving with extend script?

    Got it working by using .saveAs() with PDFSaveOptions

  • Extract images from PDF out of Illustrator with script

    Looking for a script to extract images from a pdf opened in Illustrator.
    I need the images to extract separately to a folder. Jpeg perhaps.

    hi
    I have to do the same... I have to convert a pdf to an image format.... can you solved the problem??? Can you help me??
    Thanks in advance...

  • Illustrator CS2 - Scripting Opportunities

    Created a process in Visual Studio 2003 (VB.NET, Framework (v1.1.4322),Windows XP SP2) a few years ago to call a few Actions within Illustrator 10 to prep files for our internal customers. This process runs great and performs as expected. When I try running the process now utilizing Illustrator CS2 (12.0.1), the Application.DoScript () & Application.ActionIsRunning causes the following exception(s):
    Errors : System.Runtime.InteropServices.COMException (0x80004005): Unspecified error at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at Illustrator.ApplicationClass.DoScript(String Action, String From, Object Dialogs) at GraphicFiles.clsProcessFiles.ProcessFiles() in clsProcessFiles.vb:line 278 - Code Section:2 - Running Action Scripts [Selected]
    OR
    Errors : System.Runtime.InteropServices.COMException (0x80004005): Unspecified error at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at Illustrator.ApplicationClass.get_ActionIsRunning() at GraphicFiles.clsProcessFiles.ProcessFiles() in clsProcessFiles.vb:line 291 - Code Section:2 - Running Action Scripts [Selected]
    Is there a problem with the ScriptingSupport.aip file in CS2? I can run my Actions manually from the Action window but I continue to get the errors listed above outside of Illustrator. I tried Pausing the code for 8-10 seconds before checking the ActionIsRunning property but I still get errors. I also tried changing the Play Back options on the Actions and received the same results. Has anyone experienced this problem and have a solutions/workaround for this opportunity? Should I upgrade to CS3?
    Thanks
    Shawn Wilson

    Félix, ¿dominas el inglés como para publicar un mensaje en ese idioma? Es muy posible que en Adobe ni siquiera sepan de la existencia del problema, ya que no muestran mucho interés por el mercado de habla hispana, y nosotros mismos no nos hacemos oir con suficiente fuerza.
    El sitio para solicitar nuevas características para Illustrator está aquí:
    http://www.adobeforums.com/cgi-bin/webx?14@@.eecfd7c
    y el sitio para reportar
    bugs, aquí:
    http://www.adobe.com/misc/bugreport.html
    Si no te sientes cómodo escribiendo en inglés, publica aquí mismo un resumen del problema y de su solución, lo más claro posible, y yo lo publicaré por tí, o te publicaré aquí una traducción para que lo publiques tú mismo, como prefieras.

  • Illustrator interactive scripting?

    Hello all--
    I am interested in writing a special type of script with Adobe Extendscript for use in Adobe Illustrator. The unique thing I need here is the ability to run a script in the background that does event listening, so essentially, instead of invoking a script that does something and then terminates, the user would invoke the script, which would wait for certain keystrokes or user interaction before altering the active document, much like in actual javascript. Do any of you know if this is actually possible? All of my internet scouring seems to say no.

    All scripts are modal since they are based on reflections of internal commands. As long as the apps do not support asynchronous threaded processing a script can't work that way.
    Mylenium

  • Illustrator CS4 Script

    Hi.
    I am creating a script for Illustrator CS4 using Word VBA.
    When I execute the following code,
    I get an error ,that is "ActiveX component can't create object".
    Set app = CreateObject("Illustrator.Application")
    This code works well on Illustrator CS2, but not on CS4.
    I don't know why this error occured
    Can some give me any advice?
    Best Regard.
    erieru103http://forums.adobe.com/people/erieru103

    Hi.
    My script works by using CreateObject("Illustrator.Application.CS4").
    Thank you for your advice.
    The scripting guide says
    "If you have multiple versions of Illustrator installed on the same machine and use the CreateObject
    method to obtain an application reference, using "Illustrator.Application" creates a reference
    to the latest Illustrator version. To specifically target an earlier version, use a version identifier at the
    end of the string..."
    There was CS3 version installed on my PC.
    Before installing CS4, I have unstalled CS3.
    Why the error occured??
    Best regard.
    erieru103

  • Macro/script needed for automatic layer naming

    Hi. I'm new to the forums, but I did a search for this and found something similar, but not quite right. I'm looking for a macro (that I've used in the past, so I know it exists) that will unlock and name the background layer after the filename AS YOU OPEN the file in Photoshop. For example: I'm in Bridge/Finder, and I drag a file named "istock123456.jpg" into Photoshop. As PS opens the file in its own window, instead of the only layer being locked and called "Background", it will be unlocked and called "istock123456.jpg". I've used this macro before at my old job, and it's extremely helpful for referencing back to original files when you need to.
    Can anyone help with this? As I mentioned, I found a similar discussion on here, but all that script does is create a new empty layer with the filename on top of the background layer, and you have to manually run it as it's not automatic like I'm talking about here.
    Thanks in advance.

    This should do it...
    activeDocument.activeLayer = activeDocument.layers[activeDocument.layers.length-1];
    if(activeDocument.activeLayer.isBackgroundLayer) activeDocument.activeLayer.name = activeDocument.name;
    Set up Scripts Event Manager to call this script on Open Document.

  • Illustrator CS2 ScriptのTagの不具合について

    Illustrator CS2 (Win)
    環境:Windows XP SP2
    VBScriptで自動化を試しています。
    TextFrameにTag、Tags で"Name"、"Value"プロパティを設定しても、"Value"の値が"Name"と同じになってしまいます。
     > JavaScriptのサンプルコードを試しても同じ。
    これはScriptの仕様のバグなのでしょうか?
    それともUPDateなどで対応可能でしょうか。
    ご存知の方がいれば教えてください。

    Félix, ¿dominas el inglés como para publicar un mensaje en ese idioma? Es muy posible que en Adobe ni siquiera sepan de la existencia del problema, ya que no muestran mucho interés por el mercado de habla hispana, y nosotros mismos no nos hacemos oir con suficiente fuerza.
    El sitio para solicitar nuevas características para Illustrator está aquí:
    http://www.adobeforums.com/cgi-bin/webx?14@@.eecfd7c
    y el sitio para reportar
    bugs, aquí:
    http://www.adobe.com/misc/bugreport.html
    Si no te sientes cómodo escribiendo en inglés, publica aquí mismo un resumen del problema y de su solución, lo más claro posible, y yo lo publicaré por tí, o te publicaré aquí una traducción para que lo publiques tú mismo, como prefieras.

  • Launch illustrator with script from commandline

    Hi,
    (Illustrator CC 2014 on Windows 7)
    I had hotkeys defined using AutoHotkey to execute a script in illustrator by executing a commandline, and with the script as an argument. This used to work fine, but it has suddenly stopped working for me, maybe with one of the latest Illustrator CC updates...
    The command-line looks something like:
    "C:\Program\Adobe\Adobe Illustrator CC 2014\Support Files\Contents\Windows\Illustrator.exe" "c:\pathtoscript\myscript.jsx"
    Now Illustrator just sits there and nothing happens!
    Has anyone else seen this? Can someone confirm if this worked in previous versions and also confirm that it doesn't in the latest, please?
    Thanks!

    you code does work with CS5, win7, I don't have CC to try
    I thought you could add a "special" switch like /run or /r and while either work, so does /taco or any other word...so, see if this helps
    "C:\Program\Adobe\Adobe Illustrator CC 2014\Support Files\Contents\Windows\Illustrator.exe" /run "c:\pathtoscript\myscript.jsx"
    another option is to run the script via ESTK, you first need to add #target illustrator to the beginning of your script
    command line:
    "C:\Program Files (x86)\Adobe\Adobe Utilities - CS5.5\ExtendScript Toolkit CS5.5\ExtendScript Toolkit.exe"
    -run "c:\pathtoscript\myscript.jsx"

  • Create adobe illustrator rectangle script?

    hi, this is a vba script that works in corel draw. I want it to work in illustrator instead but I don't know how to ammend it into javascript and adobe scripting language! Can anybody help??
    what it does:
    with an object selected
    I run script
    it creates around the selected object a thin rectangle with a margin from the object of 0.05cm
    then groups the object and rectangle togeather
    thats it
    Martin
    Sub makeRect()
        Dim s As Shape, sRect As Shape
        Dim x As Double, y#, h#, w#
        Dim dMarg#
        Dim sr As New ShapeRange
        dMarg = 0.05
        ActiveDocument.Unit = cdrCentimeter
        Set s = ActiveShape
        If s Is Nothing Then Exit Sub
        s.GetBoundingBox x, y, w, h
        Set sRect = ActiveLayer.CreateRectangle2(x - dMarg, y - dMarg, w + (dMarg * 2), h + (dMarg * 2))
        sRect.Outline.Width = 0.001
        sRect.CreateSelection
        sr.Add sRect
        sr.Add s
        sr.Group
    End Sub

    ok, good, the options for you are
    - if you have Excel or other Office application, and if you don't mind having Excel open and running your scripts from there then I can show you how to translate the corel script to illustrator using VBA, since you're more familiar with it.
    - or start from scratch and translate the script to Javascript and run it directly from within Illustrator...it will need more effort on your part to understand the new language....
    but either way at the end more beneficial to you, better yet if you learn both languages.

  • Illustrator export script

    Hi,
    I was looking for a script that will allow me export to PDF with predefined PDF export preset.
    I found this and I would like to instead of getting prompts which profile to choose (from the list), use that profile permanently (say it's number 7).
    Also would be great if script would add to that exported file string of text at the end say like _exported1.pdf
    Any ideas?
    #target illustrator
    if (app.documents.length>0){
    var FolderRef = new Folder();
    var folderResult=false;
    try {
         FolderRef = FolderRef.selectDlg("Folder to save your PDF");
    if (FolderRef!=null){folderResult=true;}
    } catch (e) {
         alert("! Error on selecting folder:\n"+e+" !");
         folderResult=false;
    var list=app.PDFPresetsList;
    var Plist='';
    for (var i in list){Plist+="\n"+i+" : "+list[i]}
    var pIndex=prompt ('Choice your PDF preset by number'+Plist,10);
    for (i=app.documents.length;i>0;i--){
         var PDF = new PDFSaveOptions();
         PDF.pDFPreset =list[pIndex];
         var saveName = new File (FolderRef+"/"+documents[0].name);
         documents[0].saveAs(saveName,PDF);
         documents[0].close();
    alert ("Done!");
    Peter

    Pete Stan wrote:
    ... Unfortunately I am completely newbie when it comes to JavaScript ...
    Where did the code come from then? Here perhaps? http://forums.adobe.com/message/2848958
    Pete Stan wrote:
    W_J_T your code gives me this error:     Error 8: Syntax error. Line: 1 -> # target illustrator
    Sorry, that is just the "space" between # target, it should be no space #target (I auto-formatted with my text editor and it added the space, I didn't catch it)
    Does the version below do what you want? It should deal with what "rama@adobe" mentioned above, sorry I didn't look close enough at the code before when posting.
    #target illustrator
    if (app.documents.length > 0) {
        var FolderRef = new Folder();
        var folderResult = false;
        try {
            FolderRef = FolderRef.selectDlg("Folder to save your PDF");
            if (FolderRef != null) {
                folderResult = true;
        } catch (e) {
            alert("! Error on selecting folder:\n"+e+" !");
            folderResult = false;
        var pdfPresetList = app.PDFPresetsList;
        // PDF Presets List # , 0 through Length
        var presetIndex = 7;
        // File name appended string
        var fileNameAppend = "_exported1"
        for (i = app.documents.length; i > 0; i--) {
            var PDF = new PDFSaveOptions();
            PDF.pDFPreset = pdfPresetList[presetIndex];
            // Get the file name minus the file extension, also remove spaces and replace with underscores
            var fileName = app.documents[0].name.substr(0, app.documents[0].name.lastIndexOf('.')).split(' ').join('_');
            // Combine the fileName with the fileNameAppend plus the .pdf file extension (the extension part however is probably is not needed and can be removed)
            var saveName = new File(FolderRef + "/" + fileName + fileNameAppend + ".pdf");
            documents[0].saveAs(saveName, PDF);
            documents[0].close();
        alert("Done!");

Maybe you are looking for