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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access report file in another folder? 2

Status
Not open for further replies.

Mandy_crw

Programmer
Jul 23, 2020
585
PH
I have the executable, tables, reports and almost everything needed to run the my application in the same folder.. but i want to create a folder separating images used and reports, the creation of folder is easy… my question is, if i create a folder, i dont know how will i access the image folder and the reports folder… how would i specify the path? please help…
 
I don't really know how to answer that. A path is a string, like C:\path\to\some\directory. There's nothing special about it. If you create subfolder you just have one directory level more, as in C:\path\to\some\directory\subdirectory. There's nothing special or hard about this.

Also, everything you build into your EXE is found there, no matter, if you have it in different paths in the project. I do like to have my project files organized in folders also in Windows explorer, but you can argue that no matter how cluttered a single project folder is, the project manager is having all the different sections anyway.

And there is surely only very rarely a reason to exclude things from your EXE.

On top of that as a helper: You have already read about SET PATH, just very recently from me. You can add many paths there for VFP to look for files, just like the DOS %PATH% environment variable helps dos to find any EXE or other files in the many paths the %PATH% variable holds. See SET PATH in the documentation, please and pay attention to the ADDITIVE clause.

Chriss
 
Another topic: Setup.

If you want to have subfolders in a setup, Installshield Express allows you to do that within a setup project. Since the installation directory is by default readonly, you also won't create subfolders in the installation directory by the EXE when it runs after the installation, but the setup itself should already create these installation directory subfolders once and for all installation files you want to organize in folders as you like.

It's similar when you're using other installer products and if you provide your application to employees of a company by a copy process, well, you copy a folder structure.

Chriss
 
Hello Mandy. Hope I have understood your enquiry.

I understand that your application produces an .exe file. And that when you run this as a ‘live’ program - so not within the VFP development environment – you would like the report definition(s) - files ending .frt and .frx - to exist in a sub-folder of the HOME folder where your application (.exe) started.

I believe that I have a similar set up.

My application starts from a file main.prg -which eventually starts the main screen which eventually lets you fire up the other forms which make up the application.

One of the early statements in main.prg is (effectively):

Code:
SET PATH TO REPORTS, REPLOCAL

(I let the user modify some reports, and these are kept in REPLOCAL). In fact the application uses a framework provided by Mike Lewis (another contributor to this TekTips chat-room). I hope it is not a piece of unashamed advertising to suggest that you visit his website, and you may be able to obtain a sample main.prg as part of a framework to run your application.

HTH Andrew

 
If Andrew has the right idea about why you want reports in a subfolder. Then my second post about setup also is right, but more important is you have to exclude reports you later want to refer to in the EXE as external report files. That enables what Andrew says:
Andrew Mozley said:
let the user modify some reports, and these are kept in REPLOCAL

I have the feeling that your major problem is that. Because when you still keep reports as included in the build of an EXE, it won't matter if you address them with a relative or absolute path where they are outside of the EXE at runtime, the VFP runtime will always look for an FRX within the EXE first and use that. So enabling usage of external reports means first excluding them from the build.

You're also talking about images and more, though. So I think I have not yet understood your whole problem. Images you use as pictures in image controls are always also embedded/included in the EXE. It's actually harder to exclude images, as simply using them on your form at design time, they will become part of the project and part of the exe, even if you don't just exclude them from the build but remove them from the project manager, a build adds them back to the PJX, because that's VFPs automatism to keep all necessary files in.

So, for example using different images as different branding or different looks/themes/skins, maybe even images with texts in different languages for internationalization have to be coped with on more than the decision to include them in the PJX files and include or exclude them in a build. For the ability to use images dymically depending on settings, you can't even specify an image at designtime, the controls that should load different image versions depending on configuration of theme or language must be set at runtime, ie you couldn't set Picture properties while you design, but have to set them when a form is started.

Well, you could have default images used at design time, like you could write all English texts to labels and headers and button captions, etc, but at runtime in initialization you of course need to change them. And then they must have different names as the default images with their names become part of the EXE. And that would also mean even if you reconfigure to some setting not needing the default images of the EXE, they are still in there. So a full separation needs design without graphics and instead set those at runtime, which makes it unpractical to design something.

I don't think you're aware of how this works with most other programming languages, where there are resource DLLs that can contain images and also texts and you could easily organize the internationalization by compiling a DLL for every language, that's not the case with VFP, the specific type of DLLs defined by Windows does not work with VFP controls picture properties. They are always set to image file names, and those are then first looked for within the EXE and only if no image of that name is embedded images on HDD are used.

Chriss
 
Hi Andrew… yes you're right… i’ll try your suggestion… thanks Andrew…

Chriss thank you so much for always explaining and always giving me answers… God bless..,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top