Lee Mac Posted March 21, 2013 Share Posted March 21, 2013 I would suggest the following minor modifications to BlackBox's code to improve the error trapping & perhaps make the code more readable: ( ([color=BLUE]lambda[/color] ( [color=BLUE]/[/color] des dir dll loc net usr ) ([color=BLUE]setq[/color] usr ([color=BLUE]getvar[/color] 'loginname) dir [color=MAROON]"P:\\Design_Office\\SupportFiles\\"[/color] dll [color=MAROON]"RA_DesignOffice.dll"[/color] loc ([color=BLUE]strcat[/color] [color=MAROON]"C:\\"[/color] dll) net ([color=BLUE]strcat[/color] dir dll) ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] des ([color=BLUE]open[/color] ([color=BLUE]strcat[/color] dir [color=MAROON]"dave.spy"[/color]) [color=MAROON]"a"[/color])) ([color=BLUE]progn[/color] ([color=BLUE]write-line[/color] ([color=BLUE]strcat[/color] ([color=BLUE]menucmd[/color] [color=MAROON]"M=$(edtime,$(getvar,date),YYYY-MO-DD hh:mm:ss)"[/color]) [color=MAROON]", "[/color] usr) des) ([color=BLUE]close[/color] des) ([color=BLUE]princ[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\nWelcome, "[/color] usr)) ) ) ([color=BLUE]cond[/color] ( ([color=BLUE]not[/color] ([color=BLUE]findfile[/color] net)) ([color=BLUE]princ[/color] [color=MAROON]"\nNetwork dll not found."[/color]) ) ( ([color=BLUE]not[/color] ([color=BLUE]findfile[/color] loc)) ([color=BLUE]if[/color] ([color=BLUE]vl-file-copy[/color] net loc) ([color=BLUE]command[/color] [color=MAROON]"_.netload"[/color] loc) ([color=BLUE]princ[/color] [color=MAROON]"\nUnable to copy dll from network."[/color]) ) ) ( ([color=BLUE]or[/color] ([color=BLUE]equal[/color] ([color=BLUE]vl-file-systime[/color] loc) ([color=BLUE]vl-file-systime[/color] net)) ([color=BLUE]and[/color] ([color=BLUE]vl-file-delete[/color] loc) ([color=BLUE]vl-file-copy[/color] net loc)) ) ([color=BLUE]command[/color] [color=MAROON]"_.netload"[/color] loc) ) ( ([color=BLUE]princ[/color] [color=MAROON]"\nFailed to update dll, contact Dave."[/color])) ) ([color=BLUE]princ[/color]) ) ) Quote Link to comment Share on other sites More sharing options...
dbroada Posted March 22, 2013 Author Share Posted March 22, 2013 Thanks Lee, I'm running your code today. But one thing has me confused. Looking at my spy report I have one person logging on every 2 seconds. Clearly he is not shutting down and restarting that quickly. Have you any idea what could have caused this? He is at a meeting ATM so I can't ask what happened. now using Lee's code 2013-03-22 08:24:37, dbroad 2013-03-22 08:37:51, sjdimaio 2013-03-22 08:42:46, sjdimaio 2013-03-22 08:42:54, sjdimaio 2013-03-22 08:42:56, sjdimaio 2013-03-22 08:42:58, sjdimaio 2013-03-22 08:43:00, sjdimaio 2013-03-22 08:43:02, sjdimaio 2013-03-22 08:43:04, sjdimaio 2013-03-22 08:43:06, sjdimaio 2013-03-22 08:43:07, sjdimaio 2013-03-22 08:43:09, sjdimaio 2013-03-22 08:43:11, sjdimaio 2013-03-22 08:43:13, sjdimaio 2013-03-22 08:43:14, sjdimaio 2013-03-22 08:43:16, sjdimaio 2013-03-22 08:43:18, sjdimaio 2013-03-22 09:03:22, rablake 2013-03-22 09:22:53, sfernel Quote Link to comment Share on other sites More sharing options...
dbroada Posted March 22, 2013 Author Share Posted March 22, 2013 apparently he was running a script routine. These run in sdi mode so continually open a drawing, modify it or plot it and open the next drawing, saving or not depending on the script. I thought the ACAD.LSP only got loaded once per session. I am now confused again.... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 22, 2013 Share Posted March 22, 2013 I thought the ACAD.LSP only got loaded once per session. I am now confused again.... I'm unsure of the behaviour of the ACAD.lsp file under SDI mode, but perhaps check the ACADLSPASDOC system variable. Quote Link to comment Share on other sites More sharing options...
dbroada Posted March 22, 2013 Author Share Posted March 22, 2013 mine is set to 0 (default) and is behaving as expected. I would be surprised if it were changed on his machine as it is a registry entry but I will check when he gets back (out ot lunch now). Quote Link to comment Share on other sites More sharing options...
BlackBox Posted March 22, 2013 Share Posted March 22, 2013 I thought the ACAD.LSP only got loaded once per session. I am now confused again.... It does only load once per session... OOTB... But this can be changed as Lee's already noted. mine is set to 0 (default) and is behaving as expected. I would be surprised if it were changed on his machine as it is a registry entry but I will check when he gets back (out ot lunch now). One simple way to ensure others' AcadLspAsDoc System Variable value, is to set it accordingly in your Acad.lsp file. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted March 22, 2013 Share Posted March 22, 2013 I'm unsure of the behaviour of the ACAD.lsp file under SDI mode, but perhaps check the ACADLSPASDOC system variable. SDI has no affect on Acad.lsp, only AcadLspAsDoc as you've already noted. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 22, 2013 Share Posted March 22, 2013 SDI has no affect on Acad.lsp, only AcadLspAsDoc as you've already noted. Thank you for the verification; I have only ever worked in MDI mode and didn't have time to experiment Quote Link to comment Share on other sites More sharing options...
BlackBox Posted March 22, 2013 Share Posted March 22, 2013 Thank you for the verification; I have only ever worked in MDI mode and didn't have time to experiment Anytime, mate Quote Link to comment Share on other sites More sharing options...
dbroada Posted March 22, 2013 Author Share Posted March 22, 2013 however the machine that logged in to spy every two seconds was in ACADLSPASDOC = 0. I will run a script next week to see if mine exhibits the same behaviour. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted March 22, 2013 Share Posted March 22, 2013 however the machine that logged in to spy every two seconds was in ACADLSPASDOC = 0. I will run a script next week to see if mine exhibits the same behaviour. The plot thickens... As a temporary work around, consider setting a global variable as T, and if not run spy. Quote Link to comment Share on other sites More sharing options...
dbroada Posted April 3, 2013 Author Share Posted April 3, 2013 a couple of days ago it was "talk to myself day", today is "revive an old thread day". This has sat still during our (partial) change over to ACADE 2013 and my necessary re-write of the dll I was working on. I am now only going to load the revised dll to the machines running 2013 and nothing is to be loaded for the others. I am using Lee's code (below) and can see I need to make use of (something like) (if (usr "dbroad") (progn <load stuff etc.> ) ) which is fine for just me but how do I create a list of usr names to be included? Lees code follows... ( (lambda ( / des dir dll loc net usr ) (setq usr (getvar 'loginname) dir "P:\\Design_Office\\SupportFiles\\" dll "RA_DesignOffice.dll" loc (strcat "C:\\" dll) net (strcat dir dll) ) (if (setq des (open (strcat dir "dave.spy") "a")) (progn (write-line (strcat (menucmd "M=$(edtime,$(getvar,date),YYYY-MO-DD hh:mm:ss)") ", " usr) des) (close des) (princ (strcat "\nWelcome, " usr)) ) ) (cond ( (not (findfile net)) (princ "\nNetwork dll not found.") ) ( (not (findfile loc)) (if (vl-file-copy net loc) (command "_.netload" loc) (princ "\nUnable to copy dll from network.") ) ) ( (or (equal (vl-file-systime loc) (vl-file-systime net)) (and (vl-file-delete loc) (vl-file-copy net loc)) ) (command "_.netload" loc) ) ( (princ "\nFailed to update dll, contact Dave.")) ) (princ) ) ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.