9199 Rate this article:
No rating

Where am I?

Well, more accurately, "where on the filesystem is the source for the currently scoped routine?", but that's not a catchy title. In IDL 8.2.2, the ROUTINE_FILEPATH function was modified to return this information when called without any parameters. Here's a simple program demonstrating this behavior:
pro routine_filepath_no_params
   compile_opt idl2

   print, 'I''m called from a program in the file: ' + routine_filepath()
When I run this program, I get:
IDL> routine_filepath_no_params
I'm called from a program in the file: /home/mpiper/VIS/IDL/8/22/demos/src/routine_filepath_no_params.pro
Jim Pendleton, for example, has found this helpful in determining whether a program is being run from a SAVE file or a PRO file. I've used it to save a visualization to a PNG file with the same base name as the PRO file in which it's generated. (This is, I think, my last 8.2.2 post before 8.2.3 comes out next week!)