2

I'm very new to IDL (trying to do a POC for someone using it) and I am trying to run an external command. The line of code I have added is this:

spawn, 'C:\Program Files\ITT\IDL\IDL80\products\envi48\save_add\visual.exe'

I thought this was all that was needed to launch an external command. When I run the app, i can use the debugger to step through the code, and when I get to this line and Step over, my executable does not run. I see no messages in the debugger indicating any type of error.

I put the file visual.exe in the directory and can run it by hand with no issues. It just seems to step right over the code without executing it or reporting any error.

Paul Hiemstra
  • 59,984
  • 12
  • 142
  • 149
Brett McCann
  • 2,469
  • 2
  • 27
  • 44

2 Answers2

3

You can use the form:

spawn, cmd, result, errResult

to get the any error messages that might be generated from the cmd. In your particular case, I think you need to quote the path to the executable because of the space in the path.

mgalloy
  • 2,356
  • 1
  • 12
  • 10
  • I do have single ticks. Isn't that sufficient? – Brett McCann Sep 19 '11 at 13:23
  • 1
    The single quotes are for IDL. IDL will pass that string directly to the OS, which will get confused because of the space in the path. I think you need something like: spawn, '"C:\Program Files\ITT\IDL\IDL80\products\envi48\save_add\visual.exe"' – mgalloy Nov 08 '11 at 19:31
2

Your usage of the spawn command is correct. Perhaps visual.exe is exiting prematurely for some reason (for example, maybe the working directory when run via spawn isn't what your external program is expecting.)

You might try writing a little script that starts visual.exe, then does a pause, and then spawn the wrapper script instead of visual.exe directly. That might give you a chance to see any error messages before the DOS window disappears.

Jim Lewis
  • 43,505
  • 7
  • 82
  • 96