Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Weird Exception Unknow Software error
Message
 
À
26/04/2013 03:41:02
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01571899
Message ID:
01571993
Vues:
31
>Just in case your colleague's PC has a path with embedded spaces, I'd rewrite this
>
>	lcEXE = gcPath + "\WssPost.exe" + " " + ALLTRIM(interface.ss_ip) + ":" + ALLTRIM(STR(interface.ss_port)) + " " + ALLTRIM(pharmacy_config.nabp) + " " + lcFile
>	RUN /N2 &lcEXE
>
>with something that has quotation marks around the executable
>
>	lcEXE = textmerge(["<<gcPath>>\WssPost.exe" <<interface.ss_ip>>:<<interface.ss_port>> <<pharmacy_config.nabp>> <<lcFile>>])
>	RUN /N2 &lcEXE
>
>Perhaps even quotation marks around the last parameter. For running external procedures, I prefer to stuff the command line, with all the quotation marks and full paths on any filenames, into a .bat file (a simple strtofile(lcExe, "mybat.bat") suffices) and then if it doesn't work, open the cmd.exe and run mybat.bat in it, just to see what's wrong.

I'll give it a go in a little bit........

meanwhile, this is what I discovered this morning......... after I changed the code to use ShellExecute instead...

I rewrote the code as below...
IF !DIRECTORY(gcPath + "\Surescripts")
	MKDIR gcPath + "\Surescripts"
ENDIF
lcPath = gcPath + "\Surescripts\"
lcFile = lcPath + PADL(ALLTRIM(ss_io.message_ref),7,"0") + PADL(ALLTRIM(ss_io.refill_no),2,"0") + ".REQ"
lnHandle = FCREATE(lcFile)
IF lnHandle > 0
	*TMN 03/16/09
	*TMT 04/19/13 Modified for v10.6
	FWRITE(lnHandle,lcText,5979)	&& Uses FWRITE instead of FPUTS cuz no LF CR are needed
	*FWRITE(lnHandle,lcText,5416)	&& Uses FWRITE instead of FPUTS cuz no LF CR are needed
	*FWRITE(lnHandle,lcText,5259)	&& Uses FWRITE instead of FPUTS cuz no LF CR are needed
	*TMN 03/16/09
	FCLOSE(lnHandle)

*!*		lcEXE = gcPath + "\WssPost.exe" + " " + ALLTRIM(interface.ss_ip) + ":" + ALLTRIM(STR(interface.ss_port)) + " " + ALLTRIM(pharmacy_config.nabp) + " " + lcFile
*!*		RUN /N2 &lcEXE
*TMT 04/26/13 Change from RUN to ShellExecute because the 10.6 was throwing an exception error when 4.2 did not....
*!*		lcEXE = gcPath + "\WssPost.exe" + " " + ALLTRIM(interface.ss_ip) + ":" + ALLTRIM(STR(interface.ss_port)) + " " + ALLTRIM(pharmacy_config.nabp) + " " + lcFile
*!*		RUN /N2 &lcEXE

	DECLARE LONG ShellExecute in "shell32.dll" long hwnd, string lpszOp, ;
	             	string lpszFile, string lpszParams, ;
	                string lpszDir, long nShowCmd	
	
	lcEXE = gcPath + "\WssPost.exe" 
	lcParms = ALLTRIM(interface.ss_ip) + ":" + ALLTRIM(STR(interface.ss_port)) + " " + ALLTRIM(pharmacy_config.nabp) + " " + lcFile
	ShellExecute(0,"open",lcExe,lcParms,lcPath,7)

ELSE
	MESSAGEBOX(translatewrd("Cannot create EZ e-Script text file"),16,translatewrd("EZ e-Script Create File"))
ENDIF
.... and I got the SAME ERROR result !!!

So, I figured, what is different? Originally, this code worked when I was using it with the older standard which created the textfile lcFile. This file was 5416 bytes long.

In this code, the textfile is longer, due to the new standard. The file is now 5979 bytes long.

So, the shorter file works, but the longer textfile does not. It causes the error.

So, I traced the code back to this point, and after the LONGER text file was created, I erased it and replaced it with the shorter file, but with the same name as the LONGER file, and ran it on through. NO ERROR. So, something about the length of the textfile is the problem.

Your thoughts?
Tommy Tillman A+ NetWork+ MCP
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform