saveAs: replace files or ask what to do?

It's one of those situations where I feel like I'm missing something obvious, but with too little knowledge that I there are many potentially Miss. in any case, enough self-deprecating...

This script came from a discussion I found ages there are that match what I had to do in time. I don't remember the exact discussion but Larry G.S. he rounded up and posted this:

********************************************************** 
  
Place_JPG_to_AI.jsx 

DESCRIPTION 

This script gets files specified by the user from the  
selected folder and batch processes them and saves them  
as AIs in the user desired destination with the same  
file name. 

Modified from Adobe supplied scripts and 
scripts by Carlos Canto on Illustrator Scripting 
by Larry G. Schneider 
  
**********************************************************/  
  
// uncomment to suppress Illustrator warning dialogs  
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;  
  
var destFolder, sourceFolder, files, fileType;  
  
// Select the source folder.  
sourceFolder = Folder.selectDialog( 'Select the folder containing M.E.T. JPEG files', '~' );  
  
// If a valid folder is selected  
if ( sourceFolder != null )  
{  
     files = new Array();  
       
     // Get all files with JPEG extension
     files = sourceFolder.getFiles("*.jpg");  
       
     if ( files.length > 0 )  
     {  
          // Get the destination to save the files  
          destFolder = Folder.selectDialog( 'Select the folder where you want to save the AI files.', '~' );  
            
          for ( i = 0; i < files.length; i++ )  
          {  
               var idoc = app.open(File("/G/Design & Publishing/Elements/Master Templates/Re-Engineering Templates/Illustrator/MET Template 106.82x60.ai"));  // open template document. Change the file path for different templates
               
               var ilayer = idoc.layers["Image"];
  
               var iplaced = ilayer.placedItems.add();  // add image place holder  
               
               iplaced.file = (files[i]);  // place file  
                 
                var PosXY=new Array(2);  // ensure position is 0,0
                PosXY[0]=0;  
                PosXY[1]=0;
                iplaced.position = PosXY;
                iplaced.embed();
                 
               ilayer.dimPlacedImages = false;   // do not dim images        
               ilayer.locked = true;  // lock layer  
               ilayer.printable = true;
                 
               var docName = (files[i].name.split('.'))[0];   // take the first part of the placed file name for the new document  
       
               var destFile = new File(destFolder + "/" +  docName + ".ai");   // make a new file in the dest folder  
                 
               var options = new IllustratorSaveOptions();   // new save options  
               options.compatibility = Compatibility.ILLUSTRATOR15;   // save as AICS5. May want to update if we go to CC
               options.pdfCompatible = true; // needs to be set to view links in InDesign
                 
               // Export as AI  
               idoc.saveAs(destFile,  options);  // save the file in the dest folder  
       
               idoc.close(SaveOptions.DONOTSAVECHANGES);   // close the file without saving  
          }  
          alert( 'Files are saved as AI in ' + destFolder );  
     }  
     else  
     {  
          alert( 'No matching files found.' );  
     }  
}  
  
app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS  

I edited bits for our purposes, but it is basically the same. the user selects a folder with JPEG files, a folder of dest, and the script puts the JPEG images on my model and saves them to the original file name. However, sometimes the user will need to do this several times in the same folder of dest and will not necessarily know what JPEG files they already did. so they eventually overwrite files that may already have been worked on (the names cannot be changed afterwards for some reason very annoying and irritating).

