How to close and reopen a document immediately?

I would like to close a document and then immediately afterwards open it up again.<br /><br />The documentation says "To process a command to close the document immediately, use IDocumentCommands::Close'', but it also points to SDKLayoutHelper::CloseDocument which uses IDocFileHandler::Close.<br /><br />If I use IDocumentCommands::Close the close succeeds, but InDesign unexpectedly quits when it regains control.<br /><br />If I use IDocFileHandler::Close then when I reopen the document I get the assert ``Calling SelectionExtentionRegistry::Initialize more than once!'' This is the same error I get by not closing the document at all.<br /><br />I have also tried ProcessCommand(Utils<IDocumentCommands>()->CreateCloseCommand(docUIDRef)), but this also crashes InDesign when it regains control. <br /><br />In all cases I am calling ProcessCommand(CmdUtils::CreateCommand(kCloseLayoutWinCmdBoss), as otherwise I get an error that the document is still referenced on close.<br /><br />Is it possible to close all the layout windows and also close the document, so that it can be reopened immediately?

Closing then opening a document can be tricky, especially if you are trying to save its contents first.
If you try to save a file and then close it with a ProcessCmd then you'll have problems
as the save cmd won't have time to complete before it is hit with the close cmd.
You can save a document and then immediately request to close it with ScheduleCmd as this
just queues the close request and will process it once the save has completed - this is okay.
But you can't then just fire a request off to reopen the document as the previous commands
are still being processed - this would be a problem.
If you try to speed the process up by using ProcessScheduledCmds then you're
basically doing a save and close with ProcessCmd and will probably have the same problems.
The issue is that you need to leave InDesign alone while it finishes saving and empties its cmd queues.
You'll probably need an asynchronous approach.
Do a save on your document data - this lets you close it - but test if you need to save first.
Do a ScheduleCmd to queue a request to close the document.
Logic should now switch to the document observer.
When you get the message that your document is closed _then_ fire the logic to open it.

