BeSly Software Solutions About yab About us Admin




Name:

attribute get$ -- Get the string value of an attribute.

Synopsis:

Value$ = ATTRIBUTE GET$ Name$, Filename$
  Get the string value of the attribute Name$ for file Filename$.
  For "Bool" type attributes:
  Value$ ="true|false"
  To get a list of attribute names and their types separated by " | ": 
  Name$ = "" 
  To get  the current program directory:
   Name$ = "" and Filename$= ""

Description:

Gets the string value of an attribute, or the list of attributes attatched to a file, or the directory that the program was executed from.

If the attribute is a bool type, the string returned is "true" or "false"

If the attribute name is "" a list of attributes attatched to the file is returned.

if both the attribute name and filename are "",  the current program directory is returned.

Example:

dir$ = attribute get$ "",""
dir$=dir$+"/"

attribute set "string","attribute1", "This is the first attribute,", dir$+"foobar"
attribute set "int","attribute2", "127", dir$+"foobar"
attribute set "bool", "attribute3", "false",  dir$+"foobar"
a$=attribute get$ "", dir$+"foobar"
print a$
a$=attribute get$ "attribute1",  dir$+"foobar"
print "attribute1 \""+a$+"\""


Output:

attribute1 | String | attribute2 | Int | attribute3 | Bool | 
attribute1 "This is the first attribute."


Explanation:

This program uses attrribute get$ to find the program directory, then saves three attributes to the file foobar located in the program directory. Next it gets and prints a list of the attribute names and types associated with the file, then it prints the contents of attribute1.


Related: attribute clear, attribute set, attribute get