Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove all images from my Project 1

Status
Not open for further replies.

Koen Piller

Programmer
Jun 30, 2005
841
NL
Hi,

Is there a procedure around which will remove all the images I have added to my project?
Presently if I want to remove an image I need in the projectmanager:
1) select the image 2) click remove 3) click confirm
It would help to remove 100+ images in one go and rebuilt the project, VFP is smart enough to add the than missing images in the project.

Thanks

Jockey(2)
 
Code:
Clear
For Each loFile in _vfp.ActiveProject.Files 
   If loFile.Type="x" AND Justext(loFile.Name)="bmp"
      ? "remove ",loFile.Name
      loFile.Remove()
   Endif
EndFor

Caution: Filetype "x" alone is the file type for all "Other" files, not only for pictures, so you need to check fileextensions. You can of course expand to check for gif, png, etc.

Instead of loFile.Remove() you might also call loFile.Exclude() to keep the reference in the project but exclude it from compilation into the EXE, that may even be better, because if a button references an image you remove, it will be readded to the pjx again, once you compile. Excluding it will keep it in the pjx but not let it go into the EXE, of course, enabling you to put other pics outside of the EXE to be used, if found within SET('PATH').

Bye, Olaf.
 
Forget about the last paragraph, you want to let the project manager add in all the really needed pics, so it'll be fine to remove all the pics.

In a more extreme try, you may restart with a new empty pjy, only adding main.prg and then compile to let it auto-add just the needed files. But that also may add too few files, libs etc.

Bye, Olaf.
 
Here's another approach:

1. Create a new project.

2. Open the old project alongside the new.

3. In the old project, select each of the main nodes in turn (Forms, Reports, Programs, etc. - but not Other Files).

4. Drag each of the nodes in turn to the new project (it doesn't matter which tab is selected in the new project).

5. Delete the old project and rename the new.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Good Mike,

and what I learned from wOOdy and I think relearned from you, you can also drag in any amount of files from windows explorer to a project manager, and files are put into the tab they belong to.

Unfortunately that doesn't work with folders, otherwise you could add all folders except an "images" folder to a new project in one drag&drop operation.

Bye, Olaf.
 
Olaf,

Very good!
Now together with an rocedure from Mike and VFP rebuilt everything clean and need.
Danke Schön,

Jockey(2)
 
I have never tried to do it this way, but it looks like it should work.

NOTE - If you try this, MAKE A BACKUP COPY of your project files BEFORE doing this - just-in-case

Code:
* --- Open the Project table ---
USE c:\temp\YourPrjFile.pjx EXCL
SELECT YourPrjFile
* --- Delete any records referencing Image files ---
DELETE FOR ".BMP" $ UPPER(name) OR ".JPG" $ UPPER(name)
PACK
USE

In that way you SHOULD BE able to remove references to the image files from the Project.

Then a Re-Build of the Project will restore any image files that are referenced in current Forms, etc.

Good Luck,
JRB-Bldr
 
Olaf,

and what I learned from wOOdy and I think relearned from you, you can also drag in any amount of files from windows explorer to a project manager, and files are put into the tab they belong to.

That's right. In fact, I do that quite often, when starting new projects that share components with existing projects.

By the way, this is not particularly relevant, but I once wrote a utility that compares the images used in an application with thsoe that are present in the project; it then gives a report of any images that are unused, and any that are used but missing. If anyone would like a copy, you can grab it from here:

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike,

Yes your procedure is indeed relevant in this respect, I have even mentioned it, at least I was trying to refer to it, but with my typo you have probably overlooked.
Meanwhile I have added Olaf's procedure to your KeepingTrack, an indeed very usefull combination.

Thanks again for sharing!

Regards,

Jockey(2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top