Thanks everyone for your kind messages - Thank you! :)
Was just trying the Filerequest command and wondered if there is a way to stop / exclude some files.
Example:
I have a folder, and I am interested only in the ".dat" files.
I can filter the filerequest command to only show the ".dat" files, however I want to stop / exclude two files from being chosen or displayed.
They are "staff.dat" and "rota.dat"
The folder is called "C:\Holiday"
This is the code - how can I modify it?
SUB restorerota
filter = "Data Files (*.dat)|*.dat|Data Files (*.dat)|*.dat||"
filenames = filerequest("Backup Empolyee file",0,1,filter,"dat",@MULTISELECT, runfile)
do
pos = instr(filenames,"|")
if(pos)
filetemp = left$(filenames,pos-1)
filenames = mid$(filenames,pos+1)
COPYFILE filetemp, runfile + "rota.dat" ,cpy
endif
until pos = 0
RETURN
ENDSUB
Thanks,
Andy.
You could rename them using the System command, to staff.dtt and rota.dtt .. :)
And then rename them back again afterwards ..
Graham :)
I've been playing around for the last couple of hours and this is my conclusion:
1)The simplest solution is to do what Graham suggested and just rename the files when you enter the subroutine and name them back when you exit. Could pose problems if you are in a file sharing setup.
2)The next best is to let the user select them but then when you are processing the returned filenames trap those two "protected" files and possibly notify the User that those can't be processed.
1 and 2 assume you do not have absolute control of the pc that the program will be run on.
If you do have absolute control simply set the file attributes of the 2 files to hidden and then set the folder/view/advanced settings in windows explorer to not show hidden files. This would be the preferred way with #2 above as a hidden backup in case someone gets to messing around with those explorer settings.
Thanks Graham and Larry,
After sleeping on it I decided to do this:
1. Any backup of the rota.dat file will be saved as "somthing.rot"
2. Any backup of the staff.dat file will be saved as "somthing.sta"
Next I changed the sub routines to only look for .rot files (rota backup)
and only look for .sta files (staff backup)
This works now - attached are the sub routines.
This is a single user so there will be no file sharing issues.
Thanks,
Andy.
:)