p0026376 Posted August 12, 2010 Posted August 12, 2010 Hello all! I was wondering if it was possible to use windows environment variables in AutoLISP? Specifically I'm trying to do this: (load "%APPDATA%/Autodesk/ACD-MEP 2009/enu/Support/acaddoc.lsp") but that won't work (obviously to all you...), I need a way to "extract the string windows stores as the %APPDATA% variable into that line. Thanks for the help! Quote
MarcoW Posted August 12, 2010 Posted August 12, 2010 Ha... Never knew that ' before the sysvarname was the same as a " before and after the sysvar.So (getvar "LOCALROOTPREFIX) = (getvar "loacalrootprefix") Now I can spare some keystrokes :-) Quote
p0026376 Posted August 12, 2010 Author Posted August 12, 2010 so like this? (load "(getvar "APPDATA)/Autodesk/ACD-MEP 2009/enu/Support/acaddoc.lsp") Quote
Se7en Posted August 12, 2010 Posted August 12, 2010 No, not like that at all. more like this: (load (strcat (getvar 'LOCALROOTPREFIX) "support\\acaddoc.lsp")) but that isnt really proper either (the above is the lazy man's method); you *should* check to see if the file exists first and stuff like that. Quote
MarcoW Posted August 13, 2010 Posted August 13, 2010 WHat is it exactly that you want to achieve? Quote
p0026376 Posted August 13, 2010 Author Posted August 13, 2010 I want to accomplish the proper equivalent of : (load "%APPDATA%/Autodesk/ACD-MEP 2009/enu/Support/acaddoc.lsp") We have a corporate acaddoc.lsp which loads some scripts or somesuch for our corporate setting. BUT, we are allowed to have our own personal lisp scripts. what I'd like to do is propose they add the above, in order to allow a user to have a %APPDATA%/Autodesk/ACD-MEP 2009/enu/Support/acaddoc.lsp file to automatically load their personal scripts. I'd like to know how to do it when I propose it so that it is more likely to be implemented. Quote
p0026376 Posted August 13, 2010 Author Posted August 13, 2010 Are my posts invisible? oh, sorry, the forum didn't tell me you had posted, so I missed that. If the file doesn't exist, will anything bad happen? Quote
p0026376 Posted August 13, 2010 Author Posted August 13, 2010 Se7en, that line tries to load: C:\\Documents and Settings\\user\\Local Settings\\Application Data\\Autodesk\\ACD-MEP 2009\\enu\\support\\acaddoc.lsp but that directory is empty, all my support files are at: C:\Documents and Settings\user\Application Data\Autodesk\ACD-MEP 2009\enu\Support Quote
Se7en Posted August 13, 2010 Posted August 13, 2010 Ah. Try this one: (load (strcat (getvar 'ROAMABLEROOTPREFIX) "support\\acaddoc.lsp")) Quote
p0026376 Posted August 13, 2010 Author Posted August 13, 2010 Ah.Try this one: (load (strcat (getvar 'ROAMABLEROOTPREFIX) "support\\acaddoc.lsp")) perfect! thank you very much for your help!! Quote
Lee Mac Posted August 14, 2010 Posted August 14, 2010 Perhaps also look under the list of support paths: (getenv "ACAD") 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.