找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 611|回复: 28

5.1.6:mastercam后处理中增加电脑用户名开发实例-实例下载

 火.. [复制链接]

433

主题

5759

回帖

901万

积分

管理员

积分
9014266
发表于 2012-6-7 16:46:28 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区

您需要 登录 才可以下载或查看,没有账号?立即注册

×
5.1.6:mastercam后处理中增加电脑用户名开发实例
2 B- M: W! u6 a* Wmastercam v9.1代码( W& M' @  A# X9 s$ M
1.首先定义vbs脚本文件路径6 g, ~6 a- {( O! a) T7 h0 ?
strVBS_user   "C:\Documents and Settings\All Users\Documents\shared mcamx5\vb\Call_username.VBS"
$ c/ ?* u, c0 w+ u4 h3 G$ R  v# F" N3 z1 i0 x
2.定义读取外部数据的参数,这里我们用80,加大读取外部数据的缓冲区
7 S( C2 P; f) P# A  v' u& E( P' h" n& P#-----------------------------------------------------------------------------# d6 d$ }. |- X. U8 H6 W. M  A
# Define a string that holds the name of the  VBS script to be run.
  N1 v/ e! \; \#-----------------------------------------------------------------------------
: h5 j6 D! Q  {8 c5 t$ Y4 Wfbuf  3  0  80  1 1# Define a string buffer (3rd parameter is '80')/ x9 X& K- h- \% v
sbufname3  : "username.txt"  # "Point" to the external text file
9 r8 L7 Y) k& }rc3 : 0     # This variable will be the 'record read pointer' for buffer 3
' d1 U1 o$ F- R% d( jb3_size : 0 # Define a variable to hold the 'size' of the buffer
; s6 N8 n- M: v5 b            # The '0' record of a buffer ALWAYS contains a  numeric value , [4 w  F" S+ v2 u8 r
            # which is how many records in the buffer.  {: Z( J1 {, W
stext  : ""      # Define a string variable to hold a line of text read in from
' b: E/ o3 m1 l& P            # the buffer
/ v- B6 Q% c8 H# c! |
$ X6 H0 u8 @8 p" ?5 q3.增加读取外部数据到当前程序的命令
( Y5 s( T9 F- |: ?preadbuf3  # Call to our postlock that reads in from buffer #3 (6/21/2002)
9 V0 t' o5 F5 K3 h0 i4 l% ^      #------ #Added (6/21/2002) ------
0 T% B3 }. p+ P/ g( s+ ]/ {      sbufname3 = spathnc + sbufname3
! N% k% r) w# K9 S9 F* G6 r5 v      b3_size = rbuf(3, 0) # The '0' record of a buffer ALWAYS contains a
3 n5 W& }$ @" }' f9 _, Q                           # numeric value = how many records in the buffer.' T+ [4 Z+ {4 [+ v
      rc3 = 1   # Our text data start at record #19 C( y* W3 g$ H
      while rc3 <= b3_size,3 z# r5 L5 }( [- H8 U) C
        [
: {% v7 g( ?( B8 F1 R% p. a" Q          stext = rbuf (3, rc3)
# Z2 P; A* \. j# l) Q. f6 c& p          stext = ucase (stext)8 O/ ?5 q" k' e$ Z
          "(CREAT BY - ",stext,")",e, b1 m$ ?* c8 u
          result = remove(sbufname3)4 p0 I% d# E6 O: i% O# z
          #plice1# E5 o; J- e: Y
        ]7 ~. O' e) A5 w7 o- P& n
8 L. n$ K9 t3 z3 ?1 E8 F$ W; H* g
4.在需要输出用户名的位置调用preadbuf3命令块
% p+ N- ?  l' T5 N  Q$ R
) Z* Y; t6 Q  C2 K/ [5.在pheader 下面增加运行vbs脚本的代码$ |7 Z2 c+ z% E) i  n  ?) s
      result = runvbs(strVBS_user)   
* J: b! z; S6 Z" O" e# w% q/ E+ Z7 f+ c$ y/ U6 n/ {
6.问题,为何要放在pheader下面?; r/ ^; |( p5 r+ x

, m# E5 L. Y1 t% K% b) y% }4 K# D
7 l; k/ q/ K1 ]1 f4 A, G! H$ K$ G; {8 d" w6 ^4 c: C  i5 m+ ]
mastercam X5代码, {; z0 x9 i' W; K) y" i/ K" `
1.首先定义vbs脚本文件路径
  J# [6 P% L5 C7 YstrVBS_user  : "C:\Documents and Settings\All Users\Documents\shared mcamx5\vb\Call_username.VBS"( ~+ A5 u. h2 V' Y9 o% r( a1 V
' b1 [  C4 d" i/ X0 E9 K. e  I2 Z( X
2.定义读取外部数据的参数,这里我们用80
  Q* a' `9 _* f#-----------------------------------------------------------------------------
' p) N  h9 T6 O6 z, `# Define a string that holds the name of the  VBS script to be run.
1 W5 P$ N* J/ V1 T+ Q6 M#-----------------------------------------------------------------------------, V( W1 q7 p1 _
fbuf  3  0  80  1 1# Define a string buffer (3rd parameter is '80')
& `# p( g0 W. ?$ @2 v" {% ~8 Jsbufname3$  : "username.txt"  # "Point" to the external text file
) u0 s# m: \" E1 y, a4 c' wrc3 : 0     # This variable will be the 'record read pointer' for buffer 3. S6 h  F4 m4 z  B
b3_size : 0 # Define a variable to hold the 'size' of the buffer
+ F! _( K5 X$ c            # The '0' record of a buffer ALWAYS contains a  numeric value ; g! U1 {$ z/ p& a/ O
            # which is how many records in the buffer.# i( M' f3 M" J0 I. ~  V: I
stext  : ""      # Define a string variable to hold a line of text read in from
% W. N, A) y5 m            # the buffer
* J" p5 v/ ?. d. i6 [0 i2 O1 H* J& s
3.增加读取外部数据到当前程序的命令! q8 q  ^% ~' m+ F" @! r* B
preadbuf3  # Call to our postlock that reads in from buffer #3 (6/21/2002)' Z; B5 V2 R8 Q( r# e1 ~! M+ p% U
      #------ #Added (6/21/2002) ------7 D# v- }; F0 X, b; D
      sbufname3$ = spathnc$ + sbufname3$
  \$ P: Q1 {& c% b      b3_size = rbuf(3, 0) # The '0' record of a buffer ALWAYS contains a ) v# S- `. w) e+ e, d0 D/ F7 {; Z, [  ^" L
                           # numeric value = how many records in the buffer.# d# `( @! X& e7 P  [5 i
      rc3 = 1   # Our text data start at record #1
1 d$ Y5 o: |/ H2 b! I8 p: w$ d: Z& t      while rc3 <= b3_size,& |4 L* W  m$ S! E6 z" L* `" W
        [; V- c9 W1 ]' ?# G1 Q. T& c
          stext = rbuf (3, rc3)
* _. ~& D" ]$ G  K! Y          stext = ucase (stext)4 }2 F; i5 |- @- P( O" B
          "(CREAT BY - ",stext,")",e$
9 U' q  x9 f* B; e) U          result = remove(sbufname3$)
$ \+ g" t) T) ]          #plice1% T' a7 L; T1 J/ n9 @; ?
        ]
7 Q7 k; {5 T  N* h  a1 g7 |( x. n( w) p. V  q& Q+ }: Y
4.在需要输出用户名的位置调用preadbuf3命令块, h0 M; \' m" L" A" D' M
) P+ o, a0 T3 ~, y4 y
5.在pheader$ 下面增加运行vbs脚本的代码
: r0 Q' i+ D6 v6 z9 s. }      result = runvbs(strVBS_user)   5 C0 Z( L9 K2 g* h- H0 U

4 e. z$ h5 y6 L/ V6.问题,为何要放在pheader$下面?- G9 ^, d2 n- j

6 I1 X5 I) p' Z" R0 U# k下面是做好的后处理,可直接使用9 y/ d% E! ~# P6 L% Y% P
解压密码:http://postp.net
! g" u% P- m* H1 T& g( M9 V  G' z3 E4 |) {
游客,如果您要查看本帖隐藏内容请回复

18

主题

157

回帖

654

积分

高级会员

积分
654
QQ
发表于 2013-3-19 00:26:18 | 显示全部楼层
用于加密码吗
柠檬汽水
回复

使用道具 举报

433

主题

5759

回帖

901万

积分

管理员

积分
9014266
 楼主| 发表于 2013-3-19 18:58:42 | 显示全部楼层
回复 3# cy791231
% W4 ^5 O- l9 ?, v# a$ Y& U( x4 d4 f' A% f2 W7 h8 ?* O% r
0 U; _& ?& T6 F/ L) C- D, f& b
    你将该方法变通一下即可成为一个超级密码了,使用时必需把电脑用户名设为你预设的名字,否则将失效,这样的后处理我曾经帮一个公司写过。
回复

使用道具 举报

3

主题

90

回帖

62

积分

注册会员

积分
62
QQ
发表于 2013-6-13 02:05:47 | 显示全部楼层
老大都有隐藏啊
回复

使用道具 举报

3

主题

90

回帖

62

积分

注册会员

积分
62
QQ
发表于 2013-6-13 02:06:45 | 显示全部楼层
附件都下载不看
回复

使用道具 举报

25

主题

321

回帖

475

积分

中级会员

积分
475
发表于 2014-1-23 15:21:20 | 显示全部楼层
这个板块这么多好东西啊
回复

使用道具 举报

0

主题

20

回帖

16

积分

新手上路

积分
16
QQ
发表于 2014-2-17 18:48:26 | 显示全部楼层
这个板块好东西非常多
回复

使用道具 举报

1

主题

18

回帖

19

积分

新手上路

积分
19
发表于 2014-10-4 18:23:01 | 显示全部楼层
这么好的东西,必须收藏
回复

使用道具 举报

0

主题

5

回帖

5

积分

新手上路

积分
5
发表于 2014-12-28 21:50:06 | 显示全部楼层
学习中,顶一下
回复

使用道具 举报

6

主题

81

回帖

258

积分

注册会员

积分
258
发表于 2015-2-24 00:33:40 | 显示全部楼层
貌似版主很久没更新了,可以按教程顺序排列一下吗,全部打基础标签,不然找起来很麻烦,希望版主继续写第六部基础教程
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /2 下一条

QQ|Archiver|手机版|小黑屋|若枫后处理论坛 ( 苏ICP备11015087号-1|苏公网安备32059002001368号 )

GMT+8, 2026-8-14 19:16 , Processed in 0.196465 second(s), 28 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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