Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copying a project and its files
Message
De
28/03/2004 14:32:09
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00890266
Message ID:
00890281
Vues:
25
>When I issue a
>use MyProject.pjx
>And browser the table, am I seeing a comprehensive list of all files in the project?

Yes. You can also get the files using a project object, known as a project hook. VFP 6 or later.

>Also, some files are marked for deletion. Will I damage the project by packing this
>table?

No; in VFP, deleted records are considered deleted. Manually packing the project with:
use MyProject.pjx
pack
should be equivalent to selecting the "Pack" option from the project menu.

Better don't trust my word on this; it is always a good idea to makea backup of critical files before trying something new.

Regards,

Hilmar.

P.S.: Here is some sample code I wrote a while ago, to modify all files in a project. It is written as a class; change the "Action" method to do whatever you wish with the files.
clear all	&& close class libraries.

set procedure to vfxfunc	&& for GetArgCount() and GetArg().

CreateObject("cMyProjectLoop")

DEFINE CLASS cMyProjectLoop as cProjectLoop
	cFileFilter = "report"
	lIncludeOrExclude = "I"
ENDDEFINE

* Loop some action for selected files in a project
DEFINE CLASS CProjectLoop as Custom
	cType = "K"		&& K = form. May be overwritten in inherited class.
	cFileFilter = "report;batch;vfx"	&& files to include or exclude
	lIncludeOrExclude = "E"				&& determines usage of .cFileFilter
	oFile = NULL
	FUNCTION INIT
		set exact off
		local lnFileCount, llInclude, lnI
		lnFileCount = Application.ActiveProject.Files.Count
		FOR EACH This.oFile IN Application.ActiveProject.Files
			if This.oFile.Type = This.cType
				llInclude = (This.lIncludeOrExclude = "E")
				for lnI = 1 to GetArgCount(This.cFileFilter)
					if upper(justfname(This.oFile.Name)) = upper(GetArg(This.cFileFilter, lnI))
						llInclude = (This.lIncludeOrExclude # "E")
						exit
					endif
				next
				if llInclude
					This.Action()	&& Action to be performed on each file
				endif
			endif
		ENDFOR
		This.oFile = NULL
	ENDFUNC

	FUNCTION Action
		* Action to be performed on each file.
		* Default action: modify file. May be overwritten.
		This.oFile.Modify()
	ENDFUNC
ENDDEFINE

*!*	Codes for file types:
*!*	d	Database
*!*	D	Free Table
*!*	Q	Query
*!*	K	Form
*!*	R	Report
*!*	B	Label
*!*	V	Visual Class Library
*!*	P	Program
*!*	L	FLL
*!*	Z	APP
*!*	M	Menu
*!*	T	Text
*!*	x	Other
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform