Application Data _ AfraLISP
Application Data _ AfraLISP
Site Map
Search
AutoLISP
Beginners' Tutorials
Intermediate Tutorials
Advanced Tutorials
Application Tutorials
Tips'n'Tricks
Visual LISP
Beginners' Tutorials
Intermediate Tutorials
DCL
Beginners' Tutorials
Intermediate Tutorials
VBA
VBA Tutorials
VBA Applications
Tips'nTricks
AutoCAD
Customization Tutorials
Tips'n'Tricks
Reference
AutoLISP Functions
Visual LISP Sample Files
DXF Group Codes
The AutoCAD APIs
DCL Tile Attributes
AutoLISP DCL Functions
System Variables
AutoCAD Object Model
Sin and Cos Functions
VLAX Enumeration
Download
Forum
Application Data
by Kenny Ramage
This is simply a text file divided into sections. The only section that you have control over is the [AppData] section. Let's do something with it.
Say you wanted to store 2 bits of information that you use in one of your AutoLisp routines. You would store them like this :
After (setcfg must come "appdata" followed by your application name, which must be unique. Following this is the variable tag and then the information you wish to
store. If you open the ACAD14.CFG file, this is what the [AppData] section will look like :
[AppData/test]
bolt=4
length=90
This would set a to "M24" and b to "90". Now this is great, I hear you say, but were would you use it. Here's a good example for you :
Say you've written a routine that you would like other people to use on a trial basis, say 5 times. After the 5 times they either pay up, or the routine ceases to work.
(defun c:test8 ()
(register)
(if flagset
(alert "\nThe programme will now run.")
);if
(princ)
)defun
;Sub-function
(defun register ()
(setq v1 (getcfg "AppData/CadKen/test"))
(if (= v1 nil)
(progn
(setcfg "AppData/CadKen/test" "1")
(setq v1 (getcfg "AppData/CadKen/test"))
);progn
);if
(setq v2 5)
(setq v1 (atoi v1))
(if (< v1 v2)
(progn
(setq v1 (+ v1 1))
(cond
((= v1 1) (setcfg "AppData/CadKen/test" "1"))
((= v1 2) (setcfg "AppData/CadKen/test" "2"))
((= v1 3) (setcfg "AppData/CadKen/test" "3"))
((= v1 4) (setcfg "AppData/CadKen/test" "4"))
((= v1 5) (setcfg "AppData/CadKen/test" "5"))
);cond
(setq v3 v1)
(setq v3 (rtos (- v2 v1)))
(alert (strcat "\n You Have " v3 " more Loadings Left"))
(setq flagset T)
);progn
(progn
(alert "\nEvalution Period has Expired
\n Contact Kenny Ramage
\n [email protected]
\n For Licensed Copy")
(setq flagset nil)
);progn
);if
(princ)
);defun
(princ)
This is a very simple but usefull routine that demonstrates the use of [AppData]. You would still, of course, have to encrypt or compile your routine to stop the user
simply changing the variable that contains the usage control number. If you would like the source code, I have included it here.
AutoLISP
AutoLISP Beginners' Tutorials
AutoLISP Intermediate Tutorials
AutoLISP Advanced Tutorials
AutoLISP Application Tutorials
AutoLISP Tips'n'Tricks
AfraLISP Archive
‘Hey, what's happened to AfraLISP?’ If you've visited our site before, you'll notice some big changes. We're currently revamping the entire site to bring you updated
tutorials and a better user experience. However, if there's something you can't find, the AfraLISP Archive contains a full copy of the original site as originally created by
Kenny Ramage.
Online Books
The ABC's of AutoLISP
The Visual LISP Developer's Bible
AutoLISP Forums
CADTutor
Autodesk Discussion Groups
Autodesk User Group International (AUGI)
The Swamp
Back to top
Home
Cared for by David Watson © 2024