quick and dirty settings
#6
(07-08-2015, 06:12 AM)lelldorin Wrote: yes jan add attribute Support past my asking about it, but he include a limitation of signs to store into it (can be that bbjimmy solve this already) so i use the system attribut tool. this one stores without limutation? i dint know but more then 4 signs.

my project buildLOG uses attributes too and there i store Informations out of textcontrols and textedits

I made the attribute commands more user friendly:

Name:

attribute set -- sets ( adds or overwrites ) an attribute of a file.


Synopsis:

ATTRIBUTE SET Type$, Name$, Value$, Filename$
Set the attribute Name$ of type Type$ for the file Filename$ with the string Value$.
These are valid types:
Type$ = "String|Int|Long|Double|Float|Mime|Bool"
For Bool type attributes:
Value$ = "true|false"

Description:

Attribute set sets, adds or overwrites, file attributes. The attributes can be strings, integer, long.double, or float numbers, or boolian true/false.

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.



Name:
attribute get -- Get the number value of the attribute.

Synopsis:

Value = ATTRIBUTE GET Name$, Filename$

Description:

Value = ATTRIBUTE GET Name$, Filename$
Get the number value of the attribute Name$ for file Filename$.
For "Bool" type attributes:
Value = 1|0

Example:

attribute set "bool","Saved", "false", "foobar"

if (attribute get "Saved","foobar") then
print "foobar is saved"
else
print "foobar is not saved"
end if

Explanation:

This example saves a false (0) attribute named Saved on the file "foobar" then checks to see if the Saved attribute is true(1) or false(0) and prints the result. in this case "foobar is not saved."


Name:
attribute clear -- Deletes an attrinbute from a file.

Synopsis:
attribute clear Name$, Filename$

Description:

Delete the attribute Name$ from file Filename$.
Reply


Messages In This Thread
quick and dirty settings - by clasqm - 07-05-2015, 06:55 PM
RE: quick and dirty settings - by lelldorin - 07-07-2015, 01:48 PM
RE: quick and dirty settings - by bbjimmy - 07-07-2015, 02:33 PM
RE: quick and dirty settings - by clasqm - 07-08-2015, 04:59 AM
RE: quick and dirty settings - by lelldorin - 07-08-2015, 06:12 AM
RE: quick and dirty settings - by bbjimmy - 07-08-2015, 11:05 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)
Free Web Hosting