明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1493|回复: 2

LISP 改驱动器序列号

[复制链接]
发表于 2009-8-10 14:34:00 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2009-8-11 11:24:00 | 显示全部楼层
;;;VxListNetworkDrives - Returns a list of all mapped network drives with UNC...

;
; -- Function VxListNetworkDrives
; Returns a list of all mapped network drives with UNC path.
; Copyright:
;   ©2005 MENZI ENGINEERING GmbH, Switzerland
; Arguments [Type]:
;   --- =
; Return [Type]:
;   > List of mapped drives '(("X:" . "\\\\Server\\Xpath")...) [LIST]
; Notes:
;   - Requires ScrRun.dll (see also notes at top of page).
;
(defun VxListNetworkDrives ( / DrvCol ItmCnt RetVal WsnObj)
 (setq WsnObj (vlax-create-object "WScript.Network")
       DrvCol (vlax-invoke WsnObj 'EnumNetworkDrives)
       ItmCnt 0
 )
 (repeat (/ (vlax-invoke DrvCol 'Count) 2)
  (setq RetVal (cons
                (cons
                 (strcase (vla-Item DrvCol ItmCnt))
                 (vla-Item DrvCol (1+ ItmCnt))
                )
                RetVal
               )
        ItmCnt (+ ItmCnt 2)
  )
 )
 (vlax-release-object WsnObj)
 (reverse RetVal)
)


;;;VxRemapNetworkDrives - Remaps a network drive to another drive letter

;
; -- Function VxRemapNetworkDrive
; Remaps a network drive to another drive letter.
; Copyright:
;   ©2005 MENZI ENGINEERING GmbH, Switzerland
; Arguments [Type]:
;   Old = Old drive letter, e.g. "X:" [STR]
;   New = New drive letter, e.g. "Y:" [STR]
; Return [Type]:
;   > True: Remapping successful
;   > False: Remapping failed
; Notes:
;   - Requires ScrRun.dll (see also notes at top of page).
;
(defun VxRemapNetworkDrive (Old New / OldUnc RetVal WsnObj)
 (setq WsnObj (vlax-create-object "WScript.Network")
       OldUnc (cdr (assoc (strcase Old) (VxListNetworkDrives)))
 )
 (cond
  ((vl-catch-all-apply
    'vlax-invoke
    (list WsnObj 'RemoveNetworkDrive Old :vlax-true :vlax-true)
   )
  )
  ((vl-catch-all-apply
    'vlax-invoke
    (list WsnObj 'MapNetworkDrive New OldUnc :vlax-true)
   )
  )
  ((setq RetVal T))
 )
 (vlax-release-object WsnObj)
 RetVal
)
 楼主| 发表于 2009-8-11 15:17:00 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-6 03:16 , Processed in 0.170902 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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