Recovering Procedures From Unresponsive Igor

Hello all,

I realize this is a long shot but it's important enough to post. I was working with several unsaved procedure files when the program froze into an unrecoverable state. My question is: in what form and where does Igor store active procedure files for compilation? Is there any way to retrieve this data to salvage my work? I've checked %appdata% and each folder in the Igor directory with no luck.

Do note: Igor was not simply busy with an 'Abort' option available. I mean the entire window froze and the cursor morphed into the widely detested spinning circle; the program in task manager is deemed 'Not responding'.

Quote:
in what form and where does Igor store active procedure files for compilation?

In memory only until you save it.

Quote:
Is there any way to retrieve this data to salvage my work?

No.

 

In reply to by hrodstein

Thanks for the timely answer, hrodstein. Is there a manner to save all open procedures to a specified location? I'm hoping to prevent such a loss by implementing a sort of auto-save functionality. I'm aware of SaveExperiment however my procedures are individually included and manually opened to avoid the use of experiments altogether. I imagine the ctrl + shift + s shortcut may come in handy here..

Quote:
Is there a manner to save all open procedures to a specified location?

The only way to save all open procedure files with one action is to save the experiment. That saves all procedure files, whether packed or unpacked.

Quote:
I'm hoping to prevent such a loss by implementing a sort of auto-save functionality. I'm aware of SaveExperiment however my procedures are individually included and manually opened to avoid the use of experiments altogether.

I don't see a way to do this but someone else may think of something that has escaped me.

 

In reply to by david.crowe

david.crowe wrote:

Thanks for the timely answer, hrodstein. Is there a manner to save all open procedures to a specified location? I'm hoping to prevent such a loss by implementing a sort of auto-save functionality. I'm aware of SaveExperiment however my procedures are individually included and manually opened to avoid the use of experiments altogether. I imagine the ctrl + shift + s shortcut may come in handy here..

This is a bit indirect, but you can use WinList("*", ";", "WIN:128") to get a list of all procedure windows. Then you could iterate through each and use ProcedureText("", 0, procedureWindowTitle) to get the complete text of the window (where procedureWindowTitle is a title you get from the WinList command). Then you can use FBinWrite to write the string's contents to a file that you have opened with Open. If you go this route I would recommend saving to a different name (eg. MyProcedure.ipf.autosave) instead of the actual procedure file itself.

Keep in mind that WinList won't return procedures that are part of independent modules unless you've previously executed SetIgorOption independentModuleDev=1 in that instance of Igor.

I thought of something that you might find useful.

If you edit, say, three procedure files, and then save the experiment, all procedure files are saved.

Now let's say you edit three procedure files but you don't want to save the experiment. If you choose File->New, Igor will ask if you want to save the experiment. Say "No". Igor will then ask if you want to save the three edited procedure files. Say "Yes".

I have added this to our wish list for Igor9:

Quote:
If the user presses Alt/Option and clicks the File menu, change Save Procedure to Save All Procedures. If the user chooses Save All Procedures, do it.

 

In reply to by hrodstein

hrodstein wrote:

I thought of something that you might find useful.

If you edit, say, three procedure files, and then save the experiment, all procedure files are saved.

Now let's say you edit three procedure files but you don't want to save the experiment. If you choose File->New, Igor will ask if you want to save the experiment. Say "No". Igor will then ask if you want to save the three edited procedure files. Say "Yes".

I have added this to our wish list for Igor9:

How about this when a user chooses New Experiment with an experiment that is currently modified but unsaved

 --> Dialog Box with Three Choices

[ Save Modifications as New Experiment ]
[ Save Modifications to Current Experiment ]
[ Abandon Modifications ]

In reply to by aclight

aclight wrote:

This is a bit indirect, but you can use WinList("*", ";", "WIN:128") to get a list of all procedure windows. Then you could iterate through each and use ProcedureText("", 0, procedureWindowTitle) to get the complete text of the window (where procedureWindowTitle is a title you get from the WinList command). Then you can use FBinWrite to write the string's contents to a file that you have opened with Open. If you go this route I would recommend saving to a different name (eg. MyProcedure.ipf.autosave) instead of the actual procedure file itself.

Keep in mind that WinList won't return procedures that are part of independent modules unless you've previously executed SetIgorOption independentModuleDev=1 in that instance of Igor.

 

This is the sort of lower-level answer I was after. Your other method using the New Experiment dialog could also certainly work, though I'd love to automate this approach. Thank you!

You might take a look at https://www.wavemetrics.com/code-snippet/autosave. That snippet will save the entire experiment by calling SaveExperiment, but you could modify that to call new code that you write that saves all procedure files. I don't think there's an easy way for you to determine whether a given procedure file has been modified since it was last saved. You could compute a hash of the current contents and compare that with a hash of the contents of the file on disk if you wanted to, or you could just make autosave copies of all procedure files.

There is also https://www.wavemetrics.com/code-snippet/auto-save-experiment-files, which does something pretty similar.

In reply to by aclight

Depending on your coding style, saving every time you recompile might be good enough. That's pretty easy to implement thanks to the "on compile" hook, alongside the ProcedureText approach. I took a crude hack at it (https://www.wavemetrics.com/code-snippet/save-upon-compile-any-or-all-p…). That one doesn't play well with Igor's external editor detection behavior, and it may not handle every text encoding option.The former is unproblematic if you choose to automatically save backups of your procedure files under a different name (like myProc_bu.ipf).

This "save before compile" behavior is standard in matlab, I believe (or at least you have no choice but to save first). I've always thought it would be nice to have an "on compile" or "before compile" autosaving option in Igor. I've personally gotten so neurotic about hitting ctrl+shift+S as soon as I finish any edit that I no longer use the on compile hook to autosave.

I ran into this old thread while looking for something else...

I just thought I would share my own solution: I use Notepad++ as an external editor and #include my code into Igor.  This required manually programming Igor's functions (by copy+pasting from the manual) into Notepad++, which wasn't too hard.

In addition to avoiding painful crashes, useful features of Notepad++ are column editing, a more reliable CTRL+Z, and auto-save.

Are you using Igor 6? Igor 7+ has multiple undo. That's what folks usually mean when they criticize Igor's undo.

As of Igor 8, there are new features to aid in using external editors, too.

And auto-save is coming to Igor 9, not yet in beta testing.

Thanks for the clarifications John.

I've really appreciated the Igor 7+ undo feature.  I think the only benefit of Notepad++ in that regard is that I can always go back and undo there, but in Igor I might have saved/switched experiments at some point, especially for shared code.

Igor 8 (or 7?) feature of reloading external code is also really useful.

Sometimes I'll also avoid saving when I have a huge experiment file or am working on a remote server.  Hopefully Igor 9 can auto-save procedures separately from the whole experiment. 

Quote:
Hopefully Igor 9 can auto-save procedures separately from the whole experiment

Yes, it can.

You can also save all standalone procedure files explicitly at any time by choosing File->Save All Standalone Files.