Author Topic: Preferences Object Reactor?  (Read 3325 times)

0 Members and 1 Guest are viewing this topic.

BlackBox

  • King Gator
  • Posts: 3770
Preferences Object Reactor?
« on: June 05, 2012, 12:30:23 PM »

Silly question, but which reactor type (and event) is used to fire a callback when a Preferences Object is modified?

I'm attempting to programmatically determine when the Preferences Object (or a property of) has been changed, without catching all Options Command invocations, and monitoring each LispWillStart events, as either may make changes.
"How we think determines what we do, and what we do determines what we get."

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Preferences Object Reactor?
« Reply #1 on: June 05, 2012, 01:01:28 PM »
Since many of the properties of the Preferences Object are stored by Env Vars in the Registry or Sys Vars, you would need a way to monitor the values of such variables (vlr-sysvar-reactor immediately springs to mind for the System Variables), not sure how you would monitor the registry however.

BlackBox

  • King Gator
  • Posts: 3770
Re: Preferences Object Reactor?
« Reply #2 on: June 05, 2012, 01:27:58 PM »
Thanks for the response, Lee.

Unfortunately, there is no System Variable for the property I am attempting to monitor.

Frankly, I am shocked that there's no direct way of monitoring Visual LISP Objects (in general).   :-o

I really wanted to do this project in LISP (put in a fair amount of my personal time), but it looks as though I may have to start over with .NET  :| ... Good practice I guess. LoL
"How we think determines what we do, and what we do determines what we get."

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Preferences Object Reactor?
« Reply #3 on: June 06, 2012, 12:24:08 PM »
What specifically are you wanting to track?
James Buzbee
Windows 8

BlackBox

  • King Gator
  • Posts: 3770
Re: Preferences Object Reactor?
« Reply #4 on: June 06, 2012, 12:38:56 PM »
What specifically are you wanting to track?

Any of the Preference Property Objects, i.e., Display, Drafting, Files, Profiles, Selection, etc.

Specifically, any Preferences Property Object properties that do not have System Variables assigned.
"How we think determines what we do, and what we do determines what we get."

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Preferences Object Reactor?
« Reply #5 on: June 06, 2012, 01:40:37 PM »
Actually I'm unaware of something to monitor those even in ObjectARX, so I'm guessing the same applies for Acad's DotNet libraries.

You might have to monitor the registry keys themselves. I know you get programs which can do this, so it must be possible. Actually, here's a sample C#
http://stackoverflow.com/questions/826971/registry-watcher-c-sharp
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

BlackBox

  • King Gator
  • Posts: 3770
Re: Preferences Object Reactor?
« Reply #6 on: June 06, 2012, 01:49:07 PM »
Thanks Irneb, WqlEventQuery sounds like what I'm after.

... Started [re-]coding the application in C# last night, I only finished the CommandMethod user prompt, and conditional structure (based upon the user's PromptResult). Next, I need to code some app-specific registry classes, so this seems to fit right in with the application structure I'm envisioning. :-D

Cheers!

** Edit - Oh, now I 'spose that I need to find the registry keys to monitor, too. lmao
"How we think determines what we do, and what we do determines what we get."

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Preferences Object Reactor?
« Reply #7 on: June 06, 2012, 01:52:48 PM »
A suggestion for the Visual LISP route: how about using a Command Reactor with a call-back function triggered on the :vlr-commandwillstart event to record the necessary registry keys when the 'Options' command is used; then, another call-back function triggered on the :vlr-commandended event that will check those same keys against the cached values to detect any changes.

Just an idea | Untested.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Preferences Object Reactor?
« Reply #8 on: June 06, 2012, 02:08:04 PM »
That's also a nice idea Lee! Though it's still going to make RM's day searching for all the envars and/or registry keys  :lmao:
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

BlackBox

  • King Gator
  • Posts: 3770
Re: Preferences Object Reactor?
« Reply #9 on: June 06, 2012, 02:10:30 PM »
A suggestion for the Visual LISP route: how about using a Command Reactor with a call-back function triggered on the :vlr-commandwillstart event to record the necessary registry keys when the 'Options' command is used; then, another call-back function triggered on the :vlr-commandended event that will check those same keys against the cached values to detect any changes.

Just an idea | Untested.

That is almost the exact methodology that I have been using prior to posting this thread.

The problem being, as I see it, that it's inefficient in that it monitors all instances of the user issuing the OPTIONS command, _and_ either has to monitor all LispWillStart events, or knowingly leave open a back door (by not doing so), as LISP can also change these Properties.

That can be done, but it seems like overkill for what I see as such a small, yet intuitive task.

That's also a nice idea Lee! Though it's still going to make RM's day searching for all the envars and/or registry keys  :lmao:

Actually, if I go with the pure Reactor route, it's easier to programmatically Set the appropriate values upon *WillStart events, than teaching myself how to _properly_ use Delegates, and Event Monitors. LoL It's just unnecessary burden on the end-user's processing time. LoL

I appreciate everyone's assistance!
"How we think determines what we do, and what we do determines what we get."

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Preferences Object Reactor?
« Reply #10 on: June 07, 2012, 09:10:09 AM »
All that and more . . ..
Yea, you will have to hard code the specific registry entrees your interested in.

good luck - sorry I couldn't have been more help . . ..
James Buzbee
Windows 8

BlackBox

  • King Gator
  • Posts: 3770
Re: Preferences Object Reactor?
« Reply #11 on: June 07, 2012, 10:42:26 AM »
No worries; cheers!
"How we think determines what we do, and what we do determines what we get."