X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 27 Mar 2024 01:04 PM by  Ben Castellani
LOST of History commands
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Gustavo



New Member


Posts:
New Member


--
14 Oct 2012 07:04 PM
    Hi, do someone know how to recovery the IDL command history when windows shut-down for updates installation? I left my computer running a process that takes a long time during the night, but next morning I realized windows restart the computer and with it all my commands of my last session. Thanks for any clue, Gustavo

    Deleted User



    New Member


    Posts:
    New Member


    --
    25 Oct 2012 03:38 PM
    Hi Gustavo, There are two ways: 1- RECALL_COMMANDS function returns a string array containing the entries in IDL’s command recall buffer. 2- Go to the following hidden directory (under Windows for example) where you will find the file "history": C:\Documents and Settings\\.idl\idl\rbuf\ where is your user name. I hope this helps!. Cheers. Fernando Exelis VIS

    Darrell Smith



    New Member


    Posts:1
    New Member


    --
    18 Jun 2019 08:53 AM
    Hi, I know this is an old thread, but I have the same problem (often) as the original poster and the suggested solution does not address the problem.
    When Windows reboots with the IDL Workbench still active, ALL commands issued at the workbench console since the last startup are lost. They ARE NOT saved in the recall command buffer. This is a very annoying and costly problem with the Workbench, which seems to only flush the recall buffer to the history file when gracefully exiting the Workbench.
    Is there a Workbench setting or method to force a recall buffer write to permanent storage each time a command is entered?
    Thanks for any help.

    Ben Castellani



    Basic Member


    Posts:129
    Basic Member


    --
    27 Mar 2024 01:04 PM
    Unfortunately there isn't a way to force the command history into the default IDL history file on demand. It only saves the current command history buffer when IDL closes gracefully.

    However, you can use the RECALL_COMMANDS function to manually save the contents of the session's active command buffer to a (separate) file. You could create a custom routine procedure that can be called anytime you want to export your command buffer. Something like this:

    PRO exportCommandHistory
    fName = 'command_history.txt'
    openw,unit,fName,/GET_LUN
    printf,unit,RECALL_COMMANDS()
    free_lun,unit
    print, 'Command History Saved to File: '+fName
    END

    If you want to automate this saving of the buffer, you could set it up inside an asynchronous TIMER block: https://www.nv5geospatialsoftware.com/docs/TIMER.html

    Something like this:

    PRO exportCommandHistory, id,userData
    fName = 'command_history.txt'
    openw,unit,fName,/GET_LUN
    printf,unit,RECALL_COMMANDS()
    free_lun,unit
    print, 'Command History Saved to File: '+fName
    END

    id = Timer.Set(300, 'exportCommandHistory',/REPEAT) ;command history exported to file every 5 minutes (300 sec)

    If you want the history saving timer to be running in the background every time you launch IDL, you may consider adding it to your IDL startup script, which I think should work but I haven't tested that.

    Finally, instead of writing to a custom output file, you could instead write to IDL's default history file (~\.idl\idl\rbuf\history). This has not been tested and could possibly corrupt your history file. Use with caution.
    You are not authorized to post a reply.