Exporting to PNG, Spaces becomes Hyphen?

Hello!
I have this beautiful function that export layers and stuf to PNG-files. It works great exept one thing. If i spaces in the filename it will convert the spaces to hyphen!
For example. If i am working with C:\users\Clint\Clint Eastwood is so beautiful.ai. The script puts a file named Clint-Eastwood-is-so-beautiful.png in the folder C:\users\Clint.
Why oh why the Hyphens?? I dont want them
Any one have a good idea?
fullPath= app.activeDocument.fullName.parent;
docName = app.activeDocument.name.match(/^.*[^.ai]/i);
    exportFileToPNG24(fullPath + "\\" + docName + ".png");
function exportFileToPNG24 (dest) {
          if ( app.documents.length > 0 ) {
          var exportOptions = new ExportOptionsPNG24();
          var type = ExportType.PNG24;
          var fileSpec = new File(dest);
          alert(dest);
          exportOptions.antiAliasing = false;
          exportOptions.transparency = true;
          exportOptions.saveAsHTML = false;
          exportOptions.horizontalScale = 100;
          exportOptions.verticalScale = 100;
          app.activeDocument.exportFile( fileSpec, type, exportOptions );
// Mr Clint

Looks like its part of the export… Tried and it does the same here… The only option is to let it do this then rename the file afterwards… Don't know if it's a bug or indended…
Try this:
#target illustrator
exportPNG24();
function exportPNG24() {
    if ( app.documents.length == 0 ) { return; }
    app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
    var opts = new ExportOptionsPNG24();
    opts.antiAliasing = false;
    opts.transparency = true;
    opts.saveAsHTML = false;
    opts.horizontalScale = 100;
    opts.verticalScale = 100;
    var pngFile = File( app.activeDocument.fullName.toString().replace( /\.ai$/i, '.png' ) );
    app.activeDocument.exportFile( pngFile, ExportType.PNG24 ,opts );
    var autoFile = File( pngFile.fsName.replace( /\s/g,  '-' ) );
    if ( autoFile.exists ) {
        $.writeln( 'yup' );
        autoFile.rename(  pngFile.name.replace( '-', ' ' ) );

Similar Messages

  • Forced return, non-breaking hyphens & spaces, suppress hyphenation + XML

    Forced return (linefeed), non-breaking hyphens and spaces, suppress hyphenation.
    None of these are preserved when exporting from FrameMaker to XML, since they do not seem to be represented by a Unicode code point. My question to you is: How do you deal with those things in XML?
    The last issues (non-breaking and suppress hyphen) have recently been brought up in:
    http://forums.adobe.com/thread/450363
    http://forums.adobe.com/thread/459503
    Forced return is a common thing in many FrameMaker documents to improve readability of certain phrases.
    For export of FM to XML, there have been proposals to use a special element with a prefix just to capture the special FrameMaker symbol. It works, and may be a valid useful path in certain cases, but I think that it is a questionable way of dealing with it for several reasons:
    It is only relevant for roundtrip, since these special elements will hardly be interpreted by other XML tools, which of course limits the value of XML export.
    It is unwieldy, to say the least, to require the user to insert special elements for saying simple things that otherwise are just natural key strokes in the regular text flow, and which are not perceived as structural elements of information. Most users would think of these symbols/charactes as control characters, and there is no validation warning that says you may not use these characters/symbols.
    An element is used for formatting purposes only, whereas all other elements are used for content or structure.
    There is no automatic way of transforming an existing text that has these "symbols" into some special element when a document is structured with a conversion table.
    There is no automatic way of transforming a structured FM document to XML such that these special "symbols" get translated to some suitable XML construct.
    If the last point could be solved, i.e if all those control characters or markers could automatically be translated to a suitable XML representation, then I would consider the whole issue as solved, otherwise not.
    Even without FrameMaker, how do people deal with these things in "pure xml". For instance, when XML is used for publishing (which I know Arnis Gubins is doing), there will guaranteed be a need to control both hyphenation and line breaks. So how do you (they) do that?
    How do other vendors cope with these issues, e.g XPP?

    Lynne,
    As anyone can see, entity declarations have not really been in the domain of my expertise (understatement), but I might just learn bits and pieces...
    Thanks! I have now done some more reading in various pdfs, such as scructapps etc, but also the w3c xml spec, all of which I have "read" before, but reading is not always the same as understanding...
    I now have used the "entity approach" to make both discretionary hyphen and suppress hyphen work, so that it is represented in the XML export and round-trips just fine.
    Forced return still puzzles me somewhat though: I have a working solution for that using the same entity approach, but it will not work for text ranges (although it is a bit odd to have forced returns in text range elements). Moreover, I am not certain that it really is the best way. In reading other posts on this issue, I have seen that some people want forced returns to really be linefeeds in the xml output, with no other linefeeds, and conversely, when importing xml that are "formatted" in lines, such as code, they want to preserve that.
    One  way to achieve that is to use:
         reader line break is forced return;
         writer line break is 1000 characters;  (or more characters)
    Then it is completely symmetric (i.e works also if some other app has generated the xml with intentional line breaks. And this method is global for all elements, and it works for me.
    Another way to achieve this is to use the following, but it is only valid inside an element:
         preserve line breaks;
         writer line break is 1000 characters;
    Then it is also completely symmetric (in the above sense), and it works for me.
    The latter method has the drawback that it only works for text in the element; it is not inherited to its children.
    But if we look at only one element, what is the difference between the two methods?
    As far as I have been able to see, the results are identical! Why two methods? The first one seems more powerful and general(?)
    Scrutinizing the documentation though, it says that 'preserve line breaks' will add an attribute 'xml:space', but I can't see that in my output?
    Also, concerning the documentation for line break, it says that FM would ignore line breaks when exporting, but it does NOT do that (fortunately). Forced returns always result in linefeeds, no matter what.
    I would be thankful if these issues could be explained, or elaborated.
    Also, would you recommend against any of these methods?
    With my preferred method of using the global 'reader line break is forced return' instead of a local (or many local) 'preserve line breaks', there is of course the danger that when importing xml, it is absolutely necessary that the xml really only has line breaks where they are intended, and not generated every 80 characters or so!
    Is there anything that says it is "ugly" or "bad style" to honor line breaks, and generate long lines?
    Finally, why do we need to limit the number of characters written in one line these days? Why 80, why 1000, why not an unlimited number of characters!?
    Will software these days really crash if given a very long line (assuming that it doesn't exceed total ram memory of course)?
    Sorry about so many questions, but I can't find any answers to them in the docs I have read and searched.

  • Illustrator CS4 crops my artwork when exporting to png

    Illustrator CS4 crops my artwork when exporting to png (it always crops on the right side). It doesn't happen everytime but often enough to be annoying. Sometimes centering my artwork in the artboard solves the problem but not always. Do you have any idea why it's happening, and what I can do to avoid that problem?
    (See the attached png)

    @Jacob & Mylenium: I don't have any stroked path in my artwork. I've tried to add a no fill/no stroke rectangle (same size as my artwork and then a bit bigger) but it didn't work.
    Your advices gave me an idea though: I've added a filled rectangle slightly bigger than my artwork, centered it and dropped its opacity to 0%, it worked.
    I'm glad I know that trick now, because even when my artwork wasn't badly cropped, it was touching the edges of the picture (png). Then I had to open it in Photoshop and increase the canvas size in order to leave some transparent space between the artwork and the edges of the picture. Now I can do that in Illustrator
    Thanks a lot for your help !

  • Color differentiation when exporting to PNG

    Hello!
    This is just driving me crazy and I'm dying to find a solution. Whenever I export my artboards to the PNG format, I receive a slight change in the bitmap colorization.
    In Illustrator, my colors are perfect, but when exporting to PNG, the end result shows an increase in color vibrance - making a light blue (for example) show as slightly more turquoise/sharper light blue.
    Example:
    (This is a screenshot capture. Illustrator artboard is on the left hand side, the exported PNG example is on the right hand side.)
    So, my question is if I am doing something wrong with my color settings?
    My settings have been set in my Adobe Bridge to:
    Europe General Purpose 3
    RGB Space: sRGB IEC61966-2.1
    CMYK Space: Coated FOGRA39 (ISO 12647-2:2004)
    PS: I constantly switch between creating graphics that are used for the web and other on-screen web applications (such as GUI's) and printed booklets and posters, etc. I've always had immense trouble finding a perfect working space with web and printed material. If anyone has an advice for color settings or some kind of best-practice working environment to create consistent color, I would be very appreciative.
    Thank you!

    Chrome is not a color managed browser. From the several browsers I have installed on my pc only Firefox has color management capabilities that can match the color with the Adobe color managed programs.
    You have to understand that there are color and non-color managed programs. Non-color managed programs always display the colors with the color space of your monitor. Take for example a color recorded in the file say, pure red R=255, G=0, B=0. The non-color managed program will send to your video card the same number and your monitor will display the most saturated red it is physically capable of. When a color managed program reads this value, first it checks the color space of the document, which can be defined with a color profile, a soft proofing color space, or when there is no color profile with the color settings set for the working space. Then it checks the color space of your monitor which is defined in your system and translates the values from the color space of the document to the color space of your monitor which can result in a different value other than 255, 0, 0 sent to your video card. In other words color management is simulating on your monitor a color space different than your monitor's color space. The result from this is different color displayed by color managed and non-color managed programs when reading the same file.
    You can't make non-color managed programs to match a color managed programs, but you can make the color managed program match the non - color managed programs on your monitor by setting you document color space to the color space of your monitor. To do that from the Edit menu, choose Assign Profile and select the color profile of your monitor. This will match the color in Illustrator to the color displayed by the non-color managed programs. This in effect turns the color management off because the color management is translating between the same color spaces which results in zero difference.
    However have in mind that this is not a very professional way of working with color and it only ensures a color consistency between color managed and non-color managed programs on your current monitor. What color you are actually creating that others will see or the color that will print is unpredictable with this setup.

  • How to make white shapes turn transparent when exporting to .png?

    I'm trying to cut out parts of my image with white shapes, but when exporting to .png with transparent backgrounds, the white shapes remain as white shapes instead of becoming transparent and applying the cut.
    How do i fix this?
    Thanks,
    Rokas

    Use a mask, most probably an opacity mask should help.

  • Save error when exporting to PNG in Illustrator using a Macbook with Yosemite

    Anybody experience the issue of png being saved with "/" in the beginning of the file name when exporting to png in Illustrator? This only happens when I use my mac not my PC.
    Due to the save error my PC cannot identify the files and when the files are linked in Indesign they are not copied when packaging the indesign file.
    Any advice on the issue are most appreciated

    I don't have a lot of experience with this kind of problem, but the first thing I'd check is the parameter block you're passing the action call. I don't know why it would matter if the dialog appeared or not, unless the export settings block wasn't being filled in with everything it needs?
    You might try recording an export you perform manually via the action palette, and then saving it to a file. You can open it up manually and compare it (even if it's a binary block) to what you're doing in code. You might spot something that way.
    I don't know what else to suggest though. It's unlikely to be an SDK bug, though it could be a bug in the action-aware part of the exporter.

  • Save error when exporting to Png i Illustrator

    Anybody experience the issue of png being saved with "/" in the beginning of the file name when exporting to png in Illustrator. This only happens when I use my mac not my PC.
    Due to the save error my PC cannot identify the files and when the files are linked in Indesign they are not copied when packaging the indesign file.
    Any advice on the issue are most appreciated

    Hi,
    I am moving your posting to Illustrator Forum from Acrobat.com Forum.
    Thank you
    Hisami

  • The operation cannot complete because of an unkown error while exporting to png

    Adobe Illustrator CS5
    Windows 7 64bit
    I am getting the following error while trying to export a png
    "The operation cannot complete because of an unkown error. [13]"
    I tried disabling all startup items, rebooting, copying and pasting to a new document to no avail.
    Please help

    Here is what I tried and it worked
    Save the file as pdf with the "Preserve Illustrator Editing capabilities" checked.  Rename the file from .pdf to .ai
    New file can now export without any problems.
    Wierd.  But thanks to everyone who posted

  • How to copy and paste the graphics from illustrator to MS word. What I tried is exporting in png with highest resolution and then inserting in to word. This loses a bit of resolution in comparison to direct copy and paste as EMF.  But if I do a copy and p

    How to copy and paste the graphics from illustrator to MS word. What I tried is exporting in png with highest resolution and then inserting in to word. This loses a bit of resolution in comparison to direct copy and paste as EMF.  But if I do a copy and paste, and then take a print of the document, all the graphs and text is printed upside down, flipped back.

    Use the Pencil Tool
    alex
    adrian stock wrote:
    > How to copy and paste a single pixel
    >
    > I want to copy a single pixel and then paste it in the
    position of
    > another pixel in the same image.
    >
    > (This is in effect changing the colour of the target
    pixel, isn't it.
    > But in my case copying an existing pixel seems simpler
    than selecting a
    > colour from the swatch or using the colour picker.)
    >
    > What is the most efficient way of doing this?
    >
    > I tried to select one pixel with the marquee tool. Then
    copied it with
    > control-C, but then how do I select the target pixel and
    paste with
    > control-V?
    >
    > Thanks for your help.
    >
    > Adrian
    >

  • Exporting to PNG vs "Save for Web" in Illustrator CC

    I am creating small logos for a website in Illustrator CC (one is 135px x 50px), and the quality of the output has been a bit sketchy: not blurry or pixelated, but the text is messy and uneven while previewing in Acrobat as part of a larger PDF, and when previewing the logo by itself (I also previewed it in a browser with HTML to get the same unclear image).
    The images have been exported to PNG and JPG at 72 PPI.
    When I experimented with the "save for web" option (File>Save for Web), voila! It fixed the issue! I noticed in the dialogue box for "Save for Web" that it saved as a PNG-24, an option not available to export (you can only export to PNG)
    My question is: is there a difference between "save for web" and exporting that I should know about before I continue to save ALL my images via the "Save for web" option? It seems strange that the best way to save an image (PNG-24) wouldn't be an option under Export (you can only export to PNG). Why can't I export to PNG-24 in Illustrator?
    Thanks for any advice.

    You can save with different color depth, export, it chooses automatically the higher depth when you choose transparent, and the lower depth when you choose a background color.

  • Hotspots exporting as PNG doesn't work in IE

    When I export a file using hot spots, using PNG as the
    images, the don't work in Internet Explorer when I use this PNG
    Fix...
    http://homepage.ntlworld.com/bobosola/
    I'm rather frustrated because I need the PNG fix to show the
    images correctly, and PNG files in order to show the content
    correctly.
    Any info would be wonderful!!!!!!!

    jherman76 wrote:
    > When I export a file using hot spots, using PNG as the
    images, the don't work
    > in Internet Explorer when I use this PNG Fix...
    >
    http://homepage.ntlworld.com/bobosola/
    > I'm rather frustrated because I need the PNG fix to show
    the images correctly,
    > and PNG files in order to show the content correctly.
    > Any info would be wonderful!!!!!!!
    Can you export in PNG 8 or PNG 24 format? Unless your viewers
    are known
    to be using I.E. 5 or 6, I wouldn't worry about using the PNG
    fix.
    Linda Rathgeber - Adobe Community Expert
    http://www.adobe.com/communities/experts/members/8.html

  • What Happened to option to export as PNG?!!

    Hi,
    Unless I am going mad I am sure I exported a movie a while back as PNG format (under Share - Export Quicktime Movie and then choose PNG compression format).  I know the file size was unbelievably huge (30 gb for a 30 min movie), but it is the only way I have found in iMovie to export a movie with minimal quality loss.  However, I am trying to export a movie now and I can't find the PNG option - has it been removed or was it on an earlier version of iMovie?
    And if it has been removed (and I know this question has been done to death), how do you export a high quality movie from iMovie for archiving?  I have tried exporting as DV using best compression but there is still noticable blocking in the dark areas.
    Many thanks

    Yes, you can still export to PNG from iMovie, but it's buried in a LOT of submenus:
    1.  In the Share menu select Export using QuickTime...
    2.  In the Save exported movie as... window that pops up, press the OPTIONS button (near the bottom).
    3.  In the Movie Settings window that pops up, press the SETTINGS button.
    4.  This will bring up a window where you can change the compression format (usually defaulting to H.264).  In my case (Snow Leopard and iMovie '11), PNG is one of the drop-down menu options. 
    By the way, there are a LOT of cool special effects under the Filter... button in Movie Settings I'd never noticed before today (like embossing, solariation, putting "film scratches" on it). 
    I also didn't know that QuickTime allowed you to select the Key frame rate.  The default is 150, apparently, so when I had a pan-across move, it looked jumpy until I lowered it. 

  • Batch Export as PNG

    Hello, i'm having dreadful trouble exporting a batch of AIs to PNG (using illustrator CS4).
    It seemed really obvious to record export>PNG>relevant setting as an action and then run that on the whole folder.
    The trouble is that the action, when run as a batch (and only when run as a batch) skips the whole export step. it open the AI fine, runs through the action very quickly, and then fails to write the PNG.
    what's more, i also tried this on a colleagues machine and his did exactly the same, so i'm thinking that it's me missing something obvious.
    as a workaround i turned the dialogues on, but this kind of defeats the object.
    any help would be very greatly appreciated.
    cheers
    Jez

    You might try this
    ADOBE SYSTEMS INCORPORATED
    Copyright 2005 Adobe Systems Incorporated
    All Rights Reserved
    NOTICE:  Adobe permits you to use, modify, and
    distribute this file in accordance with the terms
    of the Adobe license agreement accompanying it. 
    If you have received this file from a source
    other than Adobe, then your use, modification,
    or distribution of it requires the prior
    written permission of Adobe.
    ExportDocsAsPNG24.jsx
    DESCRIPTION
    This sample gets files specified by the user from the
    selected folder and batch processes them and saves them
    as PDFs in the user desired destination with the same
    file name.
    // Main Code [Execution of script begins here]
    // uncomment to suppress Illustrator warning dialogs
    // app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
    var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pngExportOpts;
    // Select the source folder.
    sourceFolder = Folder.selectDialog( 'Select the folder with Illustrator files you want to convert to PNG', '~' );
    // If a valid folder is selected
    if ( sourceFolder != null )
        files = new Array();
        fileType = prompt( 'Select type of Illustrator files to you want to process. Eg: *.ai', ' ' );
        // 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 converted PNG files.', '~' );
            for ( i = 0; i < files.length; i++ )
                sourceDoc = app.open(files[i]); // returns the document object
                // Call function getNewName to get the name and file to save the pdf
                targetFile = getNewName();
                // Call function getPNGOptions get the PNGExportOptions for the files
                pngExportOpts = getPNGOptions();
                // Export as PNG
                sourceDoc.exportFile( targetFile, ExportType.PNG24, pngExportOpts );
                sourceDoc.close(SaveOptions.DONOTSAVECHANGES);
            alert( 'Files are saved as PNG in ' + destFolder );
        else
            alert( 'No matching files found' );
    getNewName: Function to get the new file name. The primary
    name is the same as the source file.
    function getNewName()
        var ext, docName, newName, saveInFile, docName;
        docName = sourceDoc.name;
        ext = '.png'; // new extension for png file
        newName = "";
        for ( var i = 0 ; docName[i] != "." ; i++ )
            newName += docName[i];
        newName += ext; // full png name of the file
        // Create a file object to save the png
        saveInFile = new File( destFolder + '/' + newName );
        return saveInFile;
    getPNGOptions: Function to set the PNG saving options of the
    files using the PDFSaveOptions object.
    function getPNGOptions()
        // Create the PDFSaveOptions object to set the PDF options
        var pngExportOpts = new ExportOptionsPNG24();
        // Setting PNGExportOptions properties. Please see the JavaScript Reference
        // for a description of these properties.
        // Add more properties here if you like
        pngExportOpts.antiAliasing = true;
        pngExportOpts.artBoardClipping = false;
        //pngExportOpts.horizontalScale = 100.0;
        //pngExportOpts.matte = true;
        //pngExportOpts.matteColor = 0, 0, 0;
        pngExportOpts.saveAsHTML = false;
        pngExportOpts.transparency = true;
        //pngExportOpts.verticalScale = 100.0;
        return pngExportOpts;
    Copy into a text editor and save as a .jsx file and place in the presets>scripts folder.

  • Exporting to PNG from Adobe Illustrator cutting off edges

    I created a 40px x 40px image in Adobe Illustrator CS4. I saved as an .ai file and then tried to export as a PNG.
    Adobe Illustrator automatically crops the background and tightens the export to a rect around all the objects which if fine. In this case, I am not working edge to edge so my image is not quite 40px wide.
    But, unfortunately, Illustrator is not exporting the entire image. I end up with an image that is 34px wide. Indeed, the icon I draw starts on the left hand side but the right edge of my object cut off.
    Any ideas why this is happening? I can't imagine Illustrator CS4 can't correctly to export to PNG.

    Can't necessarily explain the reason for the cutoff without knowing more, but you might be able to  solve it by adding a 40 x 40 square with no fill or stroke and including it in the export.

  • Illustrator crashes when trying to export to png

    My issue is pretty straightforward, I cannot export to PNG unless I trash the Illustrator preferences (located in: user/Library/Preferences/Adobe Illustrator CS6 Settings/en_US/) BEFORE I start Illustrator. As soon as I close Illustrator, I must delete those preferences again the next time I start up the program or I won't be able to export a file.
    - I recently upgraded to Mountain Lion, but I was having the same issues in Lion
    - I have uninstalled the whole CS6 Creative Suite and reinstalled (literally deleting every single Adobe file in the Library folder) still the same issue
    - It seems to only be PNG files that I can't export to. If I try and make it a JPG it will export (I do commonly need to export with transparency so JPGs won't work for many things I need to export)
    I can't think of anything else to do. Thoughts?

    VACUBOMB wrote:
    I've been having this exact same problem with CS5 on Mountain Lion. Anything that rasterizes the artwork causes it to hang. Export (PNG), Save for Web, Filters like Drop Shadow or Gaussian Blur (even when just checking the preview box).
    If I delete the preferences it works fine for one run of the app, then it happens again.
    Temporary Fix (kinda lame)
    1. Edit the contents of the Preferences File in a text editor and remove everything (0 bytes, blank file).
    2. Open the Info box and lock the file.
    Your preferences will stop saving, and the issue will go away, but now non of your preferences will save, you'll be reset every time you open the app.
    I will continue to diagnose and see if I can narrow down the area of the config that is breaking things.
    I would love a solution for this.
    Message was edited by: VACUBOMB
    This solution is for CS5, do you have a solution for CS6?

Maybe you are looking for

  • Time Machine Backup not continuing

    When i was using my laptop, i had a time machine backup in progress. I wanted to shut down my macbook and go to sleep, so i safely ejected my hard drive that time machine was backing up to; after reading several articles from this community, i learne

  • IPhone stolen. Bought new iPhone but problem with iMessage

    So, someone stole my iPhone 4 a couple of months ago and I got a new iPhone 4S with a new simcard. I synced it with my old iTunes account but the problem is, even after entering my new phone number in phone settings, when activating iMessage it still

  • 500 internal server error when trying to create users

    I am getting a 500 internal server error when trying to create users. What is the cause? We tried reinstalling the latest java jdk release and that didn't help.

  • To install oracle 9i on Suse 10

    Hi, I want to install oracle 9i on Suse 10. Can i install? Do i need download any patches?(What are patches?) I dont have cd's also. So what should i do? Regards, Chaitra

  • Regarding Select without Where clause

    Hi we have below code for F4HELP on invoice input field. you can see Select statement used without Where condition to fetch records from Ztable. and deleting the duplicating records. SCI error says,"Large table : it has no where condition. /No field