Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Instance Runtime as Object ?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00753457
Message ID:
00753851
Views:
20
This message has been marked as the solution to the initial question of the thread.
If you have the runTime installed just create a project called VfpUtil (or whatever name you want) with this single .prg compile it to a dll.
Define Class VFPScript As Session OLEPUBLIC 

	Function ExecuteScript( cScript )

		Local loErr

		Try
			=ExecScript(cScript) 
		Catch to loErr
			ComReturnError(loErr.Message)
		EndTry 

	EndFunc


EndDefine 
Then, you can call it just like this:
oVfp = CreateObject("VFPUtil.VfpScript")
Text To lcScript NoShow
  OPEN DATABASE insert-full-path-to-DBC EXCLUSIVE
  PACK DATABASE
EndText 

oVfp.ExecuteScript( lcScript)
oVfp = null
HTH

>From an earlier thread I was in, it was recommended I try this once to do a PACK:
>
>oVFP = CREATEOBJECT('VisualFoxpro.Application.6')
>oVFP.DoCmd('OPEN DATABASE insert-full-path-to-DBC EXCLUSIVE')
>oVFP.DoCmd('PACK DATABASE')
>RELEASE oVFP
>
>
>That only works if the VFP6 IDE is installed on the machine, which isn't possible on a production server.
>
>I'm just wondering if it is possible (or rather, what redistributables would be needed) to do this with VFP8 now.
>
>Thanks.
Previous
Reply
Map
View

Click here to load this message in the networking platform