PDA

View Full Version : Is autocad open?



rad.77676
2004-12-10, 07:15 PM
Maybe someone can help!
I need to know if it is possible and if so how would you go about checking to see if autocad was already open when a user double clicks LDD Icon?

And is it possible to stop LDD from loading and overwriting autocad settings?

RobertB
2004-12-10, 07:38 PM
I don't think so.

rad.77676
2004-12-10, 09:18 PM
That doesn't make me feel any better!

dalej_k
2004-12-10, 09:36 PM
This kind of thing can be done with Windows Script Host, vbscript. Perhaps someone in the VB Forum would know.

rad.77676
2004-12-10, 10:28 PM
Thanx, will give it a try!

Mike.Perry
2004-12-10, 10:31 PM
Hi

Please note I've merged your thread from the AutoLISP Forum with the one here.

Why? - So people coming to offer assistance / help can see the complete picture....

Thanks, Mike

Forum Moderator

rad.77676
2004-12-10, 11:39 PM
Thanks Mike!

RobertB
2004-12-11, 02:06 AM
I don't think scripting will help since the OP asked if things could be prevented when the user uses the LDD icon. So the only way that would work is if the LDD was removed entirely and some other shortcut was used instead.

dalej_k
2004-12-14, 06:01 PM
I know wsh can monitor Processes, but perhaps this is not the way. Could data be recorded in an external file or in registry when AutoCAD is opened. If user attempts to open LDD, check file for verification. If T, don't run the LDD exe but alert user?

rad.77676
2004-12-23, 12:43 AM
Just a shot in the dark here, but isn't it possible for vb/vba to query the registry and check for a specific key that is present only when autocad is open and if that key is present, do not open LDD?

"Validation Policy"=dword:00000003
"Validation Strategy"=dword:00000001

elowe
2005-12-19, 08:59 PM
I am now looking at this for my company and would like to reopen this discussion. How would you code the last suggestion regarding an key? Is there a registry key/varaible automaticaly open when Autocad is running that can be querried? Is this key different for acad/adt/abs/ldt/c3d?

rad.77676
2005-12-19, 09:40 PM
Ed,
I can't give you much guidance other than telling you that when I first started trying to do this, I didn't have vb and/or vba experience and started inquiring about how to do this.
I posted in the autodesk discussions and Laurie Comeford informed me that this could not be done without VB.
That being said, and my being stubborn, I set out to make this work utilizing DOS and Lisp. The end results were that I could do everthing "but".
DOS does not support command line switches to force load LDD.

Don't know if this helps, but good luck!

Ed Jobe
2005-12-19, 10:29 PM
The information stored in the registry only tells you what's been installed, not what is currently running. Perhaps it would help if you would provide an outline of what your're trying to do. Related to what you describe, is...what happens when a user dc's a dwg file? Blocking an action at a shortcut would only solve part of the problem.

elowe
2005-12-20, 01:43 PM
Because Civil3D drawings can be corrupted by other 2006 autodesk packages opening them and saving them I want to write a routine to prevent people from double clicking a dwg file in explorer and open any file they want. To accomplish this I have written a front end that replaces the normal shortcuts to fire the software. However the dbl-clicking in explorer is a loop whole in my program. I thought I could just write some code in the acad2006doc.lsp file to check if my front end program was ever run but I am using a findfile routine to look for a marker file that is then deleted. Now when you open a second drawing like in ADT or acad it looks at that lsp file and dumps you out. And yes I need to reread that lsp file at each drawing start for other reasons.

If there was some way to set a variable that stayed in place between drawing opens but disappeared if autocad failed/crashed/closed I would be set.

Ed Jobe
2005-12-20, 04:19 PM
Lisp is not good for that reason, because its environment is per/dwg. Whereas vba's environment is at the app level. BTW you can use acad.dvb (you have to create it) just like acad.lsp. That said, if you have written an exe to run from a shortcut just like acad.exe, then all you have to do is replace the dwg file accociation with your exe in order to have it run when a file is dc'd. Open Explorer, click on Tools>Folder Options>File Types tab. Locate the dwg file type, click on Advanced, create a new action that runs your app, and set it as the default action.

jwanstaett
2005-12-21, 12:28 AM
Because Civil3D drawings can be corrupted by other 2006 autodesk packages opening them and saving them I want to write a routine to prevent people from double clicking a dwg file in explorer and open any file they want. To accomplish this I have written a front end that replaces the normal shortcuts to fire the software. However the dbl-clicking in explorer is a loop whole in my program. I thought I could just write some code in the acad2006doc.lsp file to check if my front end program was ever run but I am using a findfile routine to look for a marker file that is then deleted. Now when you open a second drawing like in ADT or acad it looks at that lsp file and dumps you out. And yes I need to reread that lsp file at each drawing start for other reasons.

If there was some way to set a variable that stayed in place between drawing opens but disappeared if autocad failed/crashed/closed I would be set.
when you double click a dwg file in the explorer it check window registry editor to see what is the default function and use that function on the file. You can change the default function in the registry for the dwg file type to a script program do a check be for open the drawing or display a msgbox. the script program would be in window script.

Ed Jobe
2005-12-22, 05:42 PM
John, although it could, it doesn't have to be a script. He already has written an exe to handle it. The method I gave just uses the windows gui to change the registry settings.