×
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

loading macros at startup

loading macros at startup

loading macros at startup

(OP)
SW 2003 sp 3.1

Here is a noob question for sure.

How can you load macros or custom menus etc. when SW starts up??  Whats the procedure?  Is there a file like in ACAD?

Thanks for the help.

DG

RE: loading macros at startup

Hi DG,

you can specify a macro which should be executed with SolidWorks (a kind of autostart macro) with a commandline option "-m". Edit your shortcut to look like:

E:\Programme\sw2003\sldworks.exe -m "D:\daten\solidworks\macros\mm_24\Gen3DPointCloud.swp"

This will launch SolidWorks and executes the macro. Be sure to enclose the macro filename with " if you have spaces in your filename, but they won't hurt otherwise.

In this macro you can do anythink you want like launching other programs, loading documents and so on.

HTH,
Stefan

--
unofficial german SolidWorks helppage
http://solidworks.cad.de
Shareware, freeware, tools and macros
http://swtools.cad.de

RE: loading macros at startup

This is related, but not exactly same topic.

I believe the suggested way by berlitz executes only once when SW is launched. Is there a way to execute a macro every time when a SW document is opened?

RE: loading macros at startup

Yes, this is possible, but you need to write your own Add-In. If you are familiar with VB or C++ it is not that difficult. You have to listen to events fired by SolidWorks (for your example the FileOpenNotify2 event of SldWorks object) and react in your add-in as you want to.

Another way would be to write a macrofeature and place this in your document template. I have never tried this thought ...

HTH,
Stefan

--
unofficial german SolidWorks helppage
http://solidworks.cad.de
Shareware, freeware, tools and macros
http://swtools.cad.de

RE: loading macros at startup

(OP)
A follow-up to my question.

Assume I have a blank part file and load several macros and then save this as a template.
Now if I create a new part using this template, will the macros load automatically??  Maybe this is a way to get it to work for each new part file.

Yes/No/ Maybe so??

DG

RE: loading macros at startup

SW doesnt have the 'Application' OLE interface, and doesnt allow 'embedded' macros like you'd see in Excel or Acad.

The 3 ways I know of doing it are:
1) using the "-m" param
2) Making an addin
3) Making a macro feature. This last one doesnt really get
loaded at startup, but if you code for the regen event, will
basically get called right after the document is loaded.

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