1 (edited by MarkoS 2020-06-16 06:53:13)

Topic: Deleting files in gallery and storage

Related to previous post of Derek:
http://myvisualdatabase.com/forum/viewtopic.php?id=6355
Hi, Derek,
Deleting files from gallery and storage works OK in my project.
But if I add reports (printing) it stops working.
I have a "Print all" at Form1 and "Print record" at Form2.
I can get nice print reports but there is no more possibilities to delete files in gallery and storage. I tried to use both ways for printing: REPORT and REPORT SQL, but no success.
Something during the Report process bothers deleting files or I am doing something incorrect.
Can someone show how should looks like the Derek's  project filedelete2 with Print all and print record included?

Re: Deleting files in gallery and storage

Hi Markos,
I can't think how attaching reports might affect the photo/file deletion process.
Are you printing out the actual photos and files or just the links?
Can you attach your project and I'll try and have a look?
Derek.

Re: Deleting files in gallery and storage

In both reports ("print all "at form1 and "print record" at form2), I am printing out only photos from Form2.DBImage1.
No any file from storage is included in printing.

Re: Deleting files in gallery and storage

I can't think why it should stop working if all you've done is add some reports.
Can you attach your project?

Re: Deleting files in gallery and storage

Hi, Derek,
I will attach my project. I just need time to edit and simplify it.
It’s pretty messy right now.
Another interesting fact: when I delete both print-buttons, everything works properly.  It is possible to delete the selected file in the gallery and storage.

6 (edited by derek 2020-06-17 11:08:41)

Re: Deleting files in gallery and storage

Hello MarkoS,
To get the images to display on a report that I added, I had to specify the full path in the 'copy to' option (see screenshot1 and screenshot2). 
So having had to do that, I was able to simplify the script at the same time (and also correct a bug that I found - my bad!).
Perhaps you could try this new code in your project and see if it fixes your earlier problem?
Obviously, you'll need to change the full paths in the 'copy to' properties to point to where you intend to store your images and files.
Derek.

Post's attachments

Attachment icon filedelete2a.zip 686.43 kb, 243 downloads since 2020-06-17 

Re: Deleting files in gallery and storage

Hi, Derek,
Is that means the exe will   be working on one PC only, because the path to file is different for other PC?

Re: Deleting files in gallery and storage

MarkOS,


I've just happened along before Derek,  so long as, you have a similar file structure on the other PC, the script should work.


In other words so long as the exe file has the 'gallery' and 'storage' folders in the same place the code will work.


What won't work would be if you store the photos in another folder/directory on the other PC.


The  (extractFileDir(application.exename) function will always look for folders in the folder where the exe file is.

On a clear disk you can seek forever

Re: Deleting files in gallery and storage

Unfortunately, as expected, it does not work on another computer.
It works only in my computer if the file link is:
C:\Users\Marko\Desktop\filedelete2a\gallery\
On another computer cannot save anything to file "gallery" and "storage", using the same file link.
Any suggestion?

10

Re: Deleting files in gallery and storage

MarkOs,


It looks like I misunderstood your original post. You will need to either use the Windows Public folder to store your images  or make a folder off of your program exe folder.


I'm assuming the other PC does not have the file path C:\Users\Marko\   your alternatives are:

Have a path such as C:\some_folder\filedelete2a\gallery\ or write code to convert your links to equivalents on another PC.


The 'User' folder in Windows tends to be set to 'read only' so is not always a good place to store files.


Depending on your program and how you wish to deploy it it may or may not be worth the extra work in writing code to find the current_user_path and then convert your link by substituting your C:\Users\MarkOS to C:\Users\some_other_person.


Personally I would make a folder in a neutral part of the drive (that is any path but one that contains your user name) and the link will always be the same on any PC.


You would need to put into your script something like the following:

CONST
DIR = 'c:\filedelete2a\gallery\'

procedure gallery;
begin

ForceDirectories(DIR);

end;

That would need to be called in your forms'  'ON SHOW ' event or you could just place the code  ForceDirectories(DIR) straight into it and not call a procedure.

On a clear disk you can seek forever

11

Re: Deleting files in gallery and storage

I think this post (in Russian) may have another answer for you and will solve your problem.

http://myvisualdatabase.com/forum/viewt … 076#p37076

On a clear disk you can seek forever