Lee Mac Posted January 15, 2009 Posted January 15, 2009 Hi Guys, Ok, so a while back I was speaking with David Bethel on here and he raised the point of the dangers of using "setenv" and "getenv" within LISP programs. He mentioned that they would "bloat the registry". I just thought I'd post a thread to get everyone's opinion in this matter and see whether one should completely avoid these commands. Thanks Quote
brawleyman Posted January 15, 2009 Posted January 15, 2009 Hey Lee Mac, So far, I haven't had any problems with those commands in my LISP. You helped me with my distance LISP that I wanted to remember my last input, and it hasn't created any problems. However, I only use 1 or 2 different distances on a regular basis which I repeat lots of times each to measure all the devices. If you start using multiple entries, I can see how it could possibly create havoc on the registry or memory. Just my input... Quote
ASMI Posted January 15, 2009 Posted January 15, 2009 > Lee Mac I believe that among the lisp-programmers, there are some prejudices that do not have a sufficient basis. Many of them have established a reputable people who can not imagine that effect. As examples, the function GRREAD, VLAX-LDATA-, SETENV, GETENV and others. However, if you try to ask a specific question: who, when and what problems have you most likely will not get concrete answers. With regard to the functions and SETENV and GETENV I do not see any restrictions on their use. Speaking on the debris in the Registry, the average user has tens of thousands of unnecessary keys and what a 10-20 or 50 others used keys nothing to influence. Meanwhile, more accurately known that the path where all the keys created function SETENV are in the Register. In contrast, the keys are created using the VL-REGISTRY-WRITE may be really are forgotten. Of course data can be stored in the *. ini files using a long special functions or in the files of their own format, but for short programs that people share in the forums is not acceptable. Certainly the use of SETENV large programs unnecessarily, but in smaller code is acceptable. I really do not see any problems from the use of SETENV/GETENV. This is my personal opinion, and it can be challenged. Quote
Lee Mac Posted January 15, 2009 Author Posted January 15, 2009 Thanks guys for your input. I enjoyed reading your post ASMI, its very informative and has put things in perspective for me. I would normally use these commands to store what I would call "base variables" for a program, i.e. text heights, text offsets, etc etc and other kinds of parameters key to that particular program. - and so these are normally just numerical values assigned to different strings. I like the point you express about the average registry being full of loads of unused keys, and that another 30-50 won't do any harm, but I can also see how overusing these functions will soon have an impact. Thank you for your time. Lee Quote
ASMI Posted January 15, 2009 Posted January 15, 2009 > Lee Mac And yet, I want to say that not to abuse these functions. They should be used when really you want to save what may be up to the next session. And also to take steps for the uniqueness of keys and verification of data. It must be borne in mind that the place of storage in this case a public place, it is not very good Quote
Lee Mac Posted January 15, 2009 Author Posted January 15, 2009 ASMI said: > Lee Mac And yet, I want to say that not to abuse these functions. They should be used when really you want to save what may be up to the next session. And also to take steps for the uniqueness of keys and verification of data. It must be borne in mind that the place of storage in this case a public place, it is not very good Good Point ASMI - I don't feel I abuse these settings, but yes, the naming of such functions must be taken into consideration as otherwise, a system variable could be overwritten inadvertently... Quote
David Bethel Posted January 16, 2009 Posted January 16, 2009 Lee, Here is my register for R15. I setup the NET value for my network. I have 6 machines and 9 hard drives that I map. Each hard drive has permanent drive letter designation so that I can discern where to put certain files. Main Cad HD maps as M Internet Work machine maps as Z Print Server maps as P Web Server maps a X and so on Each machine maps all others in the same manner. I don't believe that you can map your own C drive the same way. If I want to create a file on Z drive while running ACAD on either machine (cond ((= getenv "M") (setq dr "Z")) ((= getenv "Z") (setq dr "C"))) (setq wf (open (strcat dr "://acad/test.txt") "w")) (write-line "" wf) (close wf) So I guess the questions are: Do you know what environments names already exist Do know what all of the protected names are ( I think PATH is 1 ) Do you know what program set the value so that you can reuse it? I'm not saying that you should not use them at all. I just think that you should be very careful with them. -David Quote
Lee Mac Posted January 16, 2009 Author Posted January 16, 2009 David Bethel said: Lee, Here is my register for R15. I setup the NET value for my network. I have 6 machines and 9 hard drives that I map. Each hard drive has permanent drive letter designation so that I can discern where to put certain files. Main Cad HD maps as M Internet Work machine maps as Z Print Server maps as P Web Server maps a X and so on Each machine maps all others in the same manner. I don't believe that you can map your own C drive the same way. If I want to create a file on Z drive while running ACAD on either machine (cond ((= getenv "M") (setq dr "Z")) ((= getenv "Z") (setq dr "C"))) (setq wf (open (strcat dr "://acad/test.txt") "w")) (write-line "" wf) (close wf) So I guess the questions are: Do you know what environments names already exist Do know what all of the protected names are ( I think PATH is 1 ) Do you know what program set the value so that you can reuse it? I'm not saying that you should not use them at all. I just think that you should be very careful with them. -David Thanks for the info David - I think I shall be wary when I use these functions from now on. "LEEMAC MADE ME DO IT" ~~ Nice Touch. Quote
David Bethel Posted January 16, 2009 Posted January 16, 2009 It's a Windows scheme named Maple. Been around a while. I really don't like white back ground things. Real hard on my old eyes. I never recommend anyone messing around with REGEDIT unless they are real geeks. You can do a lot of damage in there. -David Quote
Lee Mac Posted January 16, 2009 Author Posted January 16, 2009 David Bethel said: I never recommend anyone messing around with REGEDIT unless they are real geeks. You can do a lot of damage in there. -David I know what you mean - I didn't delete anything from there (I'm no geek!) - but it does present the option. Quote
flowerrobot Posted January 19, 2009 Posted January 19, 2009 Sorry to bring dumb questions into a *above me knowledge* conversation, but you are talking about setting global settings, so that is you set a setting and it is stored for all .dwg, and is basically a real setting? and what is the difference with a \/ ASMI said: *. ini and does it do the same thing? as i was about to attemt this option in my a progn. and was going to place it in a text. and then try and read the file each time(not sure if this is even possible) so could you either place a link or explain slightly more. particlarly for all the people not fully understanding it all cheers flower Quote
ASMI Posted January 19, 2009 Posted January 19, 2009 > David Bentel Quote So I guess the questions are:Do you know what environments names already exist Do know what all of the protected names are ( I think PATH is 1 ) Do you know what program set the value so that you can reuse it? Of course you're right by asking these questions. But under certain rules and common sense, I believe permissible use setenv / gentenv for smaller programs. For example the creation of its own variables with a certain prefix. By the way in the registry keys for AutoCAD can be obtained by using the (vlax-product-key) function. > flowerrobot Quote Sorry to bring dumb questions into a *above me knowledge* conversation,but you are talking about setting global settings, so that is you set a setting and it is stored for all .dwg, and is basically a real setting? and what is the difference with a \/ Quote:Originally Posted by ASMI *. ini and does it do the same thing? as i was about to attemt this option in my a progn. and was going to place it in a text. and then try and read the file each time(not sure if this is even possible) so could you either place a link or explain slightly more. particlarly for all the people not fully understanding it all cheers flower Before the advent of Windows to store settings used in the files with the extension *. ini. Their convenience is understandable format and the possibility of editing in Notepad. Their disadvantages are poor security and a limited amount of storage. Despite the use of *.ini files is often more convenient than using the Registery and many programmers prefer them. AutoLISP no standard functions for working with these files, but writen a lot of custom functions. As they have in the popular library DosLIB. Pay attention to the dos_setini and dos_getini functions. Quote
David Bethel Posted January 19, 2009 Posted January 19, 2009 Flower, To expand a little on what ASMI wrote, ( setenv ) did not exist prior to Release 14. Only ( getenv ) as it accessed the DOS environment set by command.com in config.sys and usually configured in autoexec.bat or a .bat file for starting a program like ACAD. I also like .ini files as they are program specific and easliy configured and verified. ASMI, I agree with dilegence and common sense, they can be useful. But I would say sparingly. -David Quote
Lee Mac Posted January 19, 2009 Author Posted January 19, 2009 Is "vl-registry-delete" a dangerous command to be playing around with? Quote
ASMI Posted January 19, 2009 Posted January 19, 2009 And how do you think? As vl-registry-write. Unknown worse that either delete or save some incorrect value. But if you use only their own sections of the Registery you can affect only its own program. Quote
Lee Mac Posted January 19, 2009 Author Posted January 19, 2009 ASMI said: And how do you think? As vl-registry-write. Unknown worse that either delete or save some incorrect value. But if you use only their own sections of the Registery you can affect only its own program. But I suppose its better to leave the registry as it is. Quote
ASMI Posted January 19, 2009 Posted January 19, 2009 I think that you should not be afraid of the Registry, just think what to do. In truth, all depends on the person. I spite of all my endless experiments can not reinstall my computer for years and all works ok. But there are people for whom enough to touch one finger to the keyboard that all broken. Sometimes I start to believe in ghosts. Quote
Lee Mac Posted January 19, 2009 Author Posted January 19, 2009 ASMI said: I think that you should not be afraid of the Registry, just think what to do. In truth, all depends on the person. I spite of all my endless experiments can not reinstall my computer for years and all works ok. But there are people for whom enough to touch one finger to the keyboard that all broken. Sometimes I start to believe in ghosts. haha, I see what you mean... I am worried about deleting something I shouldn't.... and then next thing you know, the computer doesn't boot up. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.