Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

VBScript RunMasterCamCommand ?


Recommended Posts

confused.gif Is there an easy way to script responses to recurring menu prompts.

 

For example graphics view only arcs or mask arcs of a color or level. No logical decisions involved just a scripted response to imitate a mouse click or keyboard button.

 

Thanks in advance Charlie

 

There is no such thing as a five minute job. :

Link to comment
Share on other sites

Do a search Matt aka Rekd has covered this well. I know you have to define some of the 9000 constants as they are called. I was doing a fit screen to clipboard script and he helped me by showing me that I had to define the clipboard at the beginning of the script.

 

HTH

 

But incase you can not find it here is the 9000 list from the Mill9.TXT file This is from MR105:

code:

(function name: description [maximum length: 8:30])

9000. "12345678: 123456789012345678901234567890"

9001. "zoom: Screen-Zoom" _

9002. "unzoom: Screen-Unzoom" _

9003. "repaint: Screen-Repaint" _

9004. "analyze: Analyze" _

9005. "delete: Delete" _

9006. "file: File" _

9007. "modify: Modify" _

9008. "create: Create" _

9009. "dispinfo: Screen-Display info" _

9010. "help: Help" _

9011. "fit: Screen-Fit" _

9012. "unzoom8: Screen-Unzoom by 0.8" _

9013. "curpos: Cursor Tracking (Toggle)" _

9014. "delwndw: Delete-Window" _

9015. "editfile: File-Edit" _

9016. "blank: Screen-Blank" _

9017. "config: Screen-Configure" _

9018. "drwaxes: Screen-Draw axes" _

9019. "rundll: Execute C-Hook" _

9020. "draftpm: Draft-Globals" _

9021. "font: Menu Font" _

9022. "" _

9023. "mmalloc: List Memory" _

9024. "mfile: List Files" _

9025. "undo: Undo" _

9026. "surfdisp: Screen-Surf Disp" _

9027. "drawnc: Screen-Draw Toolpath" _

9028. "vwports: Screen-Viewports" _

9029. "version: Version" _

9030. "xform: Xform" _

9031. "autosave: File-AutoSave" _

9032. "group: Groups" _

9033. "chgcolrs: Screen-Change Colors" _

9034. "chglevs: Screen-Change Levels" _

9035. "autocl: Automatic Centerlines" _

9036. "color: Main Color" _

9037. "level: Levels-Main" _

9038. "mask: Levels-Mask" _

9039. "tplane: Tplane" _

9040. "cplane: Cplane" _

9041. "gview: Gview" _

9042. "zdepth: Cplane-Depth" _

9043. "levdlg: Levels-Dialog" _

9044. "vislev: Levels-Visible" _

9045. "toolbar: Toolbar Visible (Toggle)" _

9046. "dbstats: Screen-Statistics" _

9047. "endpts: Screen-Endpoints" _

9048. "clrcolrs: Screen-Clear Colors" _

9049. "shade: Screen-Surf Disp-Shading" _

9050. "crpoint: Create-Point" _

9051. "crptpos: Create-Point-Position" _

9052. "ptalong: Create-Point-Along Entity" _

9053. "nodepts: Create-Point-Node Points" _

9054. "ctrlpts: Create-Point-Cpts NURBS" _

9055. "ptdynmic: Create-Point-Dynamic" _

9056. "crptlen: Create-Point-Length" _

9057. "ptsrfprj: Create-Point-Surface Project" _

9058. "crline: Create-Line" _

9059. "clhorz: Create-Line-Horizontal" _

9060. "clvert: Create-Line-Vertical" _

9061. "clepts: Create-Line-Endpoints" _

9062. "clmulti: Create-Line-Multi" _

9063. "clpolar: Create-Line-Polar" _

9064. "cltan: Create-Line-Tangent" _

9065. "cltanang: Create-Line-Tangent-Angle" _

9066. "cltan2a: Create-Line-Tangent-2 Arcs" _

9067. "cltanpt: Create-Line-Tangent-Point" _

9068. "clperp: Create-Line-Perpendicular" _

9069. "clparal: Create-Line-Parallel" _

9070. "crarc: Create-Arc" _

9071. "capolar: Create-Arc-Polar" _

9072. "cactrpt: Create-Arc-Polar-Center Point" _

9073. "casktch: Create-Arc-Polar-Sketch" _

