13.07.2015 Views

Macro Guide - Esker

Macro Guide - Esker

Macro Guide - Esker

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GetAttry% = x * 10Put #1,x,yNext xCloseOpen "test.dat" For Random Access Read As #1For y = 1 to 5Get #1,y,x%mesg = mesg & "Record " & y & ": " & x% & Basic.Eoln$Next ySession.Echo mesgCloseEnd SubSee Also Drive, Folder, and File Access on page 3GetAttrSyntaxGetAttr(pathname)DescriptionReturns an Integer containing the attributes of the specified file. The attribute value returned is thesum of the attributes set for the file. The value of each attribute is as follows:Value Constant Includes0 ebNormal Read-only files, archive files, subdirectories, and files with no attributes1 ebReadOnly Read-only files2 ebHidden Hidden files4 ebSystem System files9 ebVolume Volume label16 ebDirectory Subdirectories32 ebArchive Files that have changed since the last backup64 ebNone Files with no attributesTo determine whether a particular attribute is set, you can And the values shown above with the valuereturned by GetAttr.If the result is True, the attribute is set, as shown below:Dim w As Integerw = GetAttr("sample.txt")If w And ebReadOnly Then Session.Echo "This file is read-only."ExampleConst crlf = Chr$(13) + Chr$(10)Sub MainIf Not FileExists("test.dat") ThenOpen "test.dat" For Random Access Write As #1CloseEnd Ify% = GetAttr("test.dat")281

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!