Author Topic: Setting variables in a file opened by a routine?  (Read 4627 times)

0 Members and 1 Guest are viewing this topic.

shawndoe

  • Guest
Re: Setting variables in a file opened by a routine?
« Reply #15 on: December 16, 2011, 04:22:33 PM »
Hi,

It's a bit late, but I have a routine that also opens a new drawing from another and I found that (vl-bb-set/ref) is a much better option.  Vl-propogate dumps global variables in the new drawing which may cause problems.  I'm also under the impression that you can't access vl-propogate variables until after the S::STARTUP has finished.

Have a good one.
Shawndoe

GDF

  • Water Moccasin
  • Posts: 2081
Re: Setting variables in a file opened by a routine?
« Reply #16 on: December 16, 2011, 05:12:10 PM »
I use vl-registry-write and vl-registry-read.

Example: setting globals for dialog box controls.
(defun ARCH:SETDIALMODE  (key /)
  (vl-registry-write
    "HKEY_CURRENT_USER\\Software\\Arch Program\\Controls\\Dialog\\Display"
    ""
    key)
  (setq ARCH#DIAL
         (vl-registry-read
           "HKEY_CURRENT_USER\\Software\\Arch Program\\Controls\\Dialog\\Display"))
  (princ))
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Setting variables in a file opened by a routine?
« Reply #17 on: December 16, 2011, 06:35:54 PM »
setcfg / getcfg  8-)
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

BlackBox

  • King Gator
  • Posts: 3770
Re: Setting variables in a file opened by a routine?
« Reply #18 on: December 17, 2011, 12:38:22 AM »
Code - Auto/Visual Lisp: [Select]
  8-)

FTFY :wink:

** Note - the LISP functions are now hyperlinked to the help documentation.
« Last Edit: December 17, 2011, 04:12:51 AM by RenderMan »
"How we think determines what we do, and what we do determines what we get."

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Setting variables in a file opened by a routine?
« Reply #19 on: December 17, 2011, 03:43:09 AM »
I quit using setcfg and getcfg some years ago after I realized that it was causing the config file to grow and you have to manually remove orphaned entries.

Use the registry and then you can programmatically delete the keys after you no longer need them.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Setting variables in a file opened by a routine?
« Reply #20 on: December 17, 2011, 09:24:34 AM »
I quit using setcfg and getcfg some years ago after I realized that it was causing the config file to grow and you have to manually remove orphaned entries.

Use the registry and then you can programmatically delete the keys after you no longer need them.
The registry is a great option also.

As long as you keep reusing the same cfg there is no issue with file bloat.  Just another way.  :kewl:
(i.e. "AppData/Vars/var1")

There are also the setenv / getenv variables.

Code - Auto/Visual Lisp: [Select]
*This was for you RenderMan :angel:

All great options as long as the limitations are taken into account.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

BlackBox

  • King Gator
  • Posts: 3770
Re: Setting variables in a file opened by a routine?
« Reply #21 on: December 17, 2011, 06:07:02 PM »

There are also the setenv / getenv variables.

Code - Auto/Visual Lisp: [Select]
*This was for you RenderMan :angel:

 :-P
"How we think determines what we do, and what we do determines what we get."