9074. "castart: Create-Arc-Polar-Start Point" _

9075. "caend: Create-Arc-Polar-End Point" _

9076. "caepts: Create-Arc-Endpoints" _

9077. "ca3pts: Create-Arc-3 points" _

9078. "catan: Create-Arc-Tangent" _

9079. "catan1: Create-Arc-Tangent-1 Entity" _

9080. "catan3: Create-Arc-Tangent-3 Entities" _

9081. "catanpt: Create-Arc-Tangent-Point" _

9082. "ca2ptcir: Create-Circle-2 Points" _

9083. "ca3ptcir: Create-Circle-3 Points" _

9084. "captrad: Create-Circle-Point/Radius" _

9085. "captdia: Create-Circle-Point/Diameter" _

9086. "captedge: Create-Circle-Point/Edge" _

9087. "crfillet: Create-Fillet" _

9088. "crspline: Create-Spline" _

9089. "crcurve: Create-Curve" _

9090. "ellipse: Create-Ellipse" _

9091. "ccconst: Create-Curve-Const Parameter" _

9092. "ccedge: Create-Curve-One Edge" _

9093. "ccinter: Create-Curve-Intersect" _

9094. "ccpatch: Create-Curve-Patch Boundaries" _

9095. "ccflow: Create-Curve-Flowline" _

9096. "ccproj: Create-Curve-Project" _

9097. "ccdynmic: Create-Curve-Dynamic" _

9098. "ccpart: Create-Curve-Parting Line" _

9099. "crsurf: Create-Surface" _

9100. "csloft: Create-Surface-Loft" _

9101. "cscoons: Create-Surface-Coons" _

9102. "csruled: Create-Surface-Ruled" _

9103. "csrev: Create-Surface-Revolved" _

9104. "csswept: Create-Surface-Swept" _

9105. "csdraft: Create-Surface-Draft" _

9106. "csfillet: Create-Surface-Fillet" _

9107. "csofst: Create-Surface-Offset" _

9108. "cstrim: Create-Surface-Trim" _

9109. "csblend: Create-Surface-2 Surface Blend"_

9110. "crrec: Create-Rectangle" _

9111. "rec1pt: Create-Rectangle-1 Point" _

9112. "rec2pts: Create-Rectangle-2 Points" _

9113. "crdraft: Create-Drafting" _

9114. "cddim: Create-Drafting-Dimension" _

9115. "crnote: Create-Drafting-Note" _

9116. "crlabel: Create-Drafting-Label" _

9117. "crleader: Create-Drafting-Leader" _

9118. "crwit: Create-Drafting-Witness Line" _

9119. "eddraft: Create-Drafting-Multi edit" _

9120. "crhatch: Create-Drafting-Hatch" _

9121. "chamfer: Create-Chamfer" _

9122. "crlets: Create-Letters" _

9123. "pattern: Create-Pattern" _

9124. "anzpt: Analyze-Point" _

9125. "anzonly: Analyze-Only" _

9126. "anzbpts: Analyze-Between points" _

9127. "anzang: Analyze-Angle" _

9128. "anzdynm: Analyze-Dynamic" _

9129. "anzarea: Analyze-Area Calculations" _

9130. "eamod: Entity Attributes (Apply)" _

9131. "anzscurv: Analyze-Surfaces-Curvature" _

9132. "anznorm: Analyze-Surfaces-Test Normals" _

9133. "anzbase: Analyze-Surfaces-Base Surfs" _

9134. "delchain: Delete-Chain" _

9135. "deldup: Delete-Duplicate" _

9136. "delonly: Delete-Only" _

9137. "delall: Delete-All" _

9138. "delgrp: Delete-Group" _

9139. "delreslt: Delete-Result" _

9140. "crptperp: Create-Point-Perpendicular" _

9141. "crptcirc: Create-Point-Small Circles _

9142. "undelete: Delete-Undelete" _

9143. " " _

9144. "filemrg: File-Merge" _

9145. "filesave: File-Save" _

9146. "fileget: File-Get" _

9147. "hardcopy: File-Hardcopy" _

9148. "browse: File-Browse" _

9149. "communic: File-Communications" _

9150. "convert: File-Convert" _

9151. "ascii: File-Convert-ASCII" _

9152. "cadl: File-Convert-CADL" _

