×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Runing macro on Open File

Runing macro on Open File

Runing macro on Open File

(OP)
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?

RE: Runing macro on Open File

What about a simple note with links to the desired properties?

RE: Runing macro on Open File

macPT,
Check out http://www.nhcad.com/old/html/example7.asp example number 7. You can put the results onto a Visual Basic form. With this you can attach the macro to a user hot key.

Bradley

RE: Runing macro on Open File

(OP)
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.

RE: Runing macro on Open File

macPT,
   If you figure this one out please let us know. This would be a great tool for other uses also.  Good Luck.

Bradley

RE: Runing macro on Open File

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.

RE: Runing macro on Open File

dsi,
    Is it not true that one must write this add-in using C ?

Bradley

RE: Runing macro on Open File

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?

RE: Runing macro on Open File

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. (http://www.bitwright.com/).

DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.

RE: Runing macro on Open File

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

RE: Runing macro on Open File

(OP)
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.

RE: Runing macro on Open File

macPt,
Your best bet maybe to get PDM/Works.  The cost is low and the learning curve is short.

Bradley

RE: Runing macro on Open File

(OP)
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

RE: Runing macro on Open File

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources