RE: Path pitfalls....
- Posted by Patrick.Barnes at transgrid.com.au Nov 26, 2002
- 442 views
No dice, it IS the "> bin\\export1.html" that's the problem. Also, does the program halt until the shellExecute is finished? If it doesn't, then that is going to cause problems too. Qs: --- 1. How to redirect stdout in the windows environment? 2. How to make the eu program wait until php.exe is finished? ============================================== _______<-------------------\__ / _____<--------------------__|=== | |_ <-------------------/ \__| Patrick Barnes -----Original Message----- From: Derek Parnell [mailto:ddparnell at bigpond.com] Sent: Tuesday, 26 November 2002 10:51 To: EUforum Subject: Re: Path pitfalls.... Try using shellExecuteEx instead... shellExecuteEx( object verb, sequence file, object parms, object defdir, atom style, atom struct) shellExecute("open", "bin\\php.exe > bin\\export1.html", "bin\\Cat.php", 0, SW_SHOWNORMAL, 0) Or maybe its the stdout redirection causing it. On Tue, 26 Nov 2002 10:02:54 +1100, <Patrick.Barnes at transgrid.com.au> wrote: > > Damn, and I thought I'd figured it out, too. > > I got rid of all my system calls, and used shellExecute, but it didn't > quite work. No doubt I'm making a mistake somewhere. > > This is my code for one php file. > ----------------------------------------------------------------- > --run the php script Cat, and output the results into export.html > shellExecute("open", "bin\\php.exe bin\\Cat.php > bin\\export1.html", > SW_SHOWNORMAL) > > --open export.html as read, and the other two files as write. > s = open("BIN\\export1.html","r") > d1 = open("Tier 3 Apps by Category.html","w") > d2 = open("Tier_3_Apps_by_Category.asp","w") > > --strip out the top two lines. > line = gets(s) > line = gets(s) > > --Copy the rest across to the destination files > --read a line in. > line = gets(s) > while sequence(line) do --while the source file does not end... > puts(d1, line) --output that line to d1 > puts(d2, line) --and d2 > line = gets(s) --and get a new line > end while > > --close those files > close(s) > close(d1) > close(d2) > ------------------------------------------------------------------- > The other half of the program is almost identical. > I thought it was working fine, but it turns out that the shellExecute > command doesn't do anything. What am I doing wrong? > ======================= > Patrick Barnes > Information Systems Group > 201 Elizabeth St, Sydney > Patrick.Barnes at tg.nsw.gov.au > Ext: 91-3583 > Ph:(02) 9284-3583 > Mob: 0410 751 044 > > -----Original Message----- > From: Derek Parnell [mailto:ddparnell at bigpond.com] > Sent: Tuesday, 26 November 2002 09:07 > To: EUforum > Subject: Re: Path pitfalls.... > > > Patrick, > I did some quick research and discovered that even though the API docs > say you need a parent window, you can get by with out one for > shellExecute. So if you'd like to do a small mod on the win32lib.ew > file.... > > Find the shellExecute routine and change the lines ... > > warnErr("shellExecute requires a WinMain()") > return 0 > > to ... > hWnd = 0 > > And this should then be able to be used without a Main Window. > > As another idea, you might like to get the current directory and prepend > it to the file name before you try to execute it. > > > On Tue, 26 Nov 2002 08:36:51 +1100, <Patrick.Barnes at transgrid.com.au> > wrote: > >> >> Hmmm, I tried that. >> >> It doesn't want to run system() after I've changed the directory. >> >> On this line: >> system("php.exe Cat.php > export.html", 0) >> >> It puts out to screen this error message: >> CMD.EXE was started with '\\fp-ho1-pr\HO_Share\Tier 3 Database' as the >> current >> directory path. UNC paths are not supported. Defaulting to windows >> directory. >> >> What's the win32 equivalent for system? >> >> I tried using shellExecute("open", "bin\\php.exe bin\\Cat.php > >> bin\\export.html", >> SW_SHOWNORMAL) >> >> but apparently it won't work without a winMain call. I don't want one, this >> is a script, not an application. >> >> ======================= >> Patrick Barnes <snip> -- cheers, Derek Parnell *********************************************************************** "This electronic message and any attachments may contain privileged and confidential information intended only for the use of the addressees named above. If you are not the intended recipient of this email, please delete the message and any attachment and advise the sender. You are hereby notified that any use, dissemination, distribution, reproduction of this email is prohibited. If you have received the email in error, please notify TransGrid immediately. Any views expressed in this email are those of the individual sender except where the sender expressly and with authority states them to be the views of TransGrid. TransGrid uses virus scanning software but excludes any liability for viruses contained in any attachment. Please note the email address for TransGrid personnel is now firstname.lastname at transgrid.com.au" ***********************************************************************