9153. "dxf: File-Convert-DXF (pre-V9)" _

9154. "iges: File-Convert-IGES" _

9155. "vda: File-Convert-VDA" _

9156. " " _

9157. "renumber: File-Renumber" _

9158. " " _

9159. "shell: File-DOS Shell" _

9160. "levelrep: Levels-Report" _

9161. "trim: Modify-Trim" _

9162. "trim1: Modify-Trim-1 Entity" _

9163. "trim2: Modify-Trim-2 Entities" _

9164. "trim3: Modify-Trim-3 Entities" _

9165. "trim2pt: Modify-Trim-To Point" _

9166. "trimmany: Modify-Trim-Many" _

9167. "closearc: Modify-Trim-Close Arc" _

9168. "divide: Modify-Trim-Divide" _

9169. "break: Modify-Break" _

9170. "brkarcs: Modify-Break-Arcs" _

9171. "brkmany: Modify-Break-Many Pieces" _

9172. "brk2pcs: Modify-Break-2 Pieces" _

9173. "brklen: Modify-Break-At Length" _

9174. "brknote: Modify-Break-Draft/Line" _

9175. "brkhatch: Modify-Break-Hatch/Line" _

9176. "brkcdata: Modify-Break-Cdata/Line" _

9177. "join: Modify-Join" _

9178. "modnorm: Modify-Normal" _

9179. "modnbs: Modify-Cpts NBS" _

9180. "x2nbs: Modify-X to NBS" _

9181. "extend: Modify-Extend" _

9182. "drag: Modify-Drag" _

9183. "scrnctr: Screen-Center" _

9184. "initscrn: File-New" _

9185. "combvws: Screen-Combine Views" _

9186. "plot: Screen-Plot" _

9187. "xfmmir: Xform-Mirror" _

9188. "xfmrot: Xform-Rotate" _

9189. "xfmscale: Xform-Scale" _

9190. "xfmsqsh: Xform-Squash" _

9191. "xfmtrans: Xform-Translate" _

9192. "xfmofst: Xform-Offset" _

9193. "xfmoctr: Xform-Offset Contour" _

9194. "tpmenu: Toolpaths" _

9195. "contour: Toolpaths-Contour" _

9196. "drill: Toolpaths-Drill" _

9197. "pocket: Toolpaths-Pocket" _

9198. "ncflow: Toolpaths-Flowline" _

9199. "ncmsurf: Toolpaths-Surface" _

9200. "ncproj: Toolpaths-Project" _

9201. "nctrim: Toolpaths-Trim" _

9202. "***** not used *****" _

9203. "nccoons: Toolpaths-Coons" _

9204. "ncruled: Toolpaths-Ruled" _

9205. "ncswept: Toolpaths-Swept" _

9206. "ncrev: Toolpaths-Revolution" _

9207. "***** not used *****" _

9208. "manent: Toolpaths-Manual Entry" _

9209. "ncpoint: Toolpaths-Point" _

9210. "***** wire *****" _

9211. "ncutils: NC Utils" _

9212. "actour: Analyze-Contour" _

9213. "backplot: NC Utils-Backplot" _

9214. "***** not used *****" _

9215. "filter: NC Utils-Filter" _

9216. "pstmenu: NC Utils-Post" _

9217. "pstchg: NC Utils-Post-Change" _

9218. "pstrun: NC Utils-Post-Run" _

9219. "pstrev: NC Utils-Post-Reverse" _

9220. "deftls: NC Utils-Define Tools" _

9221. "setsht: NC Utils-Setup Sheet" _

9222. "***** not used *****" _

9223. "exefunc: Execute Function" _

9224. "prompt: Prompt Visible (Toggle)" _

9225. "gvtop: Gview-Top" _

9226. "gvfront: Gview-Front" _

9227. "gvside: Gview-Side" _

9228. "gviso: Gview-Isometric" _

9229. "gvnum: Gview-Number" _

9230. "gvlast: Gview-Last" _

9231. "gvent: Gview-Entity" _

9232. "gvrot: Gview-Rotate" _

9233. "gvmouse: Gview-Mouse" _

9234. "gvdymic: Gview-Dynamic" _

9235. "cporgn: Cplane-Origin" _

9236. "cp3d: Cplane-3D" _

9237. "cptop: Cplane-Top" _

9238. "cpfrnt: Cplane-Front" _

