Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
StrToFile to create a batch file... Win98 & W2k differen
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00883093
Message ID:
00883119
Views:
16
>Thanks Sergey.
>
>Excluding the TRY/CATCH/ENDTRY, will that work in VFP6?
>
>Can i expect users running W98, XP, ME, 2k, ... to have filesystemobject available?
>
>
>
Hi Chris,

Here's a version that uses Win API and should work under any Windows version. I throw it together right now so you'll have to do some more testing.
 LPARAMETERS tcFileName, tcCase
LOCAL lcFileName, loFile, llOk, lcNewName
lcFileName = FULLPATH(ALLTRIM(tcFileName))
llOk = .T.
IF FILE(lcFileName)
	
	DO CASE
	CASE UPPER(tcCase) = "L"
		lcNewName = LOWER(lcFileName)
	CASE UPPER(tcCase) = "U"
		lcNewName = UPPER(lcFileName)
	CASE UPPER(tcCase) = "P"
		lcNewName = PROPER(lcFileName)
	OTHERWISE
		llOk = .F.
	ENDCASE
	IF llOk
		DECLARE Long MoveFile IN Kernel32 String, String
		IF MoveFile(lcFileName, lcNewName + ".TEMP") = 0 ;
			OR MoveFile(lcNewName + ".TEMP", lcNewName) = 0
			llOk = .F.
		ENDIF	
	ENDIF	
ELSE	
	llOk = .F.
ENDIF

RETURN llOk
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform