TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Cawaugh on September 11, 2006, 08:46:46 AM

Title: How to run a lisp routine automatically when switching workspaces
Post by: Cawaugh on September 11, 2006, 08:46:46 AM
 This is driving me nuts!  :realmad: I haven't found a solution to my question and I have looked in many areas with no luck. I'm sure it's so simple that I'm missing it and I'm probably looking in the wrong area anyway. Maybe someone can make my day if there even is a solution to this.  :-D . Thanks for listening to my raving.   :ugly:
Title: Re: How to run a lisp routine automatically when switching workspaces
Post by: David Hall on September 11, 2006, 09:01:14 AM
i didn't see anything in the VBA area of AcadDocument, so maybe its not exposed
Title: Re: How to run a lisp routine automatically when switching workspaces
Post by: CAB on September 11, 2006, 09:18:54 AM
Reactor stuff here: http://www.theswamp.org/index.php?topic=9736.msg124522#msg124522
I don't do any but you might be looking for this:  vlr-documentBecameCurrent
Title: Re: How to run a lisp routine automatically when switching workspaces
Post by: Tramber on September 11, 2006, 11:04:47 AM
In my opinon, the easiest way would be to attach a reactor that react to the change of a variable. I know it exists.

Then each time the reactor is called, just make it check variables like TILEMODE and the others.
Title: Re: How to run a lisp routine automatically when switching workspaces
Post by: T.Willey on September 11, 2006, 11:50:49 AM
Here is something he is looking for.
Code: [Select]
(if (not GlbReactorWorkspaceChange)
 (setq GlbReactorWorkspaceChange (vlr-sysvar-reactor "MyWorkspaceReactor" '((:vlr-sysVarChanged . ShowCurrentWorkspace))))
)

(defun ShowCurrentWorkSpace (React SysVar)

(if (and (= (strcase (car SysVar)) "WSCURRENT") (= (cadr SysVar) T))
 (progn
  (prompt (strcat "\n New workspace: " (getvar "wscurrent")))
 )
)
(princ)
)
Title: Re: How to run a lisp routine automatically when switching workspaces
Post by: Tramber on September 11, 2006, 01:52:01 PM
Yes, workspaces and not the CTAB or the TILEMODE variable I was talking about. WSCURRENT is so new to me that I was not able to give it  ;-)


Title: Re: How to run a lisp routine automatically when switching workspaces
Post by: T.Willey on September 11, 2006, 01:53:41 PM
Yes, workspaces and not the CTAB or the TILEMODE variable I was talking about. WSCURRENT is so new to me that I was not able to give it  ;-)



No problem.  You were on the right path.  :wink: