Jump to content

windows environment variables


p0026376

Recommended Posts

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!

Link to comment
Share on other sites

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 :-)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Ah.

Try this one: (load (strcat (getvar 'ROAMABLEROOTPREFIX) "support\\acaddoc.lsp"))

 

perfect! thank you very much for your help!!

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...