Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runing macro on Open File

Status
Not open for further replies.

macPT

Mechanical
Oct 22, 2002
607
0
0
PT
I'm trying to find a way to program a macro to show, on screen, some custom properties of the opened file. The goal is to give some automatic information about the file (part, assembly or drawing)that the user is opening.
Does anyone have any ideas?
 
Replies continue below

Recommended for you

Thank you guys, for your interest in this matter.

My idea is more about a macro that runs automatically on the event of opening a SW file (not dependent of a hot key, or mouse click). The macro controls the content of some custom properties. If these properties have some values, then messeges are printed on screen. Otherwyse, the macro ends/pauses silently for the user.

Example: a part file as a custom property named "revision_in_study" with the value "yes". If some user opens this file (for use in an assembly, for example), the macro test the contents of the property and warns the user that this file will probably change (depending on the result of the study). I don't want the macro execution to be user dependent, for safety purposes.

I think that the bigest problem is not read the property. That can be solved based on the example that Bradley is showing. The bigest problem is having the macro on stand-by, wayting for a file to be opened, run after the file opens, and be on stand-by again.
 
You will probably have to create the application as an add-in so that it will remain loaded with SolidWorks. Then, you should be able to trap the Doc_Open event. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Once this program is written - do you have to write another one that monitores the first one and restarts or gives message in case event catching program has crashed?
Because it is possible that add-in crashes without any messages?
 
I recall an artical in Solid Solutions Magazine that had info on creating an add-in with VB. There is also a site that has an application that turns your VB.exe file into an add-in dll file. ( DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
I think in SW2003 you can set-up macros to run upon opening, like M$ Excel. I'll have to go back and look.

Otherwise, you can write a VB DLL to do it, if you set-up the "trap" for it.

Maybe I'll try

Mr. Pickles Mr. Pickles
 
Well, I am starting to think that I am on a quest for the ELDORADO.

For the time being, I will simply try to develop a batch macro, that each user should run on a frequent basis, that will detect the darwings that are in a revision process.
 
Bradley,
I was trying to avoid that. I will still try to find a solution. But mabe a PDM will be the only way to go.

Thanks
 
macPt,
Before we purchased PDM/Works I was trying to come up with a way that 19 SolidWorks users could share files. The best idea I came up with was to use the file attributes to control ownership. Also if one were not going to change a model they would open the model using SolidWorks read only property. The models that were released we put into a write-protected folder (this person would not be a SolidWorks user). The SolidWorks user would link to the write-protected folder, not copy from the write-protected folder. That is as far as I got. Good luck. Bradley
 
Status
Not open for further replies.
Back
Top