comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » launch a file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
launch a file [message #91968] Wed, 23 September 2015 14:38
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
I wanted to be able to launch any file (e.g. a .pdf or .pptx file) from IDL, in the same way that the OS or a browser does. The program file_launch.pro at

http://idlastro.gsfc.nasa.gov/ftp/v84/file_launch.pro

will do this (e.g. IDL> file_launch,'test.xlsx' ). It first tries to use the
Java desktop class
https://docs.oracle.com/javase/tutorial/uiswing/misc/desktop .html
and if this fails, it spawns to the appropriate launch command for the oS.

if !VERSION.OS_NAME EQ 'Mac OS X' then spawn,'open "'+ file +'" &' else begin
case StrUpCase(!Version.OS_Family) OF
'WINDOWS': spawn, 'start "" "'+ file +'"', /nowait
'UNIX': spawn, 'xdg-open "'+ file +'" &'
else: print, 'Unable to launch ' + file + ' automatically.'
endcase
endelse

Two questions:

1. Is there an existing method within IDL to do this? I'd rather not pollute the IDL namespace with a new program, if there is already a way to open files.

2. I would be interested to know if the program fails on some IDL Version/OS combination. I've only tested it on the 3 machines I have access to.

--Wayne
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Error in IDL-Python Bridge
Next Topic: White and black colours appearing when selecting colour table

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:31:49 PDT 2025

Total time taken to generate the page: 0.00412 seconds