what they would like, in this case, is for the script to advise when files with this filename already existing in the dest folder (but work normal otherwise). I thought just turn DISPLAYALERTS turn it on could do it (since that's what saveAs does when you go there manually) but it doesn't seem to make a difference. I can't find clues in the reference, but then I'm not entirely sure what I'm looking for.

any help or pointers no matter what level of detail welcome.

pass NULL to 0.

Tags: Illustrator

Similar Questions

  • Failed to open all the files, they are all displayed as. INK files and asked what program to open it with Windows 7

    * the original title - .encre does that mean? where my desktop icons and taskbar gone? *

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas: i can't open any of my files... I get a window that say they are all the .encre files and asks me what program I want to use to open... This includes all browsers as well... my desktop icons have also no image

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    .lnk are shortcut files (shortcuts are usually what you have on your desktop and the start menu).  If inadvertently, you tried to right click on a shortcut and choose "open with...". ", you can breaking their properties.

    Because the associations are complex and the registry can be dangerous, the best way to solve your problem is to use the system restore to fix system associations when returning parameters at the same time that they last worked properly.  Here's how:

    1 - Hold down the Windows key and type R to open the Run dialog box.

    2 - paste in this command: %systemroot%\system32\rstrui.exe

    3 - follow the instructions to restore your system at a time before, it was working fine.

    If it was useful, you can vote by clicking on the green triangle. If it solves the problem, click on propose as answer. Thank you!

  • Switched to a new computer and now cannot save my files to muse - what to do?

    I get this error: referenced UID without an owner. UID: U6230 class SiteNode

    Thanks for confirming.

    Please send this Muse file to [email protected] for us to study. If the file is larger than 20 MB, please use a service like WeTransfer or Dropbox to share files online. Please make sure that you add a link to this forum topic in your email subject line.

    Thank you

    Vikas

  • Windows 10 asks for credentials and password whenever I try to save a file

    Just bought a new computer with Windows 10 and whenever I'm in a product of Microsoft Office and you try to save a file directly to the OneDrive, I get a pop up asking me my user name and password.  Many times I have check the box to remember my username and password it is still asking for the credentials.  I found that if I enter the credentials or simply press enter, the result is the same he'll just file save screen.  It's incredibly annoying.  Everyone found this problem and if so, what is the solution?

    Hello

    Thanks for posting your query on the Microsoft Community.

    According to the description, I understand that you are facing problems using Windows 10 PC.

    I would like to know some information.

    1. Is it only when you try to save a file directly to the OneDrive?

    2. How long are you facing this problem?

    3. Did you change the settings on your computer before this problem?

    4. You are logged as administrator?

    5. You are connected to a domain network?

    You can also provide us with the screenshot of the question.

    Check out the link:

    http://Windows.Microsoft.com/en-us/Windows/take-screen-capture-print-screen#take-screen-capture-print-screen=Windows-10

    Please provide us with the information in short. We will be happy to help you further.

  • How can I replace the mime types of server, always get the mp3, rar, sid, bin files directly in the dialog box "where do you want to save this file?"

    I used to be able to click on MP3 files, the way back when, and Firefox asks where I wanted to save. Nowadays, it opens a new tab with a flash drive.
    By clicking on the "unknown" files, like .sid, .prg, .zip, .rar is ' this is a BIN file. [Cancel] [Save] ». It does not give me a check box for "always do this".
    I would like that option to edit so that certain types of files, such as PDF, regardless of mimetype, always get opened in a new tab if you click. Also some types of files, based on the extension, always go directly to the dialog box "Where you want to save the file?", without worrying if there is a viewer or a builtin player or not. In my Firefox (41.0.1 14.04LTS 32-bit Ubuntu) I have never the choice "do this for these files always" more.
    Googling led me to delete my file mimeTypes.rdf and since file extensions can even "well known", such as .zip, are treated as BIN files and I get the box Cancel-or-Save for those too - again without the choice of "always save the BIN files.

    These files are send as Content-Type: application/octet-stream and Content-Disposition: attachment;
    To send files in this way, you cannot save an automatic action.
    You can see that in network monitor.

    Content-Disposition: attachment; filename="TURRICAN_AMIGA_PORT.sid";
    Content-Type: application/octet-stream
    
  • I can't download Firefox. When I hit the download button the pop-up box asking me if I want to open or save the file disappears without me click an option.

    I tried to download Firefox without success.
    I hit the download button and, normally, a pop-up window appears asking me to open or save the file. An empty box appears briefly and then disappears.
    The problem may be with Internet Explorer 6.
    However, I tried to update to IE 8 and the same problem above occurs on the Microsoft Web site.
    I think that there is a little lack of IE 6.
    Any ideas?
    Thank you
    Sandra

    Thank you.
    In the end I had someone send me the file installation and it worked.
    Thanks for your time.

  • What this means if I want to 'Run or save' a file that I am trying to download?

    What this means if I want to 'Run or save' a file that I am trying to download?

    Refers to run the file (it's probably an exe file or similar, which runs a program).  Record means to save the file, and you can click it to run it later.  It is always better to first save the file (in a place, you can find easily) and then he search for potential viruses first before running.  Make sure you know what you click on and download, because things will immediately infect your computer - often to the point of making it unusable.

    Steve

  • Computer does not start up___Can I download this file from the Microsoft Web site. I put the XP CD in and it starts downloading files but it asks what windows installation I want to and don't gives me one option other than press "Enter" to abandon.

    My laptop does not start at the top. It indicates that the following file is missing or damaged WINDOWS\SYSTEM32\CONFIG\SYSTEM.

    Download this file from the Microsoft Web site. I put the XP CD in and it starts downloading files but it asks what windows installation I want to and don't gives me one option other than press "Enter" to abandon.

    See if anything here helps-

    How to recover a corrupted registry that prevents Windows XP startup
    http://support.Microsoft.com/kb/307545

    Install and use the Recovery Console in Windows XP
    http://support.Microsoft.com/kb/307654

    See also

    How to Troubleshoot Registry Corruption issues
    http://support.Microsoft.com/kb/822705

    How to fix a missing or corrupt Windows\System32\Config\System file
    http://xphelpandsupport.MVPs.org/how_do_i_repair_a_missing_or_cor1.htm

    TaurArian [MVP] 2005-2010 - Update Services

  • Solution: How can I disable IE9 asking if I want to save the file when I click on a video link?

    It happened once before, but I don't remember the solution.

    A few days ago started IE9 conventional if I want to save a file when I click on a video link.  I want to happen is for Windows Media Player to view the video.  I don't want to save on my computer, and if I did, I know how to right click and choose Save target as...

    It is very frustarting as Windows hides these obvious options without giving you a way easty to change.  I don't know what has caused the change at first.

    WMP is set as default player for all supported media types.

    Solution: Although WMP is already set as default program for all its supported video format, I had to go to set your default programs and select explicitly.

    Looks like the info bar itself would have the option available.

    Hello

     
    Thank you for your solution.
    This will help other members of the community to the same question.
    Please do not hesitate to visit our Web site for any help related to the Windows operating system.
  • I have windows vista and when I click on a shortcut on the desktop I have a pop up asking what file to open it with. In order to open the file I find the actuall file.

    Original title: registry exe problem

    I have windows vista and when I click on a shortcut on the desktop I have a pop up asking what file to open it with. In order to open the file I find the actuall file. This also occurs when you download the software, which makes it difficult, because the file is not on the pc yet. All solutions?

    Looks like you may have a virus or other malware. Get your updated antivirus program and boot into Safe Mode. Note that some viruses can hide from your normal antivirus program, so you really need to scan in Safe Mode. To enter in Safe Mode when you turn on first, press F8 on every seconds until you get the menu, and then select Safe Mode. Then run a complete system scan.

    Microsoft has suggestions and offerings to

    http://Windows.Microsoft.com/en-us/Windows7/how-do-I-remove-a-computer-virus

    Moderator Forum Keith has a few suggestions along this line to

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-performance/Windows-Explorer-has-stopped-working/6ab02526-5071-4DCC-895F-d90202bad8b3

    If that suits him fine. If this is not the case, use system restore to go back to an earlier date at the beginning of the problem. To run system restore, click Start-> programs-> Accessories-> System Tools-> system restore. Click on the box that says show more restore points.

    You can check the corrupted system files. Open an administrator command prompt and run SFC if the above does not help. Click START, and then type sfc in the search box, right-click to SFC. EXE and click run as administrator. Then, from the command prompt type sfc/scannow.

    Finally if all else fails, you can look at the rather cryptic system event log. To make, click Start-> Control Panel-> administration-> event viewer tools. Once in Event Viewer system log-click and scroll entries looking for these "error" with indicator see if you can find guidance on where the problem may be.

    I hope this helps. Good luck.

  • After removing a Vista computer Trojan horse, whenever I click on a file, he asks me what I want to open it with

    original title: Trojan suite!

    Just removed a Trojan horse, but whenever I click on a file it asks me what I want to open it with it's never happened before and I can't get on the internet or any other files. When I click something on open with, for example Adobe reader, it downloads something! All solutions? My computer is not your old ive had it a year and his dell

    Hi GraceZE,

    Method 1: Run the fixit available in the links below and check if that makes a difference-Worth to try
    Difficulty of broken desktop shortcuts and common system maintenance tasks


    Note:
    Fixit would attempt to recover bad sectors on the hard disk, in the course of this process there are chances of DATA loss from that particular area.


    Method 2:
    you can run the fixit available in the link below and then check

    When you run an .exe on a Windows Vista-based or Windows 7 computer file, the file may start another program

    http://support.Microsoft.com/kb/950505

    Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base.
    How to back up and restore the registry in Windows

  • When I try to open a file from a hotmail I message opon it and a box comes to save. When I click on save, I get a message "converter cannot save the file. What should I do?

    I tried to search for the file, but no luck.

    Hi jhonnyBgood,

    Are you on an e-mail as Microsoft Office Outlook with your hotmail email account or by using Internet Explorer client?
    What kind of file is and what is the size of this file?
    This error is specific to this file?
     
    Try changing the location of the destination file and check. The other possibility may be that the antivirus on your computer trying to analyze this file and casuing the conflict.
     
    How to ask a question on Microsoft Answers Website.
    http://support.Microsoft.com/kb/555375
     
    If you use Microsoft Office Outlook, I recommend you post this question on the following Web site:
    http://social.answers.Microsoft.com/forums/en-us/Group/Office
     
    We hope to hear from you soon.

    Thank you, and in what concerns:
    Shekhar S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.
    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • All exe files ask what program to use to open it with

    I just removed a virus on a computer Windows 7 Basic. Now when I try to open any exe file; I get the pop up asking what program to use to open the file with. It comes to any program including internet explore.

    Thank you for your help

    Hi RichCarlson,

    Follow the steps in the section "Let me fix it myself" to resolve the question of:

    When you run an .exe on a Windows Vista-based or Windows 7 computer file, the file may start another program

  • 'Open with' pop up at startup and during the session asking what file to open CHKUPD with. CHKUPD has no extension. Search does not find it.

    My problem is similar to the question asked by EamonnO.  Start a 'open with' screen opens asking what file to open chkupd with.  I think that hit "Cancel" would put an end to the action.  He appears periodically during my session on the computer or watching a movie.  I don't find the file using search.  I don't think that this means Daemon Tools because I never downloaded the program.  Some recent downloads include "Free File Viewer" and "Search for free Extension".  I have Vipre AV and System Mechanic running on my computer.  The situation may be harmless, but it is sure agrivating.  Thanks for any help you offer.  George

    Hello

    I had the same problem and there to remedy I just open the control panel and open then "Add / Remove programs.  The popup is apparently caused by a free File Viewer program.  I removed the program by clicking on the button Delete and the problem disappeared.  The free file viewer comes with a conversion program free .mp3 and seems to be completely unnecessary (I never needed the viewer of the file and open it with popup that was originally was boring and sometimes even nervewracking.)  If you do not have to uninstall programs of assistance, just the viewer of the file that comes as a free supplement program (problem).

    Once again, removal procedure: click on 'start '.
    Click on "Control Panel."
    Double click on "Add or remove programs".
    Click on "Free File Viewer" in the list of programs
    Click 'delete '.

    After this, the 'chkupd' open with popup when it stops appearing.

    Craig

  • My photoshop only save the file to copy. What should do? I need JPEG or JPG

    My photoshop only save the file to copy. What should do? I need JPEG or JPG

    You have probably some layers other than just a background, or you have certain paths or additional channels. Make sure you flatten the image and delete all channels and additional paths.

Maybe you are looking for

  • Is there anyone who can help me with Super Start

    I need assistance with Super Start. I checked the faqs and my problem is not covered.

  • Satellite 1905-S303 - fan turns on every 2 minutes

    Hey guys, thanks for your help in advance. I just noticed that my laptop fan lights quite often. I have a Satellite 1905-S303. How many times you ask? -The fan runs about every 2 minutes, and then it stays on for about 1 minute. (So the cycle takes a

  • Tecra M5 PTM51E: Toshiba Power Saver for VISTA?

    I'm running Vista RC2 (Build 5744) on a Tecra M5 (UK PTM 51(f)) and it is amazingingly stable after updatethe standard video driver. Update nvidia driver is great and works very good systems (!) A number of vista drivers is available at the United St

  • Problem using the serial port with windows 7

    Hello I have a modem of SIM cards (used to update remote controller of the electronic gate) that connects to my computer via the serieal port (COM1). The modem comes with its own piece of software that worked fine on my old computer with windows 7 (I

  • Driver for canoscan 1240u

    I have windows 7 with canoscan 1240u. need driver for scanner using windows 7 to * address email is removed from the privacy *