Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

loading macros at startup

Status
Not open for further replies.

dgiy

Chemical
Joined
May 5, 2003
Messages
89
Location
US
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
 
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
Shareware, freeware, tools and macros
 
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?
 
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
Shareware, freeware, tools and macros
 
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
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top