Just a small question (I hope). I would like to be able to check from NAV if a certain file is read only or not.
I tried to fix something with a file variable and with the file table. But I can’t figure out to read the attributes of the file.
not sure if this really works but we often use the rename function to check if a file is already completly written. As in
if rename(filename,filename) then
fileispresent := ok;
maybe you can use this also for your problem?
Ok, got it…
This is how you do it:
You need the following variables:
- FileSystemObject: Automation - ‘Microsoft Scripting Runtime’.FileSystemObject
- MyFile: Automation - ‘Microsoft Scripting Runtime’.File
- MyAttributes: Integer
IF ISCLEAR(FileSystemObject) THEN
MyFile := FileSystemObject.GetFile(Filename);
MyAttributes := MyFile.Attributes;
IF (MyAttributes MOD 2 <> 0) THEN
I found the info here
Thanks for the input but I wanted to show the readonly attribute in a form. So creating an error was not an option. But I think I found it.