Save and close InDesign file CS4 JS

Hi, I need to save and close InDesign file after export pdf was done. Once export is complete the script opens the pdf file and the script gets interrupted. Here what I was trying and I am not sure if it even in the right direction:
#targetengine "session"
main();
function main(){
    var myApplicationEventListener = app.eventListeners.add("afterExport",
    mySaveInDesign, false);
    var myDocumentEventListener = app.documents.item(0).eventListeners.add
    ("afterExport", mySaveInDesign, false);
    app.scriptPreferences.version = 6.0;
var myEventNames = ["afterExport"] ;
function mySaveInDesign(myEvent){
    var myDocument = myEvent.parent;
    saveInDesign ();
function saveInDesign (){
    //myDocument.save(myDocument);
    app.activeDocument.save(myDocument);
    app.activeDocument.close(myDocument);
Your help is highly appreciated.
Yulia

Save either takes no argument (equivalent to the File/Save menu option) or a file path, equivalent to File/Save As.
So, your save commands aren't going to work as written. You either need just save(); or save(myDocument.fullName);
Dave

Similar Messages

  • Welcome window problem.  appears every time i save and close a file of photoshop

    How to fix a bug regarding welcome window. this window appears every time i save and close a file of photoshop, its started after the last update 2014.2.0

    See this document: Troubleshoot Welcome Screen in Photoshop
    Scroll all the way down to the bottom. There's a check box "Don't Show Welcome Screen Again"
    You can relaunch the screen at a later date by selecting Help>Welcome Screen...
    ~ Arpit

  • Hello, Indesign 6 will not allow me to save and close my file

    Hello, Indesign 6 will not allow me to save and close my file

    Try exporting to .idml. If that works, openthe .idml and save as a new .indd.
    If it doesn't work, force quit ID and then restart. Auto-recovery should kick in and reopen the file at about the last state, then try again.

  • Save and Close excel file opened through OLE

    Hi,
    I have opened an excel file on my desktop and edited it.Now I have to save this file and close it.
    Right now , I am manually saving the file and closing it. So please give the steps to automate the process of saving and closing .
    Please find the code below for opening a file and editing.
    report zkntest2.
    INCLUDE: <line>,
             <icon>,
             <symbol>,
             ole2incl.
    DATA: g_excel_app             TYPE ole2_object,
          g_excel_workbook        TYPE ole2_object,
          g_excel_worksheet       TYPE ole2_object,
          g_excel_usedrange       TYPE ole2_object,
          g_excel_cell            TYPE ole2_object,
          g_excel_return          TYPE ole2_object.
    data :H_MAPL TYPE OLE2_OBJECT,         " list of workbooks
          H_MAP TYPE OLE2_OBJECT,          " workbook
          H_ZL TYPE OLE2_OBJECT,           " cell
          H_F TYPE OLE2_OBJECT.            " font
    CONSTANTS:c_appl(17)              TYPE c VALUE 'Excel.Application'.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 with frame title text-001.
    PARAMETERS p_ofile LIKE rlgrap-filename default 'C:\layout.xls'.
    SELECTION-SCREEN END OF BLOCK blk1.
    CREATE OBJECT g_excel_app c_appl.
    CALL METHOD OF g_excel_app 'Workbooks' = g_excel_workbook.
    CALL METHOD OF g_excel_workbook 'Open'
      EXPORTING #1 = p_ofile.
    SET PROPERTY OF g_excel_app 'Visible' = 1.
    CALL METHOD OF g_excel_app 'Workbooks' = H_MAPL.
    PERFORM FILL_CELL USING  4 9 1 'Kiran'(001).
    PERFORM FILL_CELL USING  5 9 1 'Ref#'(002).
    PERFORM FILL_CELL USING  6 9 1 'Claim#'(003).
    PERFORM FILL_CELL USING  7 9 1 'Location'(004).
    FREE OBJECT g_excel_app.
    FORM FILL_CELL USING I J BOLD VAL.
      CALL METHOD OF g_excel_app 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
      SET PROPERTY OF H_ZL 'Value' = VAL .
      GET PROPERTY OF H_ZL 'Font' = H_F.
      SET PROPERTY OF H_F 'Bold' = BOLD .
    ENDFORM.                    "FILL_CELL

    Try add this code below.
      CALL METHOD OF G_EXCEL_APP 'ActiveWorkbook' = G_EXCEL_WORKBOOK.
      CALL METHOD OF G_EXCEL_WORKBOOK 'SaveAs' EXPORTING #1 = '1.xls'.
      CALL METHOD OF G_EXCEL_WORKBOOK 'Close'.
      CALL METHOD OF G_EXCEL_APP 'Quit'.
      FREE G_EXCEL_APP.

  • Save and close excel file using C#.

    I am not sure why I get the following error for the below code.  Everything seems to work otherwise.
    Error found: System.Runtime.InteropServices.COMException (0x8002000B): Invalid index. (Exception from HRESULT: 0x8002000
    B (DISP_E_BADINDEX))
    Application _application;public void CloseFile(string filename, bool isSaveChanges)
    _application.Workbooks[filename].Close(SaveChanges: isSaveChanges);

    I' work with excel files with connection you can save data and  close connection Easy.
     //connection String for xls file format.
                        if (fileExtension == ".xls")
                            excelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
                        //connection String for xlsx file format.
                        else if (fileExtension == ".xlsx")
                            excelConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
                        //Create Connection to Excel work book and add oledb namespace
                        OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
                        excelConnection.Open();
    DataTable dt = new DataTable();
                        dt = excelConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
                        if (dt == null)
                            return null;
                        String[] excelSheets = new String[dt.Rows.Count];
                        int t = 0;
                        //excel data saves in temp file here.
                        foreach (DataRow row in dt.Rows)
                            excelSheets[t] = row["TABLE_NAME"].ToString();
                            t++;
                        OleDbConnection excelConnection1 = new OleDbConnection(excelConnectionString);
                        string query = string.Format("Select * from [{0}]", excelSheets[0]);
                        using (OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, excelConnection1))
                            dataAdapter.Fill(ds);
    Best Regards
    Hakim.

  • Keep getting corrupted temp save file when I save and close.

    When I save and close a numbers spreadsheet, about 20% of the time I will be left with the normal file and a weird temporary file with a "~" on the end of the file name.  I can't delete the file or do anything with it.  It will let me open it, but even when I save it still says I cant delete because the file is in use.
    Example-
    Work on spreadsheet1.  Hit save and then close.
    In finder I am left with-
    spreadsheet1
    spreadsheet1~
    "spreadsheet1" is the correct file and it works and functions normally, but "spreadsheet1~" is corrupt and I cant seem to delete it.  I always get "The operation can’t be completed because the item “spreadsheet1~” is in use.
    What is causing this and how can I get rid of those files?

    I think I would ignore the files and not worry about them.  Are you experiencing any undesirable effects of these files-- aside from seeing them there?

  • When I save a CS6 InDesign file as an .idml file InDesign crashes and sends a report to Adobe.

    When I save a CS6 InDesign file as an .idml file InDesign crashes and sends a report to Adobe.
    When I restart InDesign the .idml file is in the directory as well as a locked InDesign file.
    I cannot open the .idml file, instead I get the message:
    Cannot open "" file. Adobe InDesign maynot support the file format,
    a plug-in that supports the file format may be missing,
    or the file may be open in another location.
    I can however open an InDesign .idml file that was saved from InDesign CC software.
    InDesign CC software is also unable to open the .idml file that I created in CS6.

    It seems to be a corrupted IDML file. Does it happen with every file or only with that one.
    What is the content of that file? Did you embed images or graphics or did you ink them? Size?
    Maybe that this would help you: Re: InDesign 6 is crashing when attempting to open a particular document. All others are opening OK.

  • Automatically open, save and close excel?

    I need import data from Excel to SQL.
    Now, I use tSQL to directly read the excel files and transform to the SQL table.
    As the user Excel is not a good format for SQL to read, I need use formula to transform the excel to be a SQL readable format.
    Now, I add a sheet to copy the data from the sheet which user input the data and then ask the user to copy the excel to a specific location for import.
    However, this will make the data in the excel double and result a large excel file.
    I am thinking if it is possible to create a excel to use formula to copy the data from another excel.
    Then, I need find some method to open that excel, let the content refresh from the source excel, save and close it.
    Then I can directly use this excel for data import.
    Is there any simple way to do so? I don't know marco much...
    Ivan

    No formula could do this (Automatically open, save and close excel).
    You need to recode a marco or write a macro. Why donot you ask in msdn?
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    example:
    Sub auto_open()
    Application.OnTime Now + TimeValue("00:01:00"), "wswx"
    End Sub
    Sub
    wswx() If Not ThisWorkbook.Saved
    Then ThisWorkbook.Save
    ThisWorkbook.Close
    End Sub
    KR

  • Use VBA and Excel to open Dreamweaver HTML (CS5), find and replace text, save and close

    I wish to use VBA and Excel to programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the code view of these files, save and close them.
    I have  5000 associations between Find: x0001 and Replace: y0001 in an Excel sheet.
    I have the VBA written but do not know how to open, close and save the code view of the ####.html files. Please ... and thank you...
    [email protected]

    This is actually the code view of file ####.html that I wish to find and replace programmatically where #### is a four digit number cataloguing each painting.... In 1995 I thought this was clever... maybe not so clever now :>)) Thank you for whatever you can do Rob!
    !####.jpg!
    h2. "Name####"
    Oils on acrylic foundation commercial canvas - . xx X xx (inches) Started
    Back of the Painting In Progress </p> </body> </html>
    Warmest regards,
    Phil the Forecaster, http://philtheforecaster.blogspot.ca/ and http://phils-market.blogspot.ca/

  • I can't save an old InDesign file to the new version

    I can't save an old InDesign file to the new version. I keep getting this message:
    I can only save the file as .IDML.

    This happens to ALL old InDesign files on my iMac (problem does not happen on my Macbook pro). I have saved the files as .idml and opened them again. I get the same error when I try to save the file as .indd. They can ONLY be saved as .idml.
    I never embed images and do not have font issues (file was created on the same iMac as it is being opened on now).
    Sometimes I get an error when I first try to open an old file - it ays the file is damaged and can't be opened. I try again right after and it opens fine.

  • Firefox asks (twice) to save and close tabs, on new open windows without tabs, when i close them.

    About one month ago, i started to receive a message box from firefox, asking if i wanted to save and close tabs, on newly open windows (and pop-ups) without any tabs open on them.
    And everytime i close the windows without tabs, firefox asks it twice...
    I did not made any changes, so i don't know why it started doing this.

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    * [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • InfoPath save and close button?

    I've seen this done so I know there is a way to do it, just haven't found the solution
    I want to create a browser-based form that has a button to be able to save (not submit, just save), and close the form. InfoPath seems to lock out the option to add a rule to close the form if you want to save it, and there is no rule to save, only submit.

    Here's what I do as a standard practice for the file naming convention.  I do not use "now()" because then each time you edited the same form, it would create a new file.  You only want one file per form, right?
    Create a field called "FormCreated", and set its default value to now().  UNcheck the box so that the value is never recalculated.
    In your submit connection, use this "FormCreated" field as your file name, and DO check the box to allow overwrite.
    As far as the workflow, if it's set to run on change, then when you use the submit action, the workflow will run.
    Laura Rogers
    Rackspace: SharePoint Consulting
    Blog: http://www.wonderlaura.com
    Twitter: WonderLaura
    Books:Beginning SharePoint 2010: Building Business Solutions with SharePoint
    Using InfoPath 2010 with Microsoft SharePoint 2010 Step by Step

  • Save and Close button issue in CRM 2013 for Activity Type Appointment

    Hi All,
    Have come across a strange behavior in CRM 2013 and would like  to be sure that it really is an issue which others have encountered too.
    Open a Case record, and click on Activity navigation link to see the Open Activity Associated View. Then try creating an Activity of type Meeting and click on
    Save & Close button (not just Save). When you refresh the view, the activity might show up. But repeat the same steps and create another Activity of Type Meeting and this activity will not show up. It doesnt show up even in the All Activities
    view. Seems like the activity does not get created when using Save and Close button.
    This behavior is replicated even on online 30 day trial version. Any inputs?
    Regards,
    Yogesh

    The problem only occurs when your appointment times clash.   "Save and close" just throws the appointment away.  "Save" tells you about clash (or perhaps it's just unavailability) and allows you to ignore and continue with the
    save.

  • Save and close popup window

    I have a typical popup window launched using the builtin javascript:popupURL().
    I would like a Save and Close button on this popup window that does
    1. Submits the popup page so that changes are saved into session state
    2. Close the popup window
    3. Refresh the parent window so that updates in (1) are reflected
    What is the recommended way of doing this? I was thinking of the following URL redirect on the Save & Close button
    doSubmit('SAVE');
    window.opener.location.reload();
    window.close();Do I need a same-page branch on the popup page? If so, why? If not, why? ;-)
    Comments?
    Thanks

    This is a bit of javascript that I nicked which works well for me:
    -- 1. Add the folowing to your page header or create a new page template --
    -- (popup window template) and put it in the header section. --
    SCRIPT LANGUAGE="JavaScript">
    function loadinparent(url, closeSelf){
         self.opener.location = url;
         if(closeSelf) self.close();
    </SCRIPT>
    -- 2. Use the following to call the function. the true and false keeps the parent--
    -- window open or closed. Obviously set any values in the URL. --
    javascript:loadinparent(''<URL>'', true)
    eg. javascript:loadinparent(''f?p=&APP_ID.:40:&SESSION.::NO::P40_ID:'||ID||''', true)
    -- Inc the following comment in your header --
    -- Version 1.0
    -- Last Updated: May 18, 2000
    -- Code maintained at:
    -- http://www.moock.org/webdesign/javascript/
    -- Copy permission granted any use provided this notice is unaltered.
    -- Written by Colin Moock.
    Simon

  • Open, Write and Close the file using Powershell

    Hi All,
    I need to create/open a file and write some data into it and close that file.
    Could anyone please help me with this.
    Thanks.

    You don't need to explicitly create, open, or close a file in Powershell.  Here are some ways to write to a file, in addition to New-Item:
    $text = 'Hello World'
    # Create file:
    $text | Set-Content 'file.txt'
    #or
    $text | Out-File 'file.txt'
    #or
    $text > 'file.txt'
    # Append to file:
    $text | Add-Content 'file.txt'
    #or
    $text | Out-File 'file.txt' -Append
    #or
    $text >> 'file.txt'
    Grant Ward, a.k.a. Bigteddy
    The problem with Out-File is that it works like the console. When text is output, it will be truncated if it is wider than the default. So if you are looking for something where you need to store lots of long strings, then you may want to choose a different
    route, or ensure than you specify a width for your output.
    http://technet.microsoft.com/en-us/library/ee176924.aspx
    For example to get 200 characters of width:
    $text | Out-File
    'myfile.txt' -width 200
    I do not know for certain if there is a limit to how wide it can be. I also assume the default is the standard console width (80 characters I believe.)

Maybe you are looking for

  • Sorting vendor checks by vendor name

    Client wants checks from payment wizard run to print sorted by vendor name. Any way to do it? TIA. Cindy Lange

  • How to move app in sequence for saving documents

    When I save a document on my ipad, I get many options for apps. Can you move the order of the apps to put dropbox in the front?

  • Using WebDAV without the WebUI

    We are running iFS 9.0.2 and want to be able to access our Oracle 9iFS repository via WebDAV without using the WebUI. There are some references to DavServerConfigurations in Appendix C of the Setup and Admin guide but we need a working example. Does

  • Messed up tracks in Logic

    I spent hours working on a project in Logic. I saved the project and quit Logic. I came back an hour later, and the settings of every one of my instruments were completely messed up. I've tried reverting to other saved versions, but they are all mess

  • Correct Order of Updating Drivers?

    Okay.. I just installed windows xp sp2.. I want to know what i should be updating first? Can somebody give me a list? Also.. where can i find Nforce unified driver for neo4 plat? And what does unified drivers do? Thanks!