Export a QT file to give to an AVID editor. What codec?

I have searched the forums but have really not found the answer I am looking for. I have an XDCAM HD sequence and want to export a file to upload to my FTP site so an AVID editor can use it. What should I export it as? A friend of mine said I could download an AVID codec and export it using that. I have no idea how to download the proper codec from AVID if that is the workflow I should use. Any help will be appreciated.
Best,
Tom

Go to AVID.COM and download the Avid LE codecs. Then convert your XDCAM export (that any machine without FCP will NOT be able to see) to Avid DNxHD 145.
Google search got me this:
http://avid.custkb.com/avid/app/selfservice/search.jsp?DocId=263545
"Avid Codecs LE download"
-shane

Similar Messages

  • After upgrading to Mavericks, all of my contacts disappeared. Did a "contacts archive" export and the file is 17mbs. Looks like there's data, but none of it at all displays. What gives? 20" iMac, early '09

    After upgrading to Mavericks, all of my contacts disappeared. Did a "contacts archive" export and the file is 17mbs. Looks like there's data, but none of it at all displays. What gives? 20" iMac, early '09

    After upgrading to Mavericks, all of my contacts disappeared. Did a "contacts archive" export and the file is 17mbs. Looks like there's data, but none of it at all displays. What gives? 20" iMac, early '09

  • PBDOM : Exporting to XML file gives a single line

    I've been starting developing with PowerBuilder 12.5 a few weeks ago. I had to write some XML files, so I got familiar with the PBDOM library.
    I can build a lot of different things, it's very nice, but one thing still bothers me :
    In the output file, the whole XML is written on a single line.
    I use the SaveDocument function.
    For example, here is some code :
    PBDOM_Document doc
    PBDOM_Element noderoot, node1, node11, node12
    doc = CREATE PBDOM_Document
    doc.NewDocument("NodeRoot")
    noderoot = doc.GetRootElement()
    node1 = CREATE PBDOM_Element
    node1.SetName("Node1")
    noderoot.AddContent(node1)
    node1.SetAttribute("Attr", "AttrValue")
    node11 = CREATE PBDOM_Element
    node11.SetName("Node11")
    node11.AddContent("Here is a value")
    node1.AddContent(node11)
    node12 = CREATE PBDOM_ELEMENT
    node12.SetName("Node12")
    node12.AddContent("Here is another value")
    node1.AddContent(node12)
    doc.SaveDocument("myDoc.xml")
    Here is the result when I open it with notepad++
    <NodeRoot><Node1 Attr="AttrValue"><Node11>Here is a value</Node11><Node12>Here is another value</Node12></Node1></NodeRoot>
    Whereas I wanted :
    <NodeRoot> <Node1 Attr="AttrValue"> <Node11>Here is a value</Node11> <Node12>Here is another value</Node12> </Node1> </NodeRoot>
    With the notepad++ XML tools plugin, I can use the "pretty print" function to get this nice representation. But I would like my file to be formatted this way from the beginning. I noticed that the "line ending" was set to UNIX format (indicator on bottom right of the window), but I'm working on Windows. When I use the menu to convert it to Windows format (CR+LF), it changes this indicator, but the code stays on one single line.
    Is there a way to tell PBDOM to export the XML file with a nice output ?
    Thank you !
    Notes :
    - Opening the XML file with Internet Explorer or Google Chrome gives me a nice vizualisation, with indentation, line breaks...
    - Adding a <?xml version="1.0" encoding="ISO-8859-1" ?> does not help (I've been doing it while exporting some more complex files, but I still get the output on one line...)

    Here is a very simple powerbuilder example. It uses MSXML instead of PBDOM. See my comments for hints how to use it with PBDOM.
    oleobject lole_dom, lole_root, lole_element1, lole_element11, lole_element12
    oleobject lole_Writer, lole_saxreader
    string ls_result
    // build DOM (you don't need this if you use PBDOM)
    lole_dom = create oleobject
    lole_dom.ConnectToNewObject ("Msxml2.DOMDocument")
    lole_root = lole_dom.CreateElement ("NodeRoot")
    lole_dom.documentElement = lole_root
    lole_element1 = lole_dom.CreateElement("Node1")
    lole_root.AppendChild(lole_element1)
    lole_element1.SetAttribute("Attr", "AttrValue")
    lole_element11 = lole_dom.CreateElement("Node11")
    lole_element11.AppendChild (lole_dom.CreateTextNode("Here is a value"))
    lole_element1.AppendChild(lole_element11)
    lole_element12 = lole_dom.CreateElement("Node12")
    lole_element12.AppendChild (lole_dom.CreateTextNode("Here is another value"))
    lole_element1.AppendChild(lole_element12)
    // this saves the DOM without formatting
    //lole_dom.save ("d:\testxml.xml")
    // this part is for formating
    lole_Writer = create oleobject
    lole_saxreader = create oleobject
    lole_Writer.ConnectToNewObject ("MSXML2.MXXMLWriter")
    lole_saxreader.ConnectToNewObject ("MSXML2.SAXXMLReader")
    lole_Writer.omitXMLDeclaration = True
    lole_Writer.indent = True
    lole_saxreader.contentHandler = lole_Writer
    // instead of DOM you can also put a XML string to parser: lole_saxreader.parse ("<node>...</node>")
    // so you can also use the PBDOM output directly
    lole_saxreader.parse (lole_dom)
    // here is your formatted output
    ls_Result = lole_Writer.output
    MessageBox ("", ls_result)
    lole_writer.Disconnectobject( )
    lole_saxreader.Disconnectobject( )
    lole_dom.Disconnectobject( )
    DESTROY lole_writer
    DESTROY lole_saxreader
    DESTROY lole_dom

  • Export in Quick Time Pro gives Error -43: a file could not be found

    Have been successfully exporting videos mades on my camera via Quick Time Pro for many months to convert for Apple TV. However in the last week the same routine process now causes an error on export. Error -43: a file could not be found.
    I have tried uninstalling and re-installing QT Pro and no difference, have also tried different export formats and they all give the same error.
    Any ideas would be appreciated, thanks
    [email protected]

    http://discussions.apple.com/thread.jspa?threadID=769732
    This is a old post from when I had recieved the Error-43 file could not be found. In my case I had a drive lettered F:\ F:\ when changing the drive to a single letter F:\ it resolved the problem, so something you might want to take a look at.

  • Apex 3.1.2.00.02 creates invalid export file (that gives ORA-20001 error)

    Hi
    I want to let you know, that sometimes APEX 3.1.2.00.0 creates invalid export file.
    Older apex 3.0 created correct file.
    For example: our application has page button, where "Optional URL Redirect" is:
    Page: &APP_PAGE_ID.
    Request: FLOW_XMLP_OUTPUT_R11531800061044170_et
    If we export application into file f110.sql and try to import it to the same workspace on the same server, we get error:
    {color:#0000ff}ORA-20001: GET_BLOCK Error. ORA-20001: Execution of the statement was unsuccessful. ORA-06550: line 28, column 111: PLS-00103: Encountered the symbol "_" when expecting one of the following: ) , * &amp; | = - + &lt; / &gt; at in is mod remainder not rem =&gt; .. &lt;an exponent (**)&gt; &lt;&gt; or != or ~= &gt;= &lt;= &lt;&gt; and or like LIKE2_ LIKE4_ LIKEC_ as between from using || multiset member SUBMULTISET_ The symbol &a
    {color}In exported f110.sql file the invalid section is:
    {color:#0000ff}wwv_flow_api.create_page_branch(
    p_id=&gt;11762805016890347 + wwv_flow_api.g_id_offset,
    p_flow_id=&gt; wwv_flow.g_flow_id,
    p_flow_step_id=&gt; 4,
    p_branch_action=&gt; 'f?p=&APP_ID.:&APP_PAGE_ID.:&SESSION.:FLOW_XMLP_OUTPUT_R'||to_char({color}{color:#0000ff}{color:#ff0000}*10255206661122183_et*{color}+wwv_flow_api.g_id_offset)||':&DEBUG.:::',
    p_branch_point=&gt; 'AFTER_PROCESSING',
    p_branch_type=&gt; 'REDIRECT_URL',
    p_branch_when_button_id=&gt;11761415275883875+ wwv_flow_api.g_id_offset,
    p_branch_sequence=&gt; 10,
    p_branch_comment=&gt; 'Created 20-JUUNI-2008 12:05 by XXXX');{color}
    If we exported the same application in apex 3.0, this section was correct:
    {color:#0000ff}wwv_flow_api.create_page_branch(
    p_id=&gt;11762805016890347 + wwv_flow_api.g_id_offset,
    p_flow_id=&gt; wwv_flow.g_flow_id,
    p_flow_step_id=&gt; 4,
    p_branch_action=&gt; 'f?p=&APP_ID.:&APP_PAGE_ID.:&SESSION.:FLOW_XMLP_OUTPUT_R*10255206661122183_et*:&DEBUG.:::',
    p_branch_point=&gt; 'AFTER_PROCESSING',
    p_branch_type=&gt; 'REDIRECT_URL',
    p_branch_when_button_id=&gt;11761415275883875+ wwv_flow_api.g_id_offset,
    p_branch_sequence=&gt; 10,
    p_branch_comment=&gt; 'Created 20-JUUNI-2008 12:05 by XXXX');{color}
    Best Regards,
    T&otilde;nu

    Thanks for pointing that out. We'll fix it. It does appear though, that in 3.0, the offset would not be added to the number part of the request value, so if you installed the application as a different application ID or into a different workspace, the request would have failed.
    Scott

  • Can't export an EPS file from Photoshop CS5 and open in Illustrator CS5.

    I'm on Mac OS X Lion 10.7.5
    I am making DVD covers for print. The barcodes for the DVD covers have to be done in Illustrator. But the original designs are done in photoshop including the text. For years this hasn't been a problem. Right before adding the barcodes I create an EPS file from photoshop, open that file in Illustrator and all my text is automatically coverted to perfect crisp clean vectors, viola! I add the barcodes and export the PDF for the printers.
    But now I can't open my EPS files in Illustrator CS5 even though I'm exporting them the same way I always have from Photoshop CS5. Illustrator says... "The operation cannot complete because of an unknown error." --> Note it does not give an error number after this warning like I see it does for so many other people.
    I have been trying to fix this for over 10 HOURS spanning 2 days! I'm infuriated I can't get help from Adobe on this and have read all the forums and don't see my problem listed anywhere.
    I've tried:
    - Deleting the .plist file and the Settings folder & resetting my permissions
    - Uninstalling and Reinstalling Illustrator
    - Turning off all other applications
    - Creating more disk space on my hard drive (even though I have 200gb available)
    - Restarting the computer
    - Disabling my Font book and still I can't open the EPS file
    I thought maybe it's possible it's the font I'm using Fontesque OT so I even tried converting text to objects prior to exporting the EPS file from photoshop to illustrator and turning off my font book, but still it won't open. And if I open the PSD directly in Illustrator, text comes out a bit fuzzy in the PDF I export.
    If anyone can provide any solutions I would be so grateful! I'm at my wits end here, this should have taken under an hour to do and now it's ruining my entire weekend. I'm completely panicked because I was suppose to have these to my client over the weekend so they could turn them in for Print frist thing on Monday morning and of course Adobe provides no chat support or phone support after 7pm on weekday or on the weekend which is when this all started.

    I never even thought of reinstalling photoshop, but I think this was a font issue. I'd never saved an EPS with Fontesque OT Regular enabled, only Fontesque OT Bold. Somehow I think the font was causing the problem because ridding the font from the equation allowed me to open the EPS file.
    After 12 HOURS of trying different things I found a WORK AROUND...
    I had to:
    - Select the Text in Photoshop (with Fontesque OT enabled)  --> Select Create Work Path --> Covert to Shape on each of the text items
    - Save EPS file out of Photoshop
    - Disable Fontesque OT font in Font Book
    - Then open EPS in Illustrator add in my Barcodes and export the PDF
    (the barcodes have to be added in Illustrator because they need to be pure 100% black with no CMYK color in them. You can't save them out of Photoshop that way, only Illustrator, otherwise I would have made my pdf straight out of photoshop like any other normal human
    This work around is the only way I could get the EPS files to open in Illustrator and still have the text remain super crisp like a vector.
    NOTE to others in the future about crisp text from Photoshop to Illustrator:
    - Simply "converting to shape" did not preserve the vector. You have to Select Create Work Path --> then Covert to Shape on each of the text items (with the font enabled) for this to work and preserve the crispness of the text. Even creating "smart object" did not truly preserve my vectors or the text crispness in the EPS file once I imported it into Illustrator.
    DrStrik9 thank you SO MUCH for trying to help me. You did give me ideas that helped me figure out the workaround and also helped me feel not so alone as I struggled through this. I'm going to follow up with your other suggestions about reinstalling photoshop and also checking my RAM, etc. But I just want to that you so so so SOOOO much for all your time and consideration in this matter. I hope you have a wonderful amazing week ahead and that someone does something very nice and thoughtful for you too

  • Best practice for exporting a .mov file for YouTube

    I am using FCPX 10.0.9 with a MacBook Pro. We are needing to upload relatively small-size high school football videos as .mov files to YouTube for my newspaper. I have been choosing the Export File option with the setting set to h.264, exporting the file to the desktop and then uploading that .mov file to YouTube. (I do not have Compressor installed on this Mac.) The other night the first of three files done like this uploaded fine, but the next two just kept processing and processing at YouTube and never finished. The following morning the files processed fine. Any thoughts about why ths might be happening?
    And would it be better to export in another file format --.mp4 files -- instead that might cause less of a problem and which of the export options would be best?
    Thanks,
    Douglas

    douglas i wrote:
    Am I correctly uploading a .mov file to YouTube by using the Export File command with the export setting set to .h264 then if I wish a reasonable size file for upload?
    Sure. There are many ways to get videos to YT and yours is a reasonable approach.
    "Reasonable size" should be thought of in terms of upload time. Again, YT will re-compress whatever you give it. So depending on how quickly you need to get it up on the Web, it's better to upload files that have more information than less information. (To that end, some folks upload very large Pro Res files; they also have a lot of patience.) 
    Just to let you know, the majority of FCPX users follow one of two workflows:
    1) Share>You Tube option and have FCP handle the uploading;
    2) Export as a Pro Res Master File; bring the master file into Compressor and apply the user's custom settings; upload using YT's uploader.
    FWIW, I prefer the second workflow.
    Russ

  • Exporting an .ai file to a bitmap file

    In Illustrator Scripting (VBscripting), how can you export an ai file to a bitmap file?
    In Illustrator you can open an ai file and by selecting the Export option you have a choice of formats and one of them is BMP.  How can this be done in scripting?  I did look at the AIExportType, but BMP is not in the list.
    aiJPEG = 1
    aiPhotoshop = 2
    aiSVG = 3
    aiPNG8 = 4
    aiPNG24 = 5
    aiGIF = 6
    aiFlash = 7
    aiAutoCAD = 8
    I will also need to do this same method by Exporting to an eps file.
    The task is the following:
    When a client uploads an image file, we need to automatically export the file to bmp and to esp, thus having 3 files (original upload, bmp, and esp).  The file types that we are exporting, so far, will be ai, esp, and pdf (more to follow I am sure).
    We also need to get information about each file.
    Is it vector or a bitmap?
    Color:  RGB, CMYK, or Pantone?
    Is there text or curves or both?
    What is the DPI resolution?
    What is the image size?
    Any help would be beneficial.
    Thanks,
    Tom

    Larry,
    On a different issue...
    If you have a groupitem (contains a textframe and a rectangle object), I can
    loop thru the group item, but it seems that it gives a type back as group
    item for each item in the group.  But it should give back TextFrame and a
    rectangle.  Any ideas?
    Tom

  • Import from dsv files and export to csv files

    hi every body..
    how can I create a project in NetBeans which does:
    1- import a .dsv (Delimiter-Separated Values) file content and save it to array
    - the values in this format separated by fixed commas
    example
    "AIG" "Insurance" "64.91" "25/11/06"
    2- export into .csv file (Comma Separated Value)
    -the values in this format separated by commas
    example:
    AIG,Insurance,64.91,25/11/06

    Well, you need to learn Java so you can read files, divide the data by the delimiters, and then write it out as a csv file.
    Can't really give better instructions than that...maybe start by reading the basic tutorials?
    We don't give out full program code here so you'll need to ask more precise questions. Such as what is it that you're having problems with.

  • PSE11 Export of RAW files not sharp

    I am using PS Elements 11 with raw converter 7.3, processing .DNG files from a Samsung GX-10 on a PC.
    I notice that, despite sharpening the image in the raw converter, that the preview (F11) in the organiser is not sharp. This is somewhat annoying.
    However, even more annoying is the fact that the blurriness continues if I export the DNG from the organiser to a new JPEG, even if I set the quality at Maximum (12). The export and preview seem to be ignoring the sharpness I have set in the raw converter.
    If I open the .DNG in the editor and then save the file as a JPEG straight away, all my sharpening remains intact, and the final JPEG is fine.
    I have tried using setting the 'process' in the raw converter to '2010', and also tried setting the JPEG preview size to 'Full Size' in the RAW converter save options. Neither of these seems to make any difference.
    For my normal workflow I edit the .DNG files using the raw converter, using the PSE editor only when necessary. I then use the organiser to export the .DNG files to JPEGs for printing, emailing or whatever. This workflow does not give me the results I expect any more.
    It looks like I am going to have to open every processed RAW image in the editor and then save the files as JPEGs individually. Also the organiser preview does not give me an accurate preview of the quality of the processed file.
    Has anyone else observed this, or have any suggestions for a cure or a revised workflow?
    Bill.

    Jon,
    Thanks for the response and the tips, but I am happy with the sharpening I am applying in camera raw itself, but the problem occurs when I click the 'Done' button to save the results to the organiser, and then subsequently export to a jpeg.
    For an example, this is how an oversharpened test shot appears on the screen in ACR 7.3 at 100% zoom with sharpening set to 150 (via print screen)...
    Click Done and then export from the organiser (max quality) and this is the blurry result that appears:
    This is also the sort of view I get in the organiser preview (F11) even at 100%.
    If instead of clicking Done in ACR, I click Open Image and then save the image as a JPEG, this is what I get:
    This latter image is what I would be expecting. (Of course I wouldn't normally sharpen my images like that!) In fact the exported raw images are much softer than the JPEGs that come straight out of the camera.
    Maybe I am doing something wrong, and I am quite happy to be corrected, but I have been sharpening my images with ACR in PSE10 quite happily for a year or more. Its only since PSE11 and ACR 7.3 that I have noticed this issue.
    Regards,
    Bill

  • Is a 2 minute exported avchd mov file supposed to be 1 gb?

    Is a 2 minute exported avchd mov file supposed to be as large as 1gb? There aren't even any edits or changes done to the original video! What am I doing wrong?
    I'm using Quicktime Conversion; Compression H.264. How do you get these files into the low double digits (i.e. 40 mb) for the web?
    Any help would be terrific

    Import your video into Compressor, open Apple Devices and choose HD for Apple Devices (5Mbps) if it is HD or SD for Apple Devices if it is standard def.
    The HD setting will give files of around 40MB per minute and the SD will give around 15MB per minute.
    You don't want anything less or the quality will begin to suffer.

  • Modding the Export Layers to Files script to preserve .jpg quality

    Please forgive me if I am posting this incorrectly, but as the thread I initially replied to is marked as Answered I started to wonder whether my question would be seen or not so I started this new thread.  My original question is located in the thread http://forums.adobe.com/message/2795719#2795719 because Kari was having a similar issue to mine, but with a different file format.  My original text:
    I am having a similar issue, except that I need to save each layer as a .jpg, and the Export Layers to Files script is compressing the images in some fashion so that a previously seamlessly tiling layer now has a border that ruins the tile.  If I save each layer individually using either the Save As command or Save for Web and Devices with the proper settings (Maximum Quality, Progressive, and Baseline Standard), the resulting images don't acquire this border, so I feel pretty certain it is something in the script that is messing up (changing the compression of) the layers, but I honestly don't know what.  I have tried modifiying the jpeg portion of the script this way, hoping to prevent it from deviating from the usual Save As options:
            case jpegIndex:
                docRef.bitsPerChannel = BitsPerChannelType.EIGHT;
                var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".jpg");
                jpgSaveOptions = new JPEGSaveOptions();
                jpgSaveOptions.embedColorProfile = true;
                jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
                jpgSaveOptions.matte = MatteType.NONE;
                jpgSaveOptions.quality = jpegQuality; // 12
                docRef.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);
                break;
    but this doesn't seem to affect whatever setting is being changed.  Layers saved to .jpg this way still acquire the border.  I don't see what line might control whether the image is saved as progressive or not, nor anything to affect the text setting "Maximum" that I use when I successfully save each layer individually.
    I am a complete novice at scripting, so please excuse/explain the obvious mistakes I may be making here.
    I have since installed the script listener plug in and isolated a bit of script for saving the intended way, and hope to insert this snippet into the Export Layers as Files script, but I can tell that some of the lines are extraneous (like where it points to the file path I took), but I don't know what is safe to trim out.  I sincerely appreciate any assistance with this!

    Here is the script that uses scriptlistner to do the jpeg save. Note I changed the name by adding '_mod' to the end to remind you that it has been edited. You can remove the origianl version by moving the file to another folder outside the scripts folder or by adding ~ at the start of the filename.
    I recommend saving this as Export Layers to Files_mod.jsx. If this doesn't work for you we can try using the scriptlistener saveForWeb.
    // Copyright 2007.  Adobe Systems, Incorporated.  All rights reserved.
    // This script will export each layer in the document to a separate file.
    // Written by Naoki Hada
    // ZStrings and auto layout by Tom Ruark
    @@@BUILDINFO@@@ Export Layers To Files.jsx 1.0.0.16
    // BEGIN__HARVEST_EXCEPTION_ZSTRING
    <javascriptresource>
    <name>Export Layers to Files_mod...</name>
    <category>layers</category>
    <enableinfo>true</enableinfo>
    <eventid>6f1c2cf5-4a97-4e32-8f59-f5d7a087adef</eventid>
    <terminology><![CDATA[<< /Version 1
                             /Events <<
                              /6f1c2cf5-4a97-4e32-8f59-f5d7a087adef [Export Layers to Files_mod /noDirectParam <<
                               /message [($$$/Actions/Key/Message=Message) /char]
                               /destination [($$$/Actions/Key/Destination=Destination) /char]
                               /fileNamePrefix [($$$/Actions/Key/FileNamePrefix=Prefix) /char]
                               /visibleOnly [($$$/Actions/Key/CompsObject/UseVisibility=Visibility) /boolean]
                               /fileType  [($$$/Actions/Key/FileType=File Type) /integer]
                               /icc [($$$/Actions/Key/PDFGenericFormat/KeepProfile=Keep Profile) /boolean]
                               /jpegQuality [($$$/Actions/Key/JPEGQuality=JPEG Quality) /char]
                               /psdMaxComp [($$$/Actions/Key/MaximizePSDCompatibility=maximize compatibility for Photoshop files) /boolean]
                               /tiffCompression [($$$/Actions/Key/TiffCompression=TIFF encoding) /char]
                               /tiffJpegQuality [($$$/Actions/Key/TIFFJPEGQuality=TIFF JPEG Quality) /char]
                               /pdfEncoding [($$$/Actions/Key/PDFEncoding=PDF encoding) /char]
                               /pdfJpegQuality [($$$/Actions/Key/PDFJPEGQuality=PDF JPEG Quality) /char]
                               /targaDepth [($$$/Actions/Key/Depth/TargaDepth=Targa depth) /char]
                               /bmpDepth [($$$/Actions/Key/Depth/BMPDepth=BMP depth) /char]
                               /png24Transparency [($$$/Actions/Key/Layer/PNG24PreserveTransparency=PNG 24 Preserve Transparency) /boolean]
                               /png24Interlaced [($$$/Actions/Key/Layer/PNG24Interlaced=PNG 24 Interlaced) /boolean]
                               /png24Trim [($$$/Image/Trim/PNG24=PNG 24 Trim) /boolean]
                               /png8Transparency [($$$/Actions/Key/Layer/PNG8PreserveTransparency=PNG 8 Preserve Transparency) /boolean]
                               /png8Interlaced [($$$/Actions/Key/Layer/PNG8Interlaced=PNG 8 Interlaced) /boolean]
                               /png8Trim [($$$/Image/Trim/PNG8=PNG 8 Trim) /boolean]
                              >>]
                             >>
                          >> ]]></terminology>
    </javascriptresource>
    // END__HARVEST_EXCEPTION_ZSTRING
    // enable double clicking from the Macintosh Finder or the Windows Explorer
    #target photoshop
    // debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
    // $.level = 0;
    // debugger; // launch debugger on next line
    // on localized builds we pull the $$$/Strings from a .dat file, see documentation for more details
    $.localize = true;
    //=================================================================
    // Globals
    //=================================================================
    // UI strings to be localized
    //var strTitle = localize("$$$/JavaScripts/ExportLayersToFiles/Title=Export Layers To Files");
    strTitle = "Export Layers To Files"
    var strButtonRun = localize("$$$/JavaScripts/ExportLayersToFiles/Run=Run");
    var strButtonCancel = localize("$$$/JavaScripts/ExportLayersToFiles/Cancel=Cancel");
    var strHelpText = localize("$$$/JavaScripts/ExportLayersToFiles/Help=Please specify the format and location for saving each layer as a file.");
    var strLabelDestination = localize("$$$/JavaScripts/ExportLayersToFiles/Destination=Destination:");
    var strButtonBrowse = localize("$$$/JavaScripts/ExportLayersToFiles/Browse=&Browse...");
    var strLabelFileNamePrefix = localize("$$$/JavaScripts/ExportLayersToFiles/FileNamePrefix=File Name Prefix:");
    var strCheckboxVisibleOnly = localize("$$$/JavaScripts/ExportLayersToFiles/VisibleOnly=&Visible Layers Only");
    var strLabelFileType = localize("$$$/JavaScripts/ExportLayersToFiles/FileType=File Type:");
    var strCheckboxIncludeICCProfile = localize("$$$/JavaScripts/ExportLayersToFiles/IncludeICC=&Include ICC Profile");
    var strJPEGOptions = localize("$$$/JavaScripts/ExportLayersToFiles/JPEGOptions=JPEG Options:");
    var strLabelQuality = localize("$$$/JavaScripts/ExportLayersToFiles/Quality=Quality:");
    var strPSDOptions = localize("$$$/JavaScripts/ExportLayersToFiles/PSDOptions=PSD Options:");
    var strCheckboxMaximizeCompatibility = localize("$$$/JavaScripts/ExportLayersToFiles/Maximize=&Maximize Compatibility");
    var strTIFFOptions = localize("$$$/JavaScripts/ExportLayersToFiles/TIFFOptions=TIFF Options:");
    var strLabelImageCompression = localize("$$$/JavaScripts/ExportLayersToFiles/ImageCompression=Image Compression:");
    var strNone = localize("$$$/JavaScripts/ExportLayersToFiles/None=None");
    var strPDFOptions = localize("$$$/JavaScripts/ExportLayersToFiles/PDFOptions=PDF Options:");
    var strLabelEncoding = localize("$$$/JavaScripts/ExportLayersToFiles/Encoding=Encoding:");
    var strTargaOptions = localize("$$$/JavaScripts/ExportLayersToFiles/TargaOptions=Targa Options:");
    var strLabelDepth = localize("$$$/JavaScripts/ExportLayersToFiles/Depth=Depth:");
    var strRadiobutton16bit = localize("$$$/JavaScripts/ExportLayersToFiles/Bit16=16bit");
    var strRadiobutton24bit = localize("$$$/JavaScripts/ExportLayersToFiles/Bit24=24bit");
    var strRadiobutton32bit = localize("$$$/JavaScripts/ExportLayersToFiles/Bit32=32bit");
    var strBMPOptions = localize("$$$/JavaScripts/ExportLayersToFiles/BMPOptions=BMP Options:");
    var strAlertSpecifyDestination = localize("$$$/JavaScripts/ExportLayersToFiles/SpecifyDestination=Please specify destination.");
    var strAlertDestinationNotExist = localize("$$$/JavaScripts/ExportLayersToFiles/DestionationDoesNotExist=Destination does not exist.");
    var strTitleSelectDestination = localize("$$$/JavaScripts/ExportLayersToFiles/SelectDestination=Select Destination");
    var strAlertDocumentMustBeOpened = localize("$$$/JavaScripts/ExportLayersToFiles/OneDocument=You must have a document open to export!");
    var strAlertNeedMultipleLayers = localize("$$$/JavaScripts/ExportLayersToFiles/NoLayers=You need a document with multiple layers to export!");
    var strAlertWasSuccessful = localize("$$$/JavaScripts/ExportLayersToFiles/Success= was successful.");
    var strUnexpectedError = localize("$$$/JavaScripts/ExportLayersToFiles/Unexpected=Unexpected error");
    var strMessage = localize("$$$/JavaScripts/ExportLayersToFiles/Message=Export Layers To Files action settings");
    var     stretQuality = localize( "$$$/locale_specific/JavaScripts/ExportLayersToFiles/ETQualityLength=30" );
    var     stretDestination = localize( "$$$/locale_specific/JavaScripts/ExportLayersToFiles/ETDestinationLength=160" );
    var     strddFileType = localize( "$$$/locale_specific/JavaScripts/ExportLayersToFiles/DDFileType=100" );
    var     strpnlOptions = localize( "$$$/locale_specific/JavaScripts/ExportLayersToFiles/PNLOptions=100" );
    var strPNG8Options = localize("$$$/JavaScripts/ExportLayersToFiles/PNG8Options=PNG-8 Options:");
    var strCheckboxPNGTransparency = localize("$$$/JavaScripts/ExportLayersToFiles/Transparency=Transparency");
    var strCheckboxPNGInterlaced = localize("$$$/JavaScripts/ExportLayersToFiles/Interlaced=Interlaced");
    var strCheckboxPNGTrm = localize("$$$/JavaScripts/ExportLayersToFiles/Trim=Trim Layers");
    var strPNG24Options = localize("$$$/JavaScripts/ExportLayersToFiles/PNG24Options=PNG-24 Options:");
    // the drop down list indexes for file type
    var bmpIndex = 0;
    var jpegIndex = 1;
    var pdfIndex = 2;
    var psdIndex = 3;
    var targaIndex = 4;
    var tiffIndex = 5;
    var png8Index = 6;
    var png24Index = 7;
    // the drop down list indexes for tiff compression
    var compNoneIndex = 0;
    var compLZWIndex = 1;
    var compZIPIndex = 2;
    var compJPEGIndex = 3;
    // ok and cancel button
    var runButtonID = 1;
    var cancelButtonID = 2;
    // Dispatch
    main();
    // Functions
    // Function: main
    // Usage: the core routine for this script
    // Input: <none>
    // Return: <none>
    function main() {
        if ( app.documents.length <= 0 ) {
            if ( DialogModes.NO != app.playbackDisplayDialogs ) {
                alert( strAlertDocumentMustBeOpened );
             return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
        var exportInfo = new Object();
        initExportInfo(exportInfo);
         // look for last used params via Photoshop registry, getCustomOptions will throw if none exist
         try {
              var d = app.getCustomOptions("4d633fbb-ed90-480d-8e03-cccb16131a34");
              descriptorToObject(exportInfo, d, strMessage, postProcessExportInfo);
         catch(e) {
              // it's ok if we don't have any options, continue with defaults
         // see if I am getting descriptor parameters
        descriptorToObject(exportInfo, app.playbackParameters, strMessage, postProcessExportInfo);
        if ( DialogModes.ALL == app.playbackDisplayDialogs ) {
             if (cancelButtonID == settingDialog(exportInfo)) {
                  return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
        try {
            var docName = app.activeDocument.name;  // save the app.activeDocument name before duplicate.
            var layerCount = app.documents[docName].layers.length;
            var layerSetsCount = app.documents[docName].layerSets.length;
            if ((layerCount <= 1)&&(layerSetsCount <= 0)) {
                if ( DialogModes.NO != app.playbackDisplayDialogs ) {
                    alert( strAlertNeedMultipleLayers );
                  return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
            } else {
                var rememberMaximize;
                var needMaximize = exportInfo.psdMaxComp ? QueryStateType.ALWAYS : QueryStateType.NEVER;
                if ( exportInfo.fileType == psdIndex && app.preferences.maximizeCompatibility != needMaximize ) {
                    rememberMaximize = app.preferences.maximizeCompatibility;
                    app.preferences.maximizeCompatibility = needMaximize;
                app.activeDocument = app.documents[docName];
                var duppedDocument = app.activeDocument.duplicate();
                duppedDocument.activeLayer = duppedDocument.layers[duppedDocument.layers.length-1]; // for removing
                setInvisibleAllArtLayers(duppedDocument);
                exportChildren(duppedDocument, app.documents[docName], exportInfo, duppedDocument, exportInfo.fileNamePrefix);
                duppedDocument.close( SaveOptions.DONOTSAVECHANGES );
                   var d = objectToDescriptor(exportInfo, strMessage, preProcessExportInfo);
                app.putCustomOptions("4d633fbb-ed90-480d-8e03-cccb16131a34", d);
                   var dd = objectToDescriptor(exportInfo, strMessage, preProcessExportInfo);
                app.playbackParameters = dd;
                if ( rememberMaximize != undefined ) {
                    app.preferences.maximizeCompatibility = rememberMaximize;
                if ( DialogModes.ALL == app.playbackDisplayDialogs ) {
                    alert(strTitle + strAlertWasSuccessful);
                app.playbackDisplayDialogs = DialogModes.ALL;
        } catch (e) {
            if ( DialogModes.NO != app.playbackDisplayDialogs ) {
                alert(e);
             return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
    // Function: settingDialog
    // Usage: pop the ui and get user settings
    // Input: exportInfo object containing our parameters
    // Return: on ok, the dialog info is set to the exportInfo object
    function settingDialog(exportInfo) {
        dlgMain = new Window("dialog", strTitle);
        // match our dialog background color to the host application
         var brush = dlgMain.graphics.newBrush (dlgMain.graphics.BrushType.THEME_COLOR, "appDialogBackground");
        dlgMain.graphics.backgroundColor = brush;
        dlgMain.graphics.disabledBackgroundColor = dlgMain.graphics.backgroundColor;
         dlgMain.orientation = 'column';
         dlgMain.alignChildren = 'left';
         // -- top of the dialog, first line
        dlgMain.add("statictext", undefined, strLabelDestination);
         // -- two groups, one for left and one for right ok, cancel
         dlgMain.grpTop = dlgMain.add("group");
         dlgMain.grpTop.orientation = 'row';
         dlgMain.grpTop.alignChildren = 'top';
         dlgMain.grpTop.alignment = 'fill';
         // -- group top left
         dlgMain.grpTopLeft = dlgMain.grpTop.add("group");
         dlgMain.grpTopLeft.orientation = 'column';
         dlgMain.grpTopLeft.alignChildren = 'left';
         dlgMain.grpTopLeft.alignment = 'fill';
         // -- the second line in the dialog
         dlgMain.grpSecondLine = dlgMain.grpTopLeft.add("group");
         dlgMain.grpSecondLine.orientation = 'row';
         dlgMain.grpSecondLine.alignChildren = 'center';
        dlgMain.etDestination = dlgMain.grpSecondLine.add("edittext", undefined, exportInfo.destination.toString());
        dlgMain.etDestination.preferredSize.width = StrToIntWithDefault( stretDestination, 160 );
        dlgMain.btnBrowse = dlgMain.grpSecondLine.add("button", undefined, strButtonBrowse);
        dlgMain.btnBrowse.onClick = function() {
              var defaultFolder = dlgMain.etDestination.text;
              var testFolder = new Folder(dlgMain.etDestination.text);
              if (!testFolder.exists) {
                   defaultFolder = "~";
              var selFolder = Folder.selectDialog(strTitleSelectDestination, defaultFolder);
              if ( selFolder != null ) {
                 dlgMain.etDestination.text = selFolder.fsName;
              dlgMain.defaultElement.active = true;
         // -- the third line in the dialog
        dlgMain.grpTopLeft.add("statictext", undefined, strLabelFileNamePrefix);
         // -- the fourth line in the dialog
        dlgMain.etFileNamePrefix = dlgMain.grpTopLeft.add("edittext", undefined, exportInfo.fileNamePrefix.toString());
        dlgMain.etFileNamePrefix.alignment = 'fill';
        dlgMain.etFileNamePrefix.preferredSize.width = StrToIntWithDefault( stretDestination, 160 );
         // -- the fifth line in the dialog
        dlgMain.cbVisible = dlgMain.grpTopLeft.add("checkbox", undefined, strCheckboxVisibleOnly);
        dlgMain.cbVisible.value = exportInfo.visibleOnly;
         // -- the sixth line is the panel
        dlgMain.pnlFileType = dlgMain.grpTopLeft.add("panel", undefined, strLabelFileType);
         dlgMain.pnlFileType.alignment = 'fill';
        // -- now a dropdown list
        dlgMain.ddFileType = dlgMain.pnlFileType.add("dropdownlist");
        dlgMain.ddFileType.preferredSize.width = StrToIntWithDefault( strddFileType, 100 );
        dlgMain.ddFileType.alignment = 'left';
        dlgMain.ddFileType.add("item", "BMP");
        dlgMain.ddFileType.add("item", "JPEG");
        dlgMain.ddFileType.add("item", "PDF");
         dlgMain.ddFileType.add("item", "PSD");
        dlgMain.ddFileType.add("item", "Targa");
        dlgMain.ddFileType.add("item", "TIFF");
        dlgMain.ddFileType.add("item", "PNG-8");
        dlgMain.ddFileType.add("item", "PNG-24");
         dlgMain.ddFileType.onChange = function() {
              hideAllFileTypePanel();
            dlgMain.cbIcc.show();
              switch(this.selection.index) {
                   case bmpIndex:     
                        dlgMain.pnlFileType.pnlOptions.text = strBMPOptions;
                        dlgMain.pnlFileType.pnlOptions.grpBMPOptions.show();     
                        break;
                   case jpegIndex:     
                        dlgMain.pnlFileType.pnlOptions.text = strJPEGOptions;
                        dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.show();
                     dlgMain.cbIcc.hide();
                        break;
                   case tiffIndex:     
                        dlgMain.pnlFileType.pnlOptions.text = strTIFFOptions;
                        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.show();     
                        break;
                   case pdfIndex:     
                        dlgMain.pnlFileType.pnlOptions.text = strPDFOptions;
                        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.show();     
                        break;
                   case targaIndex:
                        dlgMain.pnlFileType.pnlOptions.text = strTargaOptions;
                        dlgMain.pnlFileType.pnlOptions.grpTargaOptions.show();     
                        break;
                   case png8Index:          
                        dlgMain.pnlFileType.pnlOptions.text = strPNG8Options;
                        dlgMain.pnlFileType.pnlOptions.grpPNG8Options.show();     
                        break;
                   case png24Index:          
                        dlgMain.pnlFileType.pnlOptions.text = strPNG24Options;
                        dlgMain.pnlFileType.pnlOptions.grpPNG24Options.show();     
                        break;
                   case psdIndex:     
                   default:          
                        dlgMain.pnlFileType.pnlOptions.text = strPSDOptions;
                        dlgMain.pnlFileType.pnlOptions.grpPSDOptions.show();     
                        break;
        dlgMain.ddFileType.items[exportInfo.fileType].selected = true;
         // -- now after all the radio buttons
        dlgMain.cbIcc = dlgMain.pnlFileType.add("checkbox", undefined, strCheckboxIncludeICCProfile);
        dlgMain.cbIcc.value = exportInfo.icc;
        dlgMain.cbIcc.alignment = 'left';
         // -- now the options panel that changes
        dlgMain.pnlFileType.pnlOptions = dlgMain.pnlFileType.add("panel", undefined, "Options");
        dlgMain.pnlFileType.pnlOptions.alignment = 'fill';
        dlgMain.pnlFileType.pnlOptions.orientation = 'stack';
        dlgMain.pnlFileType.pnlOptions.preferredSize.height = StrToIntWithDefault( strpnlOptions, 100 );
         // PSD options
        dlgMain.pnlFileType.pnlOptions.grpPSDOptions = dlgMain.pnlFileType.pnlOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpPSDOptions.cbMax = dlgMain.pnlFileType.pnlOptions.grpPSDOptions.add("checkbox", undefined, strCheckboxMaximizeCompatibility);
        dlgMain.pnlFileType.pnlOptions.grpPSDOptions.cbMax.value = exportInfo.psdMaxComp;
        dlgMain.pnlFileType.pnlOptions.grpPSDOptions.visible = (exportInfo.fileType == psdIndex);
         // PNG8 options
        dlgMain.pnlFileType.pnlOptions.grpPNG8Options = dlgMain.pnlFileType.pnlOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trans = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add("checkbox", undefined, strCheckboxPNGTransparency.toString());
        dlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Inter = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add("checkbox", undefined, strCheckboxPNGInterlaced.toString());
        dlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trm = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add("checkbox", undefined, strCheckboxPNGTrm.toString());
        dlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trans.value = exportInfo.png8Transparency;
        dlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Inter.value = exportInfo.png8Interlaced;
        dlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trm.value = exportInfo.png8Trim;
        dlgMain.pnlFileType.pnlOptions.grpPNG8Options.visible = (exportInfo.fileType == png8Index);
        // PNG24 options
        dlgMain.pnlFileType.pnlOptions.grpPNG24Options = dlgMain.pnlFileType.pnlOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add("checkbox", undefined, strCheckboxPNGTransparency.toString());
        dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add("checkbox", undefined, strCheckboxPNGInterlaced.toString());
        dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trm = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add("checkbox", undefined, strCheckboxPNGTrm.toString());
        dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans.value = exportInfo.png24Transparency;
        dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter.value = exportInfo.png24Interlaced;
        dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trm.value = exportInfo.png24Trim;
        dlgMain.pnlFileType.pnlOptions.grpPNG24Options.visible = (exportInfo.fileType == png24Index);
         // JPEG options
        dlgMain.pnlFileType.pnlOptions.grpJPEGOptions = dlgMain.pnlFileType.pnlOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.add("statictext", undefined, strLabelQuality);
        dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality = dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.add("edittext", undefined, exportInfo.jpegQuality.toString());
        dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality.preferredSize.width = StrToIntWithDefault( stretQuality, 30 );
        dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.visible = (exportInfo.fileType == jpegIndex);
         // TIFF options
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions = dlgMain.pnlFileType.pnlOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.orientation = 'column';
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.visible = (exportInfo.fileType == tiffIndex);
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.alignment = 'left';
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.add("statictext", undefined, strLabelImageCompression);
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.add("dropdownlist");
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.add("item", strNone);
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.add("item", "LZW");
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.add("item", "ZIP");
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.add("item", "JPEG");
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.onChange = function() {
              if (this.selection.index == compJPEGIndex) {
                   dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.stQuality.enabled = true;
                   dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality.enabled = true;
              } else {
                   dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.stQuality.enabled = false;
                   dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality.enabled = false;
         dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.alignment = 'left';
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.stQuality = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.add("statictext", undefined, strLabelQuality);
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.add("edittext", undefined, exportInfo.tiffJpegQuality.toString());
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality.preferredSize.width = StrToIntWithDefault( stretQuality, 30 );
         dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality.graphics.disabledBackgroundColor = brush;
         var index;
        switch (exportInfo.tiffCompression) {
              case TIFFEncoding.NONE:     index = compNoneIndex; break;
            case TIFFEncoding.TIFFLZW:  index = compLZWIndex; break;
            case TIFFEncoding.TIFFZIP:  index = compZIPIndex; break;
            case TIFFEncoding.JPEG:     index = compJPEGIndex; break;
            default: index = compNoneIndex;    break;
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.items[index].selected = true;
         if (TIFFEncoding.JPEG != exportInfo.tiffCompression) { // if not JPEG
              dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.stQuality.enabled = false;
              dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality.enabled = false;
         // PDF options
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions = dlgMain.pnlFileType.pnlOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.orientation = 'column';
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.visible = (exportInfo.fileType == pdfIndex);
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.alignment = 'left';
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.add("statictext", undefined, strLabelEncoding);
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbZip = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.add("radiobutton", undefined, "ZIP");
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbZip.onClick = function() {
              dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.stQuality.enabled = false;  
              dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality.enabled = false;  
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbJpeg = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.add("radiobutton", undefined, "JPEG");
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbJpeg.onClick = function() {
              dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.stQuality.enabled = true;  
              dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality.enabled = true;  
         dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.alignment = 'left';
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.stQuality = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.add("statictext", undefined, strLabelQuality);
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.add("edittext", undefined, exportInfo.pdfJpegQuality.toString());
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality.preferredSize.width = StrToIntWithDefault( stretQuality, 30 );
         dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality.graphics.disabledBackgroundColor = brush;
        switch (exportInfo.pdfEncoding) {
            case PDFEncoding.PDFZIP:
                   dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbZip.value  = true;    break;
            case PDFEncoding.JPEG:
            default:
                   dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbJpeg.value = true;    break;
        if (PDFEncoding.JPEG != exportInfo.pdfEncoding) {
            dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.stQuality.enabled = false;
            dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality.enabled = false;
         // Targa options
         dlgMain.pnlFileType.pnlOptions.grpTargaOptions = dlgMain.pnlFileType.pnlOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpTargaOptions.add("statictext", undefined, strLabelDepth);
        dlgMain.pnlFileType.pnlOptions.grpTargaOptions.visible = (exportInfo.fileType == targaIndex);
        dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb16bit = dlgMain.pnlFileType.pnlOptions.grpTargaOptions.add( "radiobutton", undefined, strRadiobutton16bit);
        dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb24bit = dlgMain.pnlFileType.pnlOptions.grpTargaOptions.add( "radiobutton", undefined, strRadiobutton24bit);
        dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb32bit = dlgMain.pnlFileType.pnlOptions.grpTargaOptions.add( "radiobutton", undefined, strRadiobutton32bit);
        switch (exportInfo.targaDepth) {
            case TargaBitsPerPixels.SIXTEEN:     dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb16bit.value = true;   break;
            case TargaBitsPerPixels.TWENTYFOUR:  dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb24bit.value = true;   break;
            case TargaBitsPerPixels.THIRTYTWO:   dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb32bit.value = true;   break;
            default: dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb24bit.value = true;   break;
         // BMP options
        dlgMain.pnlFileType.pnlOptions.grpBMPOptions = dlgMain.pnlFileType.pnlOptions.add("group");
        dlgMain.pnlFileType.pnlOptions.grpBMPOptions.add("statictext", undefined, strLabelDepth);
        dlgMain.pnlFileType.pnlOptions.grpBMPOptions.visible = (exportInfo.fileType == bmpIndex);
        dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb16bit = dlgMain.pnlFileType.pnlOptions.grpBMPOptions.add( "radiobutton", undefined, strRadiobutton16bit);
        dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb24bit = dlgMain.pnlFileType.pnlOptions.grpBMPOptions.add( "radiobutton", undefined, strRadiobutton24bit);
        dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb32bit = dlgMain.pnlFileType.pnlOptions.grpBMPOptions.add( "radiobutton", undefined, strRadiobutton32bit);
        switch (exportInfo.bmpDepth) {
            case BMPDepthType.SIXTEEN:   dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb16bit.value = true;   break;
            case BMPDepthType.TWENTYFOUR:dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb24bit.value = true;   break;
            case BMPDepthType.THIRTYTWO: dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb32bit.value = true;   break;
            default: dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb24bit.value = true;   break;
         // the right side of the dialog, the ok and cancel buttons
         dlgMain.grpTopRight = dlgMain.grpTop.add("group");
         dlgMain.grpTopRight.orientation = 'column';
         dlgMain.grpTopRight.alignChildren = 'fill';
         dlgMain.btnRun = dlgMain.grpTopRight.add("button", undefined, strButtonRun );
        dlgMain.btnRun.onClick = function() {
              // check if the setting is properly
              var destination = dlgMain.etDestination.text;
              if (destination.length == 0) {
                 alert(strAlertSpecifyDestination);
                   return;
              var testFolder = new Folder(destination);
              if (!testFolder.exists) {
                 alert(strAlertDestinationNotExist);
                   return;
              dlgMain.close(runButtonID);
         dlgMain.btnCancel = dlgMain.grpTopRight.add("button", undefined, strButtonCancel );
        dlgMain.btnCancel.onClick = function() {
              dlgMain.close(cancelButtonID);
         dlgMain.defaultElement = dlgMain.btnRun;
         dlgMain.cancelElement = dlgMain.btnCancel;
            // the bottom of the dialog
         dlgMain.grpBottom = dlgMain.add("group");
         dlgMain.grpBottom.orientation = 'column';
         dlgMain.grpBottom.alignChildren = 'left';
         dlgMain.grpBottom.alignment = 'fill';
        dlgMain.pnlHelp = dlgMain.grpBottom.add("panel");
        dlgMain.pnlHelp.alignment = 'fill';
        dlgMain.etHelp = dlgMain.pnlHelp.add("statictext", undefined, strHelpText, {multiline:true});
        dlgMain.etHelp.alignment = 'fill';
         dlgMain.onShow = function() {
              dlgMain.ddFileType.onChange();
        // give the hosting app the focus before showing the dialog
        app.bringToFront();
        dlgMain.center();
        var result = dlgMain.show();
        if (cancelButtonID == result) {
              return result;  // close to quit
        // get setting from dialog
        exportInfo.destination = dlgMain.etDestination.text;
        exportInfo.fileNamePrefix = dlgMain.etFileNamePrefix.text;
        exportInfo.visibleOnly = dlgMain.cbVisible.value;
        exportInfo.fileType = dlgMain.ddFileType.selection.index;
        exportInfo.icc = dlgMain.cbIcc.value;
        exportInfo.jpegQuality = dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality.text;
        exportInfo.psdMaxComp = dlgMain.pnlFileType.pnlOptions.grpPSDOptions.cbMax.value;
        index = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.selection.index;
        if (index == compNoneIndex) {
              exportInfo.tiffCompression = TIFFEncoding.NONE;
        if (index == compLZWIndex) {
              exportInfo.tiffCompression = TIFFEncoding.TIFFLZW;
        if (index == compZIPIndex) {
              exportInfo.tiffCompression = TIFFEncoding.TIFFZIP;
        if (index == compJPEGIndex) {
              exportInfo.tiffCompression = TIFFEncoding.JPEG;
        exportInfo.tiffJpegQuality = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality.text;
        if (dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbZip.value) {
              exportInfo.pdfEncoding = PDFEncoding.PDFZIP;
        if (dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbJpeg.value) {
              exportInfo.pdfEncoding = PDFEncoding.JPEG;
        exportInfo.pdfJpegQuality = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality.text;
        if (dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb16bit.value) {
              exportInfo.targaDepth = TargaBitsPerPixels.SIXTEEN;
        if (dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb24bit.value) {
              exportInfo.targaDepth = TargaBitsPerPixels.TWENTYFOUR;
        if (dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb32bit.value) {
              exportInfo.targaDepth = TargaBitsPerPixels.THIRTYTWO;
        if (dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb16bit.value) {
              exportInfo.bmpDepth = BMPDepthType.SIXTEEN;
        if (dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb24bit.value) {
              exportInfo.bmpDepth = BMPDepthType.TWENTYFOUR;
        if (dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb32bit.value) {
              exportInfo.bmpDepth = BMPDepthType.THIRTYTWO;
        return result;
    // Function: hideAllFileTypePanel
    // Usage: hide all the panels in the common actions
    // Input: <none>, dlgMain is a global for this script
    // Return: <none>, all panels are now hidden
    function hideAllFileTypePanel() {
        dlgMain.pnlFileType.pnlOptions.grpPSDOptions.hide();
        dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.hide();
        dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.hide();
        dlgMain.pnlFileType.pnlOptions.grpPDFOptions.hide();
        dlgMain.pnlFileType.pnlOptions.grpTargaOptions.hide();
        dlgMain.pnlFileType.pnlOptions.grpBMPOptions.hide();
        dlgMain.pnlFileType.pnlOptions.grpPNG8Options.hide();
        dlgMain.pnlFileType.pnlOptions.grpPNG24Options.hide();
    // Function: initExportInfo
    // Usage: create our default parameters
    // Input: a new Object
    // Return: a new object with params set to default
    function initExportInfo(exportInfo) {
        exportInfo.destination = new String("");
        exportInfo.fileNamePrefix = new String("untitled_");
        exportInfo.visibleOnly = false;
        exportInfo.fileType = psdIndex;
        exportInfo.icc = true;
        exportInfo.jpegQuality = 8;
        exportInfo.psdMaxComp = true;
        exportInfo.tiffCompression = TIFFEncoding.NONE;
        exportInfo.tiffJpegQuality = 8;
        exportInfo.pdfEncoding = PDFEncoding.JPEG;
        exportInfo.pdfJpegQuality = 8;
        exportInfo.targaDepth = TargaBitsPerPixels.TWENTYFOUR;
        exportInfo.bmpDepth = BMPDepthType.TWENTYFOUR;
        exportInfo.png24Transparency = true;
        exportInfo.png24Interlaced = false;
        exportInfo.png24Trim = true;
        exportInfo.png8Transparency = true;
        exportInfo.png8Interlaced = false;
        exportInfo.png8Trim = true;
        try {
            exportInfo.destination = Folder(app.activeDocument.fullName.parent).fsName; // destination folder
            var tmp = app.activeDocument.fullName.name;
            exportInfo.fileNamePrefix = decodeURI(tmp.substring(0, tmp.indexOf("."))); // filename body part
        } catch(someError) {
            exportInfo.destination = new String("");
            exportInfo.fileNamePrefix = app.activeDocument.name; // filename body part
    // Function: saveFile
    // Usage: the worker routine, take our params and save the file accordingly
    // Input: reference to the document, the name of the output file,
    //        export info object containing more information
    // Return: <none>, a file on disk
    function saveFile( docRef, fileNameBody, exportInfo) {
        switch (exportInfo.fileType) {
            case jpegIndex:
                 docRef.bitsPerChannel = BitsPerChannelType.EIGHT;
                /*var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".jpg");
                    jpgSaveOptions = new JPEGSaveOptions();
                    jpgSaveOptions.embedColorProfile = exportInfo.icc;
                    jpgSaveOptions.quality = exportInfo.jpegQuality;
                    docRef.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);*/
                var desc= new ActionDescriptor();
                var formatDesc = new ActionDescriptor();
                formatDesc.putInteger( charIDToTypeID( "EQlt" ), exportInfo.jpegQuality );
                formatDesc.putEnumerated( charIDToTypeID( "MttC" ), charIDToTypeID( "MttC" ), charIDToTypeID( "None" ) );
                desc.putObject( charIDToTypeID( "As  " ), charIDToTypeID( "JPEG" ), formatDesc );
                desc.putPath( charIDToTypeID( "In  " ), saveFile );
                desc.putBoolean( charIDToTypeID( "Cpy " ), true );
                executeAction( charIDToTypeID( "save" ), desc4, DialogModes.NO );
                break;
            case psdIndex:
                var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".psd");
                psdSaveOptions = new PhotoshopSaveOptions();
                psdSaveOptions.embedColorProfile = exportInfo.icc;
                psdSaveOptions.maximizeCompatibility = exportInfo.psdMaxComp;
                docRef.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE);
                break;
            case tiffIndex:
                var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".tif");
                tiffSaveOptions = new TiffSaveOptions();
                tiffSaveOptions.embedColorProfile = exportInfo.icc;
                tiffSaveOptions.imageCompression = exportInfo.tiffCompression;
                if (TIFFEncoding.JPEG == exportInfo.tiffCompression) {
                        tiffSaveOptions.jpegQuality = exportInfo.tiffJpegQuality;
                docRef.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);
                break;
            case pdfIndex:
                  if (docRef.bitsPerChannel == BitsPerChannelType.THIRTYTWO)
                        docRef.bitsPerChannel = BitsPerChannelType.SIXTEEN;
                var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".pdf");
                pdfSaveOptions = new PDFSaveOptions();
                pdfSaveOptions.embedColorProfile = exportInfo.icc;
                pdfSaveOptions.encoding = exportInfo.pdfEncoding;
                if (PDFEncoding.JPEG == exportInfo.pdfEncoding) {
                        pdfSaveOptions.jpegQuality = exportInfo.pdfJpegQuality;
                docRef.saveAs(saveFile, pdfSaveOptions, true, Extension.LOWERCASE);
                break;
            case targaIndex:
                  docRef.bitsPerChannel = BitsPerChannelType.EIGHT;
                var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".tga");
                targaSaveOptions = new TargaSaveOptions();
                targaSaveOptions.resolution = exportInfo.targaDepth;
                docRef.saveAs(saveFile, targaSaveOptions, true, Extension.LOWERCASE);
                break;
            case bmpIndex:
                  docRef.bitsPerChannel = BitsPerChannelType.EIGHT;
                var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".bmp");
                bmpSaveOptions = new BMPSaveOptions();
                bmpSaveOptions.depth = exportInfo.bmpDepth;
                docRef.saveAs(saveFile, bmpSaveOptions, true, Extension.LOWERCASE);
                break;
            case png8Index:
                   saveFile(docRef, fileNameBody, exportInfo, dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter.value, dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans.value);
                 function saveFile( docRef, fileNameBody, exportInfo, interlacedValue, transparencyValue) {
                        var id5 = charIDToTypeID( "Expr" );
                             var desc3 = new ActionDescriptor();
                             var id6 = charIDToTypeID( "Usng" );
                                  var desc4 = new ActionDescriptor();
                                  var id7 = charIDToTypeID( "Op  " );
                                  var id8 = charIDToTypeID( "SWOp" );
                                  var id9 = charIDToTypeID( "OpSa" );
                                  desc4.putEnumerated( id7, id8, id9 );
                                  var id10 = charIDToTypeID( "Fmt " );
                                  var id11 = charIDToTypeID( "IRFm" );
                                  var id12 = charIDToTypeID( "PNG8" );
                                  desc4.putEnumerated( id10, id11, id12 );
                                  var id13 = charIDToTypeID( "Intr" ); //Interlaced
                                  desc4.putBoolean( id13, interlacedValue );
                                  var id14 = charIDToTypeID( "RedA" );
                                  var id15 = charIDToTypeID( "IRRd" );
                                  var id16 = charIDToTypeID( "Prcp" ); //Algorithm
                                  desc4.putEnumerated( id14, id15, id16 );
                                  var id17 = charIDToTypeID( "RChT" );
                                  desc4.putBoolean( id17, false );
                                  var id18 = charIDToTypeID( "RChV" );
                                  desc4.putBoolean( id18, false );
                                  var id19 = charIDToTypeID( "AuRd" );
                                  desc4.putBoolean( id19, false );
                                  var id20 = charIDToTypeID( "NCol" ); //NO. Of Colors
                                  desc4.putInteger( id20, 256 );
                                  var id21 = charIDToTypeID( "Dthr" ); //Dither
                                  var id22 = charIDToTypeID( "IRDt" );
                                  var id23 = charIDToTypeID( "Dfsn" ); //Dither type
                                  desc4.putEnumerated( id21, id22, id23 );
                                  var id24 = charIDToTypeID( "DthA" );
                                  desc4.putInteger( id24, 100 );
                                  var id25 = charIDToTypeID( "DChS" );
                                  desc4.putInteger( id25, 0 );
                                  var id26 = charIDToTypeID( "DCUI" );
                                  desc4.putInteger( id26, 0 );
                                  var id27 = charIDToTypeID( "DChT" );
                                  desc4.putBoolean( id27, false );
                                  var id28 = charIDToTypeID( "DChV" );
                                  desc4.putBoolean( id28, false );
                                  var id29 = charIDToTypeID( "WebS" );
                                  desc4.putInteger( id29, 0 );
                                  var id30 = charIDToTypeID( "TDth" ); //transparency dither
                                  var id31 = charIDToTypeID( "IRDt" );
                                  var id32 = charIDToTypeID( "None" );
                                  desc4.putEnumerated( id30, id31, id32 );
                                  var id33 = charIDToTypeID( "TDtA" );
                                  desc4.putInteger( id33, 100 );
                                  var id34 = charIDToTypeID( "Trns" ); //Transparency
                                  desc4.putBoolean( id34, transparencyValue );
                                  var id35 = charIDToTypeID( "Mtt " );
                                  desc4.putBoolean( id35, true );           //matte
                                  var id36 = charIDToTypeID( "MttR" ); //matte color
                                  desc4.putInteger( id36, 255 );
                                  var id37 = charIDToTypeID( "MttG" );
                                  desc4.putInteger( id37, 255 );
                                  var id38 = charIDToTypeID( "MttB" );
                                  desc4.putInteger( id38, 255 );
                                  var id39 = charIDToTypeID( "SHTM" );
                                  desc4.putBoolean( id39, false );
                                  var id40 = charIDToTypeID( "SImg" );
                                  desc4.putBoolean( id40, true );
                                  var id41 = charIDToTypeID( "SSSO" );
                                  desc4.putBoolean( id41, false );
                                  var id42 = charIDToTypeID( "SSLt" );
                                       var list1 = new ActionList();
                                  desc4.putList( id42, list1 );
                                  var id43 = charIDToTypeID( "DIDr" );
                                  desc4.putBoolean( id43, false );
                                  var id44 = charIDToTypeID( "In  " );
                                  desc4.putPath( id44, new File( exportInfo.destination + "/" + fileNameBody + ".png") );
                             var id45 = stringIDToTypeID( "SaveForWeb" );
                             desc3.putObject( id6, id45, desc4 );
                        executeAction( id5, desc3, DialogModes.NO );
                //var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".png");
                //bmpSaveOptions = new BMPSaveOptions();
                //bmpSaveOptions.depth = exportInfo.bmpDepth;
                //docRef.saveAs(saveFile, bmpSaveOptions, true, Extension.LOWERCASE);
                break;
            case png24Index:
                 saveFile(docRef, fileNameBody, exportInfo, dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter.value, dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans.value);
                 function saveFile( docRef, fileNameBody, exportInfo, interlacedValue, transparencyValue) {
                   var id6 = charIDToTypeID( "Expr" );
                        var desc3 = new ActionDescriptor();
                        var id7 = charIDToTypeID( "Usng" );
                             var desc4 = new ActionDescriptor();
                             var id8 = charIDToTypeID( "Op  " );
                             var id9 = charIDToTypeID( "SWOp" );
                             var id10 = charIDToTypeID( "OpSa" );
                           desc4.putEnumerated( id8, id9, id10 );
                             var id11 = charIDToTypeID( "Fmt " );
                             var id12 = charIDToTypeID( "IRFm" );
                             var id13 = charIDToTypeID( "PN24" );
                             desc4.putEnumerated( id11, id12, id13 );
                             var id14 = charIDToTypeID( "Intr" );
                             desc4.putBoolean( id14, interlacedValue );
                             var id15 = charIDToTypeID( "Trns" );
                             desc4.putBoolean( id15, transparencyValue );
                             var id16 = charIDToTypeID( "Mtt " );
                             desc4.putBoolean( id16, true );
                             var id17 = charIDToTypeID( "MttR" );
                             desc4.putInteger( id17, 255 );
                             var id18 = charIDToTypeID( "MttG" );
                             desc4.putInteger( id18, 255 );
                             var id19 = charIDToTypeID( "MttB" );
                             desc4.putInteger( id19, 255 );
                             var id20 = charIDToTypeID( "SHTM" );
                             desc4.putBoolean( id20, false );
                             var id21 = charIDToTypeID( "SImg" );
                             desc4.putBoolean( id21, true );
                             var id22 = charIDToTypeID( "SSSO" );
                             desc4.putBoolean( id22, false );
                             var id23 = charIDToTypeID( "SSLt" );
                                  var list1 = new ActionList();
                             desc4.putList( id23, list1 );
                             var id24 = charIDToTypeID( "DIDr" );
                             desc4.putBoolean( id24, false );
                             var id25 = charIDToTypeID( "In  " );
                             desc4.putPath( id25, new File( exportInfo.destination + "/" + fileNameBody + ".png") );
                        var id26 = stringIDToTypeID( "SaveForWeb" );
                        desc3.putObject( id7, id26, desc4 );
                   executeAction( id6, desc3, DialogModes.NO );
                //var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".png");
                //bmpSaveOptions = new BMPSaveOptions();
                //bmpSaveOptions.depth = exportInfo.bmpDepth;
                //docRef.saveAs(saveFile, bmpSaveOptions, true, Extension.LOWERCASE);
                break;
            default:
                if ( DialogModes.NO != app.playbackDisplayDialogs ) {
                    alert(strUnexpectedError);
                break;
    // Function: zeroSuppress
    // Usage: return a string padded to digit(s)
    // Input: num to convert, digit count needed
    // Return: string padded to digit length
    function zeroSuppress (num, digit) {
        var tmp = num.toString();
        while (tmp.length < digit) {
              tmp = "0" + tmp;
        return tmp;
    // Function: setInvisibleAllArtLayers
    // Usage: unlock and make invisible all art layers, recursively
    // Input: document or layerset
    // Return: all art layers are unlocked and invisible
    function setInvisibleAllArtLayers(obj) {
        for( var i = 0; i < obj.artLayers.length; i++) {
            obj.artLayers[i].allLocked = false;
            obj.artLayers[i].visible = false;
        for( var i = 0; i < obj.layerSets.length; i++) {
            setInvisibleAllArtLayers(obj.layerSets[i]);
    // Function: removeAllInvisibleArtLayers
    // Usage: remove all the invisible art layers, recursively
    // Input: document or layer set
    // Return: <none>, all layers that were invisible are now gone
    function removeAllInvisibleArtLayers(obj) {
        for( var i = obj.artLayers.length-1; 0 <= i; i--) {
            try {
                if(!obj.artLayers[i].visible) {
                        obj.artLayers[i].remove();
            catch (e) {
        for( var i = obj.layerSets.length-1; 0 <= i; i--) {
            removeAllInvisibleArtLayers(obj.layerSets[i]);
    // Function: removeAllEmptyLayerSets
    // Usage: find all empty layer sets and remove them, recursively
    // Input: document or layer set
    // Return: empty layer sets are now gone
    function removeAllEmptyLayerSets(obj) {
        var foundEmpty = true;
        for( var i = obj.layerSets.length-1; 0 <= i; i--) {
            if( removeAllEmptyLayerSets(obj.layerSets[i])) {
                obj.layerSets[i].remove();
            } else {
                foundEmpty = false;
        if (obj.artLayers.length > 0) {
              foundEmpty = false;
        return foundEmpty;
    // Function: zeroSuppress
    // Usage: return a string padded to digit(s)
    // Input: num to convert, digit count needed
    // Return: string padded to digit length
    function removeAllInvisible(docRef) {
        removeAllInvisibleArtLayers(docRef);
        removeAllEmptyLayerSets(docRef);
    // Function: exportChildren
    // Usage: find all the children in this document to save
    // Input: duplicate document, original document, export info,
    //        reference to document, starting file name
    // Return: <none>, documents are saved accordingly
    function exportChildren(dupObj, orgObj, exportInfo, dupDocRef, fileNamePrefix) {
        for( var i = 0; i < dupObj.artLayers.length; i++) {
            if (exportInfo.visibleOnly) { // visible layer only
                if (!orgObj.artLayers[i].visible) {
                        continue;
            dupObj.artLayers[i].visible = true;
            var layerName = dupObj.artLayers[i].name;  // store layer name before change doc
            var duppedDocumentTmp = dupDocRef.duplicate();
            if ((psdIndex == exportInfo.fileType)||(png24Index == exportInfo.fileType)||(png8Index == exportInfo.fileType)) { // PSD: Keep transparency
                removeAllInvisible(duppedDocumentTmp);
                //PNGFileOptions
                    if ((png24Index == exportInfo.fileType)||(png8Index == exportInfo.fileType)) { // PNGFileOptions
                        if ((dlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trm.value == true)&&(png8Index == exportInfo.fileType)) { //transparancy checked?
                             if (activeDocument.activeLayer.isBackgroundLayer == false) { //is it anything but a background layer?
                                  app.activeDocument.trim(TrimType.TRANSPARENT);
                        if ((dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trm.value == true)&&(png24Index == exportInfo.fileType)) { //transparancy checked?
                             if (activeDocument.activeLayer.isBackgroundLayer == false) { //is it anything but a background layer?
                                  app.activeDocument.trim(TrimType.TRANSPARENT);
            } else { // just flatten
                duppedDocumentTmp.flatten();
            var fileNameBody = fileNamePrefix;
            fileNameBody += "_" + zeroSuppress(i, 4);
            fileNameBody += "_" + la

  • Performance of Export Layers to Files

    Hi!
    I know of an Export Layers to Files script that comes with Adobe Photoshop CS4 that exports the layers of a Photoshop document as image files. It exports layer by layer with the aid of a loop. It first sets all layers as invisible, except the first layer to be exported. The process continues, by setting the layer in question as visible, keeping others invisible. It works so well for an image composed by some tens of layers, but the processing time increases greatly as the number of layers increases.
    I am developing a similar script solution, but less complex. First, the image files will be .png files. Second, much probably, the target images can have over 200 layers (the script mentioned above is taking from 7 to 18 hours to process such big images) and the processing time should not be a bottleneck.
    So, I need an idea for a solution with these features:
    Short running time, like a few seconds or minutes not hours;
    Implemented preferably within Photoshop, by scripting or something else, but avoiding the use of the SDK resources;
    Is there any Photoshop plug-in provided by a third-party or vendor?
    I am looking forward to an answer. Thanks so much in advance!

    Well if you uninstall cs2, you lose the script. Without going into detail about what I went through with the CS3 install, the obvious answer is, yes that is what I am doing. The dialogue box is jumbled, it is definitely referencing something in the current version cs4 (or cs3 for that matter). I am trying to get a solution that will go forward. The script was totally rewritten for cs3 and it does not have the intelligence of the cs2 script. (ie, using the original documents PATH and FILENAME as a default. It is utterly ridiculous. I was hoping that this could be modified at the code (script) level to give the intelligence back to the script. Any help is appreciated.
    Chris
    this new forum does not give accurate details. I have been posting since 2003.

  • Missing lines when exporting to local file

    I've recently created a query in SQ01 which pulls out sales order information and uses a data reading program to display the texts.
    The query works absolutely fine and shows all the data required in SAP.
    The problem comes however when I export it to Excel using the ALV functionality of Export to Local file - spreadsheet. some of the lines in the middle of the report are missing in the saved excel file despite them being present in SQ01.
    However if I use the method of Export to local file - in the clipboard... and paste the data into an excel sheet, all the lines are present.
    What could be the cause of this issue? I could use the method of copying to the clipboard but a lot of people use this report and they aren't all comfortable with the copy paste method (because you then have to perform text to columns etc.) so it would be better if I could work out why it's not working in the original way and fix it.

    Hi Benjamin,
    let me first put in a question.
    Why don't you use the direct to excel export?
    If there's an issue with the inplace excel, there's an easy work-around for that.
    From the alv-grid chose printing preview, when you use the excel button from there, you'll get the popup asking you for format, table type etc. and then rewards you with a (usually) complete and readable excel.
    Note, that the download to local file, with spread-sheet option, creates an ascii csv file, with an xls extension. It's not quite an excel file.
    It might be exccel and not the export.
    Give it a try.
    BR - Jörg

  • LR 5 exporting low res files

    Hi
    My LR5 is exporting low res files for some weird reason. I figure it has to do with the fact that I recently started using the smart preview  function. What made me almost 100% certain is has to do with this is the fact that I removed the hard drive that the files were linked to in LR, and then I was still able to export files. Now that in my mind shouldn't be as that file would be based on the smart preview created.
    With all that said....any ideas on how to get around this?

    The export feature is available when using smart previews. Sometimes users want to export images to post on the web or to give to clients for evaluation. You simply have to be aware of what you are doing.

Maybe you are looking for

  • Basic problem with creation of HDInsight cluster with sql-server meta db

    We have been testing HDInsight capabilities in the last few days since the introduction of 3.2 I can no longer create HDInsight Haddoop cluster from the old portal https://manage.windowsazure.com with the meta data being in external sql-server (the n

  • Photo Slideshows and Nano

    Can one attach a cable "out" to a tv or another computer and play a slideshow from Nano - complete with music track?

  • 1.4.1.1 many images still not loading in browser

    I can't believe it. A LOT of people use the smartphone to go online, I mean A LOT. and what did palm do with the browser? get a nice ACID3 score? how much day to day benefit does it have? ZERO and the problems. slight large images stop loading, this

  • Bank of America Icon

    my phone use two work with the Bank of America icon but now it will not work. the only way that i can get on bank of America's website now is to change my 9630 browser from blackberry to Internet explorer. some has happen in the last few weeks that i

  • Mavericks switches language when I don't want it to

    After updating to Mavericks last night I find my mac has taken to converting my name written in English into Japanese  (I'm in Japan and do use Japanese a lot, but the system main language is set to English, and this problem is occurring in the middl