Similar Messages

  • Re:How to close and reopen a document immediately?

    Original Message available here:<br /><a href="/webx?14@@.3c055358">Dave Sykes, "How to close and reopen a document immediately?" #, 15 Nov 2007 4:46 am</a><br /><br />> Dave Sykes - 04:46am Nov 15, 2007 Pacific<br /> I would like to close a document and then immediately afterwards open it up again.<br />The documentation says "To process a command to close the document immediately, use IDocumentCommands::Close'', but it also points to SDKLayoutHelper::CloseDocument which uses IDocFileHandler::Close.<br />If I use IDocumentCommands::Close the close succeeds, but InDesign unexpectedly quits when it regains control.<br />If I use IDocFileHandler::Close then when I reopen the document I get the assert ``Calling SelectionExtentionRegistry::Initialize more than once!'' This is the same error I get by not closing the document at all.<br />I have also tried ProcessCommand(Utils<IDocumentCommands>()->CreateCloseCommand(docUIDRef)), but this also crashes InDesign when it regains control.<br />In all cases I am calling ProcessCommand(CmdUtils::CreateCommand(kCloseLayoutWinCmdBoss), as otherwise I get an error that the document is still referenced on close.<br />Is it possible to close all the layout windows and also close the document, so that it can be reopened immediately? <br /><br />I had the same issue and tried to solve it by closing all windows in the document's IWindowList and then calling IDocFileHandler::Close() with IDocFileHandler::kProcess to process the command immediately instead of scheduling it.<br />Unfortunately this still resulted in a crash.<br /><br />Eventually I got around it by adding the following line before re-opening the document:<br />CmdUtils::ProcessScheduledCmds (ICommand::kLowestPriority);<br /><br />This forced InDesign to completely close the document before re-opening it again.<br /><br />Hope this helps someone else too. :)<br /><br />- Jackeen

    I am having the same problem with InDesign CS4 version,
    I have tried the following:
    IDocFileHandler::Close() //with kSchedule command
    CmdUtils::ProcessScheduledCmds();     //Results into crash
    IWindowList::CloseAll()
    IDocFileHandler::Close() //with kSchedule command
    CmdUtils::ProcessScheduledCmds();     //Results into crash
    IDocumentList::CloseAll()
    IDocFileHandler::Close() //with kSchedule command
    CmdUtils::ProcessScheduledCmds();     //Results into crash
    IPresentationList::CloseAllPresentations()
    IDocFileHandler::Close() //with kSchedule command
    CmdUtils::ProcessScheduledCmds();     //Results into crash
    is Three anything else that could work.
    Thanks and Regards
    Saurabh Singhal

  • How do I access the End User Licensing Agreement? I clicked on it and it gives me a message that I need to launch Adobe Reader, accept and close and reopen. Trouble is I can't get to an icon for file to launch. I am working on a Mac and have installed Mac

    I am using a Mac and have installed Adobe Reader for Mac, latest version. I cannot access the End User Licensing Agreement. I clicked on it and it gives me a message that I must launch Adobe, check that I agree, close and reopen. The problem is I can't find any way to launch Adobe because it appears nowhere on my launch pad, nor in my document files or on the control panel. Because of this, I cannot print bank statements nor can I get into my insurance companies billing department to make a payment. HELP!

    How about in your Applications folder?

  • Every time I load my igoogle home page opening firefox, it opens it in two tabs instead of one, and then AVG tells me firefox is using too much memory and I should close and reopen it; Why

    I open firefox using my igoogle home page and immediately it opens two igoogle tabs on top instead of just one how do I stop it from opening the second one? and then after about two minutes AVG tells me firefox is using too much memory slowing my machine and tells me to close and reopen fire fox...how do I fix that?

    Make sure that Firefox closes properly and that that there are no longer Firefox or plugin-container processes left on the Processes tab in the Task Manager. Otherwise session restore will reopen the page(s) from the previous session.
    See "Hang at exit":
    * http://kb.mozillazine.org/Firefox_hangs
    * https://support.mozilla.com/kb/Firefox+hangs

  • A problem with this webpage caused Internet Explorer (IE9) to close and reopen the tab

    I have IE9 (using 32-bit version) installed on a relatively new laptop with Windows 7 64-bit. Up until last weekend IE9 worked fine and Flash Player worked fine too.
    At the weekend a webpage asked for Flash Player to be updated - which I did. Ever since then whenever I go to a webpage needing Flash Player I get the message "A problem with this webpage caused Internet Explorer to close and reopen the tab". This happens twice and then an IE9 error page.
    I have read the discussions in here about the problems with Flash Player 10.3 and have tried the various solutions. I have updated to 10.3.181.16 having tried 15 and 14 previously. Same problem.
    I have reset IE9. Same problem.
    I have disabled all add-ons which stops the problem. If I enable just the Flash Player add-on then the problem recurs. Since there are so many webpages that use Flash I do not want to run my browser without this add-on running.
    If I enable the add-on and run IE9 using software rendering instead of GPU rendering then I don't get the problem. However, this isn't exactly making the best use of the resources on my laptop.
    This may well all be related to the 10.3 problems but no one seems to have mentioned having a problem with tabs closing and reopening so I thought I would post on here to check.
    Any suggestions for how to solve this (other than using software rendering)?

    Thanks again for your reply. I appreciate the time you have taken to respond.
    I think, however, you misunderstand the problem. IE9 does not reopen the tabs on just one website - it is doing this on every website that needs Flash Player. Therefore, running in Compatibility mode is not an option. In fact, because IE9 reopens the tabs so quickly and then ends up with an error page, I cannot even click the Compatibility button anyway.
    I could use ActiveX filtering - true. All that this means is that Flash does not play on any of the websites. When I want to re-enable ActiveX for a particular website where I need to see the Flash Player item, this just triggers the error.
    This problem also happened on .14, .15 and well as the current .16 version. It did not happen with the previous version of Flash Player that I had on the system (version 10.2 I think).
    The fact is that either Flash Player or IE9 or both is/are broken. The two choices I am still left with are:
    1. Use software rendering (which contradicts the latest advertisements for IE9 about unleashing the power of IE)
    2. Use another browser - I have no problems with either Firefox or Chrome

  • When I close and reopen firefox, it restores my tabs, but it restores tabs from hours or days ago, not the ones that were open when I closed the window - why?

    I normally keep my Firefox window open for long periods of time because I have a lot of active tabs. When I close the window and reopen it, I am still able to restore tabs, but as of a few weeks ago, it has stopped restoring the most recent version. Normally, when I would close and reopen, the tabs would be the same ones that were open when I closed the window. Now, it restores to a version from a few days ago instead of the current version. I have to revert to pulling my more recent tabs out of the recent history. I checked my options and I can't figure out any way to control this. How can I fix it so that I can count on my Firefox window to restore the tabs that I actually care about?

    You can check for problems with the sessionstore.js and sessionstore.bak files in the Firefox Profile Folder that store session data.
    Delete the sessionstore.js file and possible sessionstore-##.js files with a number and sessionstore.bak in the Firefox Profile Folder.
    *Help > Troubleshooting Information > Profile Directory: Open Containing Folder
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    Deleting sessionstore.js will cause App Tabs and Tab Groups and open and closed (undo) tabs to get lost, so you will have to create them again (make a note or bookmark them).
    *http://kb.mozillazine.org/Multiple_profile_files_created
    *http://kb.mozillazine.org/Session_Restore

  • When I set (on two different computers) the Location Bar to "Nothing" it resets to "History and bookmarks" as soon as I close and reopen Firefox.

    When I set (on two different computers) the Location Bar option: When using the location bar suggest: to "Nothing" it resets to "History and bookmarks" as soon as I close and reopen Firefox. I am using the latest vesion on Win8 on both computers. One has Bitdefender the othe McKafee. I have no obvious Addware, I use Iobit Uninstaller Advanced Care and and Driver manager on both computers. Until now I have always used Firefox as I refuse to use Explorer and I do not want to have to use Opera or another browser instead.
    Can you please help?

    Have you seen this general article: [[How to fix preferences that won't save]]?
    Also, this might be a glitch with using automatic private browsing mode. Some settings changes might not be saved in that mode.
    If all else fails, do you want to try a manual hack?
    Open your current Firefox settings (AKA Firefox profile) folder using either
    * "3-bar" menu button > "?" button > Troubleshooting Information
    * (menu bar) Help > Troubleshooting Information
    * type or paste about:support in the address bar and press Enter
    In the first table on the page, click the "Show Folder" button. This should launch a new window (Windows Explorer window) showing your current settings files.
    Leaving that window open, switch back to Firefox and Exit, either:
    * "3-bar" menu button > "power" button
    * (menu bar) File > Exit
    Pause while Firefox finishes its cleanup, then open '''prefs.js''' in a text editor by right-clicking it and choosing Edit or Open With. (Double-clicking leads to Windows attempting to execute it, so I do not recommend that.)
    Paste this at the end of the file on its own line:
    user_pref("browser.urlbar.autocomplete.enabled", false);
    Then save the file and close your editor.
    Start Firefox back up again. Did the manual change work?

  • Can no longer print from Photoshop CS^ have upgraded drivers error message reads There was an error opening your printer. Printing functions will not be available until you have selected a printer and reopened any documents."

    I have upgraded my iMac to Yosemite but now my two Canon Printers no longer print from Photoshop CS6. I have upgraded the drivers. All other applications including Lightroom are fine. I am receiving an error message as follows:"There was an error opening your printer. Printing functions will not be available until you have selected a printer and reopened any documents." How can I get the OS to return a list of printers to Photoshop when Photoshop requests a list.

    Have you printed to this printer from 10.10 before?  If so, check your connections.

  • Since the last update, whenever I close and reopen Firefox, my default search engine changes back to Google. What's going on?

    Since the last update, whenever I close and reopen Firefox, my default search engine changes back to Google. I have to manually change it back to my preferred engine. Is anyone else having this problem, and if so, how can I permanently change my search provider, instead of having to manually change it again every time I start Firefox?

    You can use the SearchReset extension to reset some preferences to the default values.
    *https://addons.mozilla.org/firefox/addon/searchreset/
    Note that the SearchReset extension only runs once and then uninstalls automatically, so it won't show on the "Firefox > Add-ons" page (about:addons).
    If you do not keep changes after a restart or otherwise have problems with preferences, see:
    *http://kb.mozillazine.org/Preferences_not_saved
    Try to delete the search.json file and possible search-metadata.json and search.sqlite files in the Firefox profile folder to reset the search engines to the default.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    Firefox will rebuild the search.json file from the default search engines in the "browser\searchplugins" folder in the Firefox program folder and the searchplugins folder in the Firefox profile folder.
    You can use this button to go to the currently used Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Show Folder (Linux: Open Directory; Mac: Show in Finder)
    *http://kb.mozillazine.org/Profile_folder_-_Firefox

  • If I have more then a few tabs open such as gmail, facebook, and a zynga game no tabs will load at all. I close and reopen firefox numorous (Im talking 7 or 8 times or many more) and shut down the zynga game and still it wont load

    If I have more then a few tabs open such as gmail, facebook, and a zynga game no tabs will load at all. I close and reopen firefox numorous (Im talking 7 or 8 times or many more) and shut down the zynga game and still it wont load the tabs or if it does and I then try to add the game or any other site at all on a tab it causes firefox to stop working (though not close) and I have to restart opening and closing it many times to get it to work at all.

    1st, you will not be able to activate your PPro1.5 on ANY new computer, see next link for the special version you MUST use
    CS2 (and earlier) Activation Server http://helpx.adobe.com/x-productkb/policy-pricing/creative-suite-2-activation-end-life.htm l
    2nd, you already mentioned Virtual XP, so if a direct install doesn't work, that would be the way to go... or, to just do what SHOULD work from the start, just do Virtual XP

  • There was an error opening your printer. Printing functions will not be available until you have selected a printer and reopened any documents. Error message in PhotoShop CC

    Printing from PS CC worked fine today. I made no changes to preferences. In between working with 2 projects, the first one printed fine, the second gave me this Error Message.
    There was an error opening your printer. Printing functions will not be available until you have selected a printer and reopened any documents.
    Now I've checked for updates for my printer, reset my printer, reset PS CC preferences, picked my printer as Default and Last Used, and rebooted. I've followed all the recommended fixes for this issue I could find here and on the internet. I can print fine from any other program. Alas, the error message keeps popping up and I can't print.
    PS CC is up to date
    Running OS 10.10.2
    HP Printer updated
    Help?

    Have you printed to this printer from 10.10 before?  If so, check your connections.

  • Itunes stops working after say half hour of use and will not play next song, the only way to get it working again is to close and reopen, then it works fine till next time, but the problem keeps returning

    itunes stops working after say half hour of use and will not play next song, I have to close and reopen, it works fine till next time, it keeps happening on a regular basis, HP pavilion laptop, g6 series,
    Window 7 64 bit

    Hello davewood26,
    The following article provides steps that can help get iTunes stabilized.
    iTunes for Windows Vista, Windows 7, or Windows 8: Fix unexpected quits or launch issues
    http://support.apple.com/kb/TS1717
    Cheers,
    Allen

  • There was an error opening your printer. Printing functions will not be available until you have selected a printer and reopened any documents.

    I've never had this problem before. It only affects Photoshop CS6 and CS5 that I have installed. I'm running MAC OS 10.9.5
    I have three printers and HP and two Epsons, and I get this dialogue when trying to print from Photoshop CS6 or CS5.
    There was an error opening your printer. Printing functions will not be available until you have selected a printer and reopened any documents.
    Other applications print fine on all three printers.  I tried deleting the Photoshop Prefs numerous times without results.
    Does anyone have an answer for this?
    Thanks.

    Have you printed to this printer from 10.10 before?  If so, check your connections.

  • How to close and re-open the browser

    I have just downloaded a program and to fully install it it is requesting that I close the browser and re-open it. I don't know how to close and re-open the browser. Can you tell me how to close and re-open the browser? Thank you

    It is always best to use File > Exit<br />
    That will close all open windows, so if there are still other windows open then these won't close if you use the close X on the title bar.
    Also make sure that you do not have security software that is locking files in the Firefox program folder.

  • Everytime I close and reopen firefox, my themes and add-ons are gone and I need to re-install them.

    To be more specific, my chosen custom theme will be deleted, buttons for add-ons such as "white on black" will have to be added again, and settings such as the preference to save downloads on my desktop instead of a "Downloads" folder will be reset to the latter.
    Also, when I reopen the browser, I get the Firefox Start Page, as I have specified, but I also get other tabs such as the homepages for greasemonkey and userstyles.org.
    Please do help me if you can, I need a solution. I choose a theme that changes the entire skin to black because I work on the PC for long hours, and I need dark colours to help my eyes cope with the stress. It's going to be a massive strain if I have to re-install the theme everytime I close and reopen the browser.

    I've tried that, but the problem persists.

Maybe you are looking for