Re: Help with Spawn [message #61567 is a reply to message #42260] |
Fri, 18 July 2008 10:46  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Jul 18, 12:24 pm, "Jeff N." <jeffnettles4...@gmail.com> wrote:
> On Jul 18, 10:17 am, Vince Hradil <hrad...@yahoo.com> wrote:
>
>
>
>> On Jul 18, 8:48 am, "Jeff N." <jeffnettles4...@gmail.com> wrote:
>
>>> On Jul 18, 7:23 am, alex...@gmail.com wrote:
>
>>>> Hello everybody. My question is simple, yet I haven't found a
>>>> satisfying answer in the various guides.
>
>>>> I'm using spawn to call for an executable file under the Windows OS,
>>>> it oppens a command window and executes there. The problem is, very
>>>> quickly I get an error and the entire command shell closes
>>>> momentarily. I'd want to be able to see the error it presents before
>>>> closing the shell, or just leave it open.
>
>>>> Is this possible? Is there any other way around it?
>
>>>> Thanks a lot for any help, Alex
>
>>> Another trick i do a lot is just print out the command that you're
>>> going to spawn using a print statement, then open up your own command
>>> window and paste in that command. The command shell isn't going to
>>> close when you do that, and I often find it's easier to fix whatever
>>> mistakes i've made with the command i'm trying to issue in the actual
>>> command window then go back to my IDL program and make sure it spawns
>>> the fixed command.
>
>>> Jeff
>
>> How about using the LOG_OUTPUT keyword? Simple is good...
>
> I've actually had that keyword not work for me a few times. It's
> always been when the program i've tried to spawn was not an OS command
> (e.g., dir, cd, etc.), and i think it was also a program where the
> output wasn't outputting one line of text for each iteration but
> rather doing a sequence like print output/clear screen/print output/
> etc....
>
> This was a long time ago and a minor issue so i just did the cut-and-
> paste-the-spawn-string trick i mentioned earlier and then moved on :)
> It would be good to know, though, if this is something anyone else has
> run into...
It works for me:
IDL> cd, 'c:\temp'
IDL> spawn, 'dir', /log_output
Volume in drive C has no label.
Volume Serial Number is 8C6A-7ADD
Directory of c:\temp
07/01/2008 11:23 AM <DIR> .
07/01/2008 11:23 AM <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 12,076,867,584 bytes free
IDL> print, !version
{ x86 Win32 Windows Microsoft Windows 7.0 Oct 25 2007 32 64}
|
|
|