几何尺寸与公差论坛

 找回密码
 注册
查看: 714|回复: 0

【转帖】need to auto run a macro on solidworks office pro 2007 start-up

[复制链接]
发表于 2009-4-13 13:03:35 | 显示全部楼层 |阅读模式
need to auto run a macro on solidworks office pro 2007 start-up
how can i configure / set-up solidworks office pro 2007 to run a macro on start-up?
browse to your program files solidworks dir. find sldworks.exe. rmb and send shortcut to desktop. rmb and edit the properties of the shortcut. change the "target" by adding a space then "/m" "your macro path and macroname.swp"
my example: "c:\program files\solidworks 2008\solidworks\sldworks.exe" "/m" "i:\~jbw-stds\api number generator addin\docnumbersfrommsaccess\insertpartnumber.swp" runs a next partnumber macro at each solidworks session startup.
you can't just edit the target of your solidworks icon because if you try you will find that the target is there but not editable.
also, if you start one macro this way, it could call any other multiple macros that you need to launch at startup as well.
rodney hall - cswp / cad admin / it / product design
president - catawba valley solidworks user group
catawbavalleyswug@gmail.com
swx 2009 sp1.0 / pdmw 2009 sp1.0
dell 690 (2) 2ghz 5130 xeon dual core
4gb ram, xp32 pro sp2
nvidia quadro fx 3450/4000 sdi
edited: 08/15/2008 at 03:12 pm by rodney hall
how do i run a macro from a shell script?
my code:
retval=shell(c:\xxx\solidworks.exe""/m""d:\xxx\xxx.swp")
this does not work?
can you help?
create a wshshell object and use it.
dim wshshell
' ------------------
' create wshshell object
' ------------------
set wshshell = nothing
set wshshell = wscript.createobject("wscript.shell")
if wshshell is nothing then
msgbox ("error: failed to create shell")
wscript.quit 99
end if
wshshell.run ("""c:\xxx\solidworks.exe""" & " /m ""d:\xxx\xxx.swp""")
cadcam systems analyst
-solidworks office premium 2009 sp3.0
-solidworks simulation premium 2009 sp3.0
-solidworks flow simulation 2009 sp3.0
-2 cpu (fx-62), 2.0 gb of ram
-window xp pro sp2
-nvidia geforce 7950 gx2 (512mb) 6.14.11.6921
william,
getting "object variable or with block variable not set" when running with visual basic.??
if not vb do you have code that will work in a .bat??
-regards-
if you want to run a macro every time solidworks starts without fail or shortcut tricks you can create a plugin that simply loads on startup and then calls swapp.runmacro. alternately you can edit the dde settings for .sld* file extensions from explorer->tools->folder options->file types, and add the /m extension to each of the file types in the advanced settings of the "open" command
dennis,
luke has a point and is much more consistent for an upon open do this operation. if you are doing vbs scripting then you can do a wshshell call or if it's bat or cmd scripting can do a start call.
cadcam systems analyst
-solidworks office premium 2009 sp3.0
-solidworks simulation premium 2009 sp3.0
-solidworks flow simulation 2009 sp3.0
-2 cpu (fx-62), 2.0 gb of ram
-window xp pro sp2
-nvidia geforce 7950 gx2 (512mb) 6.14.11.6921
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 14:41 , Processed in 0.037073 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表