9239. "cpside: Cplane-Side" _

9240. "cpnum: Cplane-Number" _

9241. "cplast: Cplane-Last" _

9242. "cpent: Cplane-Entity" _

9243. "cprot: Cplane-Rotate" _

9244. "cpnorm: Cplane-Normal" _

9245. "cpmouse: Cplane-Mouse" _

9246. "cppxz: Cplane-XZ(+)" _

9247. "cpnxz: Cplane-XZ(-)" _

9248. "cppdz: Cplane-DZ(+)" _

9249. "cpndz: Cplane-DZ(-)" _

9250. "eamgr: Entity Attributes Manager" _

9251. "extsrf: Modify-Surface-Extend" _

9252. "clipbrd: Screen-To Clipboard" _

9253. "regen: Screen-Regenerate" _

9254. "slccrvs: Create-Point-Slice" _

9255. "slcsrfs: Create-Curve-Slice" _

9256. "catan2: Create-Arc-Tangent-2 Entities" _

9257. "circmill: Toolpaths-Circle Mill" _

9258. "sprlhlx: Create-Spiral/Helix _

9259. "crptgrid: Create-Point-Grid" _

9260. "crptbcir: Create-Point-Bolt Circle" _

9261. "fillet: Create-Fillet-2 Entities" _

9262. "filletc: Create-Fillet-Chain" _

9263. "mcplay: Macro-Playback (Toggle)" _

9264. "mcrec: Macro-Record (Toggle)" _

9265. "mcstop: Macro-Pause (Toggle)" _

9266. "anzsnrms: Analyze-Surfaces-Set Normals" _

9267. "crpolyg: Create-Polygon" _

9268. "clprppt: Create-Line-Perpendicular-Pt" _

9269. "clprpar: Create-Line-Perpendicular-Arc" _

9270. "clplldst: Create-Line-Parallel-Dist/Side"_

9271. "clpllpt: Create-Line-Parallel-Point" _

9272. "clpllar: Create-Line-Parallel-Arc" _

9273. "clbisect: Create-Line-Bisect" _

9274. "catancl: Create-Arc-Tangent-Center Line"_

9275. "undelent: Delete-Undelete-Single" _

9276. "hide: Hide" _

9277. "gridprms: Screen-Grid" _

9278. "catadyn: Create-Arc-Tangent-Dynamic" _

9279. "ramsaver: File-RAMsaver" _

9280. "chgattrs: Screen-Change Attributes" _

9281. "jobsetup: Toolpaths-Job Setup" _

9282. "oplist: Toolpaths-Operations Manager" _

9283. "namview: WCS / View Manager" _

9284. "cnv2arcs: Modify-Convert to Arcs" _

9285. "ccedges: Create-Curve-All Edges" _

9286. "studio: Screen-Surf Disp-Studio" _

9287. "clclose: Create-Line-Closest" _

9288. "autocur: AutoCursor (Toggle)" _

9289. "shadetog: Fulltime Shading (Toggle)" _

9290. "quitop: Delete-Last Operation" _

9291. "editlast: Modify-Last Operation" _

9292. "grnamed: Gview-Named" _

9293. "cpnamed: Cplane-Named" _

9294. "tpnamed: Tplane-Named" _

9295. "multiax: Toolpaths-MultiAxis" _

9296. "curve5ax: Toolpaths-Curve 5 Axis" _

9297. "drill5ax: Toolpaths-Drill 5 Axis" _

9298. "swarf5ax: Toolpaths-Swarf 5 Axis Floor" _

9299. "flow5ax: Toolpaths-Flow 5 Axis" _

9300. "rotary4x: Toolpaths-Rotary 4 Axis" _

9301. "grnormal: Gview-Normal" _

9302. "greqcpln: Gview-Equals Cplane" _

9303. "greqtpln: Gview-Equals Tplane" _

9304. "autodesk: File-Convert-AutoDesk" _

9305. " " _

9306. "dfregen: Draft-Regenerate-All" _

9307. "dfrgsel: Draft-Regenerate-Selected" _

9308. "dfrgaut: Draft-Regenerate-Auto (Toggle)"_

9309. "crdmhz: Create-Dimension-Horizontal" _

9310. "crdmvt: Create-Dimension-Vertical" _

9311. "crdmpll: Create-Dimension-Parallel" _

