明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: CADghost

如何在LSP中提取计算机信息

  [复制链接]
发表于 2004-8-16 14:17:00 | 显示全部楼层
Very good! Why my GetDrive method does not work? _$ (setq SYS (vlax-create-object "Scripting.FileSystemObject"))
(setq LIST_DRIVE (vlax-get-property SYS 'DRIVES))
(vlax-for ENT LIST_DRIVE
(setq
LST (append
LST
(list (strcat (vlax-get-property ENT 'DRIVELETTER) ":"))
)
)
)
#<VLA-OBJECT IFileSystem3 014b70c8>
#<VLA-OBJECT IDriveCollection 014b7480>
("A:" "C:" "D:" "H:" "I:" "J:" "L:" "M:" "N:" "O:" "P:" "Q:" "R:" "T:" "U:" "V:")
_$ (VLAX-DUMP-OBJECT SYS T)
; IFileSystem3: FileSystemObject
; Property values:
; Drives (RO) = #<VLA-OBJECT IDriveCollection 014b7480>
; Methods supported:
; BuildPath (2)
; CopyFile (3)
; CopyFolder (3)
; CreateFolder (1)
; CreateTextFile (3)
; DeleteFile (2)
; DeleteFolder (2)
; DriveExists (1)
; FileExists (1)
; FolderExists (1)
; GetAbsolutePathName (1)
; GetBaseName (1)
; GetDrive (1)
; GetDriveName (1)
; GetExtensionName (1)
; GetFile (1)
; GetFileName (1)
; GetFileVersion (1)
; GetFolder (1)
; GetParentFolderName (1)
; GetSpecialFolder (1)
; GetStandardStream (2)
; GetTempName ()
; MoveFile (2)
; MoveFolder (2)
; OpenTextFile (4)
T
_$ (VLAX-INVOKE SYS "GETDRIVE" "F:")
; error: An error has occurred inside the *error* functionAutoCAD variable setting rejected: "OSMODE" nil
_$ (VLAX-INVOKE-METHOD SYS 'GETDRIVE "F:")
; error: An error has occurred inside the *error* functionAutoCAD variable setting rejected: "OSMODE" nil
发表于 2004-8-17 07:52:00 | 显示全部楼层
;;("A:" "C:" "D:" "H:" "I:" "J:" "L:" "M:" "N:" "O:" "P:" "Q:" "R:" "T:" "U:" "V:")
;;你没有"F:"呀!!
发表于 2004-8-17 09:45:00 | 显示全部楼层
Sorry, I was lost. Now, what's matter again? _4$ (VLAX-INVOKE-METHOD SYS 'GETFOLDER "H:\\GC")
#<VLA-OBJECT IFolder 014b6b58>
_4$ (VLAX-INVOKE-METHOD SYS 'GETDRIVE "C:")
#<VLA-OBJECT IDrive 014b6c50>
_4$ (VLAX-INVOKE-METHOD SYS 'MOVEFOLDER "H:\\GC" "C:")
; error: Automation Error. Description was not provided.
_5$
发表于 2004-8-17 16:31:00 | 显示全部楼层

MoveFolder Method

Moves one or more folders from one location to another.

object.MoveFolder ( source, destination );

Arguments

object

Required. Always the name of a FileSystemObject.

source

Required. The path to the folder or folders to be moved. The source argument string can contain wildcard characters in the last path component only.

destination

Required. The path where the folder or folders are to be moved. The destination argument can't contain wildcard characters.

Remarks

If source contains wildcards or destination ends with a path separator (\), it is assumed that destination specifies an existing folder in which to move the matching files. Otherwise, destination is assumed to be the name of a destination folder to create. In either case, three things can happen when an individual folder is moved:

· If destination does not exist, the folder gets moved. This is the usual case.

· If destination is an existing file, an error occurs.

· If destination is a directory, an error occurs.

An error also occurs if a wildcard character that is used in source doesn't match any folders. The MoveFolder method stops on the first error it encounters. No attempt is made to roll back any changes made before the error occurs.

Important : This method allows moving folders between volumes only if supported by the operating system

(setq SYS (vlax-create-object "Scripting.FileSystemObject"))
(VLAX-INVOKE-METHOD SYS 'MOVEFOLDER "D:\\AA" "D:\\LSP\\")

发表于 2004-8-17 20:37:00 | 显示全部楼层
  1. Important : This method allows moving folders between volumes only if supported by the operating system
复制代码
的确,在同一个盘内移动文件夹没问题,但磁盘之间就要supported by operation system, 不明白。究竟怎样才行?谢谢了,送花一朵
发表于 2004-8-18 17:18:00 | 显示全部楼层
还有很多方法呀! ; Methods supported:
; BuildPath (2)
; CopyFile (3)
; CopyFolder (3)
; CreateFolder (1)
; CreateTextFile (3)
; DeleteFile (2)
; DeleteFolder (2)
; DriveExists (1)
; FileExists (1)
; FolderExists (1)
; GetAbsolutePathName (1)
; GetBaseName (1)
; GetDrive (1)
; GetDriveName (1)
; GetExtensionName (1)
; GetFile (1)
; GetFileName (1)
; GetFileVersion (1)
; GetFolder (1)
; GetParentFolderName (1)
; GetSpecialFolder (1)
; GetStandardStream (2)
; GetTempName ()
; MoveFile (2)
; MoveFolder (2)
; OpenTextFile (4)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-18 22:40 , Processed in 0.168852 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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