RE: similiar to opening a csv file in default program

2006-07-10 Thread Jeff Young
Welcome. Just wish I could find you the good version of that, but it seems to have disappeared from my archives. The good version of it used named pipes instead of a disk file. I resorted to named pipes in the end because GetTempPath would fail on some (10%) of the server systems I encountered

Re: similiar to opening a csv file in default program

2006-07-10 Thread Stephen Posey
Rich Cooper wrote: snipz Does anyone have a way to determine whether the file HARBOR.TXT has been released for reading after being completely written? I would be able to fix this problem by replacing the Sleep(500) with a loop that tests till the HARBOR.TXT file is ready for reading, having

Re: similiar to opening a csv file in default program

2006-07-09 Thread Rich Cooper
Stephen Posey wrote: Rich Cooper wrote: Thanks Stephen, I found a web page with a similar snippet, and so I was able to get the following to work in my OnFormCreate handler: D := GetStartDir; ShellExecute( 0, 'open', PChar('command.com'), PChar('/c '+'ipconfig/all

Re: similiar to opening a csv file in default program

2006-07-09 Thread Rich Cooper
I managed to set a flag, then loop on exceptions with a LoadFromFile) until there was no exception, and that seems to solve the problem! Thanks Sid, Rich Sid Gudes wrote I haven't tried this, but probably what you can do is try to open the file exclusively (fmShareExclusive). If it is in use

Re: similiar to opening a csv file in default program

2006-07-09 Thread Rich Cooper
Lovely! Thanks, Jeff -Rich Jeff Young wrote Rich, Thought I'd chime in with code that I've used for the very same process. It worked on D7... HTH. unit Process; interface uses Classes, Windows, SysUtils; function ExecuteWait(Path, Command, Params: String; ShowWindow: Word;

Re: similiar to opening a csv file in default program

2006-07-08 Thread Stephen Posey
Rich Cooper wrote: Thanks Stephen, I found a web page with a similar snippet, and so I was able to get the following to work in my OnFormCreate handler: D := GetStartDir; ShellExecute( 0, 'open', PChar('command.com'), PChar('/c '+'ipconfig/all harbor.txt'),

Re: similiar to opening a csv file in default program

2006-07-08 Thread Sid Gudes
I haven't tried this, but probably what you can do is try to open the file exclusively (fmShareExclusive). If it is in use by DOS, then the open should fail. Once DOS finishes and closes the file, the open should succeed. So something like this: waiting := 100; repeat try fs :=

Re: similiar to opening a csv file in default program

2006-07-06 Thread Rich Cooper
Thanks Wim! I finally got it figured out. -Rich Wim Sterns wrote --- Rich Cooper wrote: I'm trying to pipe a DOS command to a file using a ShellExecute, but it doesn't create the output file. Here's the Rich, try pchar('d:\harbor.txt'),nil,pchar('d:\') Wim code:

Re: similiar to opening a csv file in default program

2006-07-06 Thread Stephen Posey
Rich Cooper wrote: I'm trying to pipe a DOS command to a file using a ShellExecute, but it doesn't create the output file. Here's the code: var D : string; ... D := GetStartDir; ShellExecute(0,pChar('ipconfig/all '),pchar('harbor.txt'),nil,pChar(D),SW_SHOWNORMAL); ... but no

Re: similiar to opening a csv file in default program

2006-07-06 Thread Rich Cooper
Thanks Rob, But actually, I did get one to work. It finally gelled for the following code in my OnFormCreate handler: D := GetStartDir; ShellExecute( 0, 'open', PChar('command.com'), PChar('/c '+'ipconfig/all harbor.txt'), nil, SW_HIDE ); Waiting := 100;

Re: similiar to opening a csv file in default program

2006-07-06 Thread Rich Cooper
Thanks Stephen, I found a web page with a similar snippet, and so I was able to get the following to work in my OnFormCreate handler: D := GetStartDir; ShellExecute( 0, 'open', PChar('command.com'), PChar('/c '+'ipconfig/all harbor.txt'), nil, SW_HIDE );

Re: similiar to opening a csv file in default program

2006-07-05 Thread Rich Cooper
I'm trying to pipe a DOS command to a file using a ShellExecute, but it doesn't create the output file. Here's the code: var D : string; ... D := GetStartDir; ShellExecute(0,pChar('ipconfig/all '),pchar('harbor.txt'),nil,pChar(D),SW_SHOWNORMAL); ... but no file named 'harbor.txt' gets