Author Topic: [Solved] INI-file: create paths with strcat ..  (Read 1870 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 651
[Solved] INI-file: create paths with strcat ..
« on: December 12, 2014, 05:31:23 AM »
Maybe a crazy idea or a "challenge" - please don't invest too much time in it ...

----
EDIT:
neither "crazy" nor "challenge" - "read" is the solution
----

At the moment, I set paths inside Lisp:

Code: [Select]
setq mainpath "d:\\cad\\test\\"
      lisppath (strcat systempfad="Lisp_Dbx_Arx\\")

Now I have to migrate these settings to an ini-file and to read it with "dos_getini".

Here is the  current state-of-the-art - INI-file:
Code: [Select]
[Paths]
mainpath=d:\cad\test\
lisppath=d:\cad\test\Lisp_Dbx_Arx\

Of course an INI is "hardcoded" - when I change the mainpath all other paths have to be changed too. And of course that's not a real problem - search and replace with editor. Or use for the "strcat" inside lisp to concatenate the info.

But -  how about writing the lisp-commands to the INI and read and use them:
Code: [Select]
[Paths]
mainpath=d:\cad\test\
lisppath=(strcat mainpath "\\Lisp_Dbx_Arx\")
It's no problem to read the values, but of course the result is a string. So the main question is:

How to use a string as command?

Thanks and regards
« Last Edit: December 12, 2014, 05:57:21 AM by Peter2 »
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: INI-file: create paths with strcat ..
« Reply #1 on: December 12, 2014, 05:44:22 AM »
Perhaps something like :

Code - Auto/Visual Lisp: [Select]
  1.  
  2. (setq mainpath   "d:\\cad\\test\\"
  3.       secondpath "Lisp_Dbx_Arx\\"
  4. )
  5.  
  6. (setq xxxx "(strcat mainpath secondpath))")
  7.  
  8.  
  9. (eval (read xxxx))
  10.  
  11.  
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Peter2

  • Swamp Rat
  • Posts: 651
Re: INI-file: create paths with strcat ..
« Reply #2 on: December 12, 2014, 05:56:07 AM »
Oh - "read" is the key. Never used it  :embarrassed:

Thanks Kerry, have a fine weekend.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: INI-file: create paths with strcat ..
« Reply #3 on: December 12, 2014, 06:05:32 AM »
Oh - "read" is the key. Never used it  :embarrassed:

Thanks Kerry, have a fine weekend.

I shall.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.