9312. "crdman: Create-Dimension-Angular" _

9313. "crdmdia: Create-Dimension-Circular" _

9314. "" _

9315. "crdmbsln: Create-Dimension-Baseline" _

9316. "crdmchn: Create-Dimension-Chained" _

9317. "crdmord: Create-Dimension-Ordinate" _

9318. "crdmpt: Create-Dimension-Point" _

9319. "dfvdate: Draft-Regenerate-Validate" _

9320. "sldhist: Create-Solids-History" _

9321. "sldmake: Create-Solids" _

9322. "hidemore: Hide-Hide More" _

9323. "unhdsome: Hide-Unhide Some" _

9324. "makebbox: Create-Bounding Box" _

9325. "setmain: Levels-Main (from entity)" _

9326. "gvbottom: Gview-Bottom" _

9327. "gvback: Gview-Back" _

9328. "gvleft: Gview-Left" _

9329. "***** wire *****" _

9330. "csblend3: Create-Surface-3 Surface Blend"_

9331. "csblendf: Create-Surface-Fillet Blend" _

9332. "csprim: Create-Surface-Primitive" _

9333. "csrfsld: Create-Surface-From Solid" _

9334. "tscurves: Modify-Surface-Trim-To Curves" _

9335. "tsplane: Modify-Surface-Trim-To Plane" _

9336. "tssurfs: Modify-Surface-Trim-To Surfs" _

9337. "tsfbnd: Modify-Surface-Trim-Flat Bndy" _

9338. "tsuntrm: Modify-Surface-Untrim" _

9339. "tsrbnd: Modify-Surface-Remove Bndy" _

9340. "tssplit: Modify-Surface-Split" _

9341. "dragnote: Modify-Drag-Note" _

9342. "dfshow: Draft-Show Assoc" _

9343. "cpbottom: Cplane-Bottom" _

9344. "cpback: Cplane-Back" _

9345. "cpleft: Cplane-Left" _

9346. "cpeqgviw: Cplane-Equals Gview" _

9347. "cpeqtpln: Cplane-Equals Tplane" _

9348. "transtog: Translucent Shading (toggle)" _

9349. "" _

9350. "gvdypan: Gview-Dynamic Pan" _

9351. "gvdyzum: Gview-Dynamic Zoom" _

9352. "attribs: Attributes" _

9353. "anznumbr: Analyze-Number" _

9354. "anzchain: Analyze-Chain" _

9355. "anzckmdl: Analyze-Surfaces-Check Model" _

9356. "anzsmall: Analyze-Surfaces-Small Surfs" _

9357. "anzcksld: Analyze-Surfaces-Check Solid" _

9358. "xfmstrch: Xform-Stretch" _

9359. "xfmroll: Xform-Roll" _

9360. "sldext: Solids-Extrude" _

9361. "sldrev: Solids-Revolve" _

9362. "sldsweep: Solids-Sweep" _

9363. "sldloft: Solids-Loft" _

9364. "sldflt: Solids-Fillet" _

9365. "sldchmfr: Solids-Chamfer" _

9366. "sldshell: Solids-Shell" _

9367. "sldbool: Solids-Boolean" _

9368. "sldprim: Solids-Primitive" _

9369. "slddrfac: Solids-Draft face" _

9370. "sldtrim: Solids-Trim" _

9371. "sldlayot: Solids-Layout" _

9372. "sldfeat: Solids-Find features" _

9373. "sldthick: Solids-Thicken" _

9374. "sldrmfac: Solids-Remove faces" _


Link to comment
Share on other sites

Charlie, you can try using the SendKeys() method available in the Shell class for the WSH.

 

code:

Dim objShell     ' WSH Shell object

 

' create a WSH Shell object

Set objShell = CreateObject("WScript.Shell")

 

' Send some keys

objShell.SendKeys "a" ' imitates pressing the 'A' key

objShell.SendKeys "{ENTER}" ' imitates pressing the ENTER key

objShell.SendKeys "{F1}" ' imitates pressing the F1 key

objShell.SendKeys "%c" ' imitates pressing ALT+C keys

 

' cleanup

Set objShell = Nothing

However, with Mastercam, I've noticed that SendKeys() doesn't always act as expected. Sometimes, you have to have your calls to SendKeys() in the reverse order that you'd normally perform them. Experiment and have fun cheers.gif

 

HTH

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...