mccad 发表于 2002-2-3 15:02:00

DOSLIB6.0函数简介--by陈勇笔记020201

DOSLIB6.0函数简介--by陈勇笔记020201


目 录(带*号的为doslib6.0的新函数)
doslib+vlisp
磁盘功能
路径名称
目录操作
文件操作
系统打印
注册表
运行命令
*字串类
对话框
系统环境
本机操作
本机环境
acad控制
系统用户
其他
关于doslib

--------------------------------------------------------------------------------


doslib+vlisp


[目录]

--------------------------------------------------------------------------------


磁盘功能

dos_chkdsk      dos_chkdsk      (dos_chkdsk )   返回磁盘空间值:(全部,已用,剩余)
   Example
   (dos_chkdsk)                (5.23526e+008 4.78839e+008 4.46874e+007)
--------------------
dos_drive      dos_drive   (dos_drive )   返回当前驱动器或转向新驱动器
   Example
   (dos_drive)               "C:"
   (dos_drive "z:")      "Z:"
--------------------
dos_drivep      (dos_drivep drive)判断驱动器是否存在
Example
   (dos_drivep "X:")         T if the specified drive exists.nil on error.
--------------------
dos_drives      dos_drives   (dos_drives)返回所有驱动器
Example
(dos_drives)      ("A:" "B:" "C:" "X:" "Y:" "Z:")
--------------------
dos_drivetype      dos_drivetype      (dos_drivetype )返回驱动器类型
removable, fixed, CD-ROM, RAMdisk, or a network drive.
Example
(dos_drive) ------"FIXED"
(dos_drive "f:") ------ "CDROM"
--------------------
dos_format      dos_format   (dos_format drive) 显示对话框选择磁盘 T 成功 nil 失败
Example
(dos_format "a:")      T
--------------------
dos_label      dos_label         (dos_label ])   返回驱动器卷标
Example
    (dos_label "d:" "drive-d")                "DRIVE-D"
--------------------
dos_serialno      dos_serialno      (dos_serialno )返回指定驱动器序列号    nil 失败
Example
   (dos_serialno)                "8CD63F34"
   (dos_label "d:" "drive-d")      "8048A4CC"

[目录]

--------------------------------------------------------------------------------


路径名称

dos_fullpath      dos_fullpath      (dos_fullpath path)      转为全路径,可用.\\ and ..\\
Example
(dos_fullpath "acad.dwg")                        "C:\\ ACAD\\ SUPPORT\\ ACAD.DWG"
(dos_fullpath "..\\ windows\\ win.ini")      "C:\\ WINDOWS\\ WIN.INI"
(dos_fullpath "z:")                              "Z:\\ PUBLIC"
--------------------
dos_makepath      dos_makepath      (dos_makepath drive directory filename extension)新建一个全称路径
A fully qualified path, nil if drive is not valid or on error.
Example
(dos_makepath "c:" "\\ acad" "acad" "exe")                "C:\\ ACAD\\ ACAD.EXE"
(dos_makepath "c:" "\\ acad" "" "")                        "C:\\ ACAD\\"
(dos_makepath "" "\\ acad" "acad" "exe")                "\\ ACAD\\ ACAD.EXE"
--------------------
dos_path      dos_path      (dos_path)返回当前dos搜寻路径
返回Current value of DOS PATH or SET PATH statement. nil on error.
Example
(dos_path)                ("C:\\ ACAD\\" "C:\\ WINDOWS\\" "C:\\ DOS\\ "Z:\\ PUBLIC")
--------------------
dos_splitpath      dos_splitpath      (dos_splitpath path)将全路径名称分为四块 nil on error.
Example
(dos_splitpath "c:\\ acad\\ acad.exe")                ("C:" "\\ ACAD\\" "ACAD" ".EXE")
(dos_splitpath "c:\\ acad\\")                              ("C:" "\\ ACAD\\" "" "")
(dos_splitpath "c:\\ acad")                              ("C:" "\\" "ACAD" "")


[目录]

--------------------------------------------------------------------------------


目录操作

dos_chdir      dos_chdir (dos_chdir path) 将当前目录改为另一个现有的指定目录 nil on error.
Example
(dos_chdir "test")               "C:\\ ACAD\\ TEST\\"
(dos_chdir "\\ drawings")          "C:\\ DRAWINGS\\"
(dos_chdir "z:\\")                "Z:\\"
--------------------
dos_deltree      (dos_deltree path)删除目录及子目录
Example
   (dos_deltree "c:\\ temp\\")
--------------------
dos_dirp(dos_dirp path)          判断目录是否存在
Example
   (dos_dirp "c:\\ temp\\")
--------------------
dos_getdir      dos_getdir   (dos_getdir title )浏览器选择目录
Example
(dos_getdir "选择目录:" "c:\\")      "C:\\ DRAWINGS\\ PROJECTS\\"
--------------------
dos_mkdir      dos_mkdir (dos_mkdir path)建一个新目录nil 失败
Example
(dos_mkdir "test")                "C:\\ ACAD\\ TEST\\"
(dos_mkdir "\\ drawings")      "C:\\ DRAWINGS\\"
--------------------
dos_rendir      dos_rendir   (dos_rendir oldpath newpath)目录改名 nil 失败
Example
(dos_rendir "test" "backup")                "C:\\ ACAD\\ BACKUP\\"
(dos_rendir "backup" "support")      nil
--------------------
dos_rmdir      dos_rmdir(dos_rmdir path)目录移动 nil 失败
Example
(dos_rmdir "test")                "C:\\ ACAD\\ TEST\\"
(dos_rmdir "\\ drawings")      "C:\\ DRAWINGS\\"
--------------------
dos_pwdir      dos_pwdir(dos_pwdir )返回当前盘当前目录或指定盘nil on error.
Example
(dos_pwdir)                "C:\\ ACAD\\
(dos_pwdir "z:")      "Z:\\ PUBLIC\\"
--------------------
dos_subdir      dos_subdir(dos_subdir )   返回当前目录或指定目录的子目录表 nil on error.
Example
(dos_subdir)                (".." "ADS" "API" "FONTS" "IGESFONTS" "SAMPLE" "SUPPORT")
(dos_subdir "c:\\")      ("ACAD" "DOS" "TEMP" "WINDOWS")
--------------------
dos_sysdir      dos_sysdir(dos_sysdir) 返回windows系统目录.
Example
(dos_sysdir)      "C:\\ WINDOWS\\ SYSTEM\\"
--------------------
dos_tempdir      dos_tempdir   (dos_tempdir) 返回临时文件目录 nil on error.
Example
(dos_tempdir)                "C:\\ WINDOWS\\ TEMP\\"
--------------------
dos_windir      dos_windir      (dos_windir)返回windows系统目录.
Example
(dos_windir)                "C:\\ WINDOWS\\"
--------------------
*dos_dirattrib, (dos_dirattrib ])返回目录及其属性的关联表 nil on error.
pathspec 目标目录,可用("*" and "?"),不提供表示 *.*.
bits0-Normal 1-Read-only 2-Hidden 4-System 8-Archive
(dos_dirattrib "c:\\program files\\autocad 2002\\*.*")
    (("Help" . 0) ("Support" . 0) ("Sample" . 0) ("Fonts" . 0)....)
(dos_dirattrib "c:\\program files\\autocad 2002\\*.*" 8)
--------------------
*dos_dirtree,   (dos_dirtree )返回指定目录下的子目录(第一个为指定目录)nil on error.
(dos_dirtree "c:\\program files\\autocad 2002\\support\\")--》
("c:\\program files\\autocad 2002\\support\\" "c:\\program files\\autocad 2002\\support\\BatchPlt\\"
   "c:\\program files\\autocad 2002\\support\\Legacy\\"
   "c:\\program files\\autocad 2002\\support\\Legacy\\DWFOut\\")
--------------------
*dos_specialdir, (dos_specialdir item)
找回专有目录.包括操作系统或Windows shell specific.返回目录
item
指定专有目录的整数值,有效值如下:
0 Windows desktop
1 Internet Explorer (icon on desktop)
2 Start Menu\Programs
3 My Computer\Control Panel
4 My Computer\Printers
5 My Documents
6 <user name>\Favorites
7 Start Menu\Programs\Startup
8 <user name>\Recent
9 <user name>\SendTo
10 <desktop>\Recycle Bin
11 <user name>\Start Menu
12 Logical "My Documents" desktop icon
13 "My Music" folder
14 "My Videos" folder
16 <user name>\Desktop
17 My Computer
18 Network Neighborhood (My Network Places)
19 <user name>\nethood
20 Windows\fonts
21 Templates
22 All Users\Start Menu
23 All Users\Start Menu\Programs
24 All Users\Startup
25 All Users\Desktop
26 <user name>\Application Data
27 <user name>\PrintHood
28 <user name>\Local Settings\Application Data (non roaming)
29 Non localized startup
30 Non localized common startup
31 Non localized favorites
32 Internet cache
33 Internet cookies
34 Internet history
35 All Users\Application Data
36 Windows directory
37 System directory
38 C:\Program Files
39 C:\Program Files\My Pictures
40 User profile
41 x86 system directory on RISC
42 x86 C:\Program Files on RISC
43 C:\Program Files\Common
44 x86 Program Files\Common on RISC
45 All Users\Templates
46 All Users\Documents
47 All Users\Start Menu\Programs\Administrative Tools
48 <user name>\Start Menu\Programs\Administrative Tools
49 Network and Dial-up Connections
53 All Users\My Music
54 All Users\My Pictures
55 All Users\My Pictures
56 All Users\My Pictures
57 Localized Resource Directory
58 Links to All Users OEM specific apps
59 USERPROFILE\Local Settings\Application Data\Microsoft\CD Burning
61 Computers Near Me (computered from Workgroup membership)
(dos_specialdir 0)-》"C:\\Documents and Settings\\dale\\Desktop\\"
(dos_specialdir 5)-》"C:\\Documents and Settings\\dale\\My Documents\\"
--------------------


[目录]

--------------------------------------------------------------------------------


文件操作

dos_attrib      dos_attrib   (dos_attrib ]) 返回文件属性或设为指定属性 by bits.
Bit value Description(位值可相加)
    0 Normal
    1 Read Only
    2 Hidden
    4 System
    8 Archive
Example
(dos_attrib)                                        (("ACAD.EXE" . 0)("TEST.DWG" . 8))
(dos_attrib "*.dwg")                                 (("ACAD.EXE" . 0)("TEST.DWG" . 8))
(dos_attrib "c:\\ projects\\*.dwg" 3)                (("SAMPLE.DWG" . 3)("PROJECT.DWG" . 3))
--------------------
dos_copy      dos_copy(dos_copy srcfilename destfilename) 拷贝文件
Example
(dos_copy "drawing.dwg" "drawing.bak")                        "C:\\ ACAD\\ DRAWING.BAK"
(dos_copy "drawing.dwg" "c:\\ acad\\ backup\\ drawing.bak")      "C:\\ ACAD\\ BACKUP\\ DRAWING.BAK"
(dos_copy "drawing.dwg" "a:\\ drawing.dwg")                        "A:\\ DRAWING.DWG"
====================
vl-file-copy将一个文件的内容 复制或附加 到另一个文件
(vl-file-copysource-filedestination-file )
append /= nil,source-file 将附加到 destination-file(即复制到目标文件的尾部)
Example: (vl-file-copy "c:/test.bat" "c:/newauto.bat" T)
--------------------
dos_delete      dos_delete (dos_delete filespec)删除文件
Example
(dos_delete "acad.bak")      ("ACAD.BAK")
(dos_delete "*.bak")                ("ACAD.BAK" "TEST.BAK")
====================
(vl-file-deletefilename)
filename 要删除文件的名称。如果没有指定完整的路径名,vl-file-delete 将在 AutoCAD 启动目录中查找。
(vl-file-delete "c:/newauto.bat") -> T
--------------------
dos_dir                dos_dir      (dos_dir )   返回当前或指定目录文件表
Example
(dos_dir)                ("ACAD.ADS" "ACAD.ERR" "ACAD.EXE" ...)
(dos_dir "*.dwg")      ("ACAD.DWG" "TEST.DWG")
--------------------
dos_dos2unix      (dos_dos2unix source dest)         转 dos 型文件为 unix 型文件
Example
    (dos_dos2unix "data.txt" "data.doc")
--------------------
dos_dwgver      (dos_dwgver filename)返回dwg文件版本
Example
    (dos_dwgver "test.dwg")
--------------------
dos_encrypt      (dos_encrypt filename password) 文件(密码)加密解密
Example
(dos_encrypt "test.dwg" "password")      "c:\\ drawings\\ test.dwg"
--------------------
dos_file      (dos_file filename)    返回文件详细资料表
Value Description
    filename sizedatetime
    read-only "R" if the file is read-only; otherwise "".
    hidden "H" if the file is hidden; otherwise "".
    system "S" if the file is system; otherwise "".
    archive "A" if the file is archive; otherwise "".
Example
(dos_file "test.dwg")
    ("C:\\ ACAD\\ TEST.DWG" "343038" "06-06-1994" "10:25:14a" "R" "" "" "A")
--------------------
dos_filedate         (dos_filedate filespec)      返回文件 + Julian date 表
Example
    (dos_filedate "*.dwg")      (("Drawing.dwg" . 2.00012e+007) ("Drawis.dwg" . 2.00012e+007))
--------------------
dos_filep      (dos_filesize )文件是否存在
Example
    (dos_filep "drawing.dwg")
--------------------
dos_filesize      (dos_filesize )文件大小
Example
(dos_filesize)                              (("DRAWING.DWG" . 35189.0)("TEST.DWG" . 44135.0))
(dos_filesize "c:\\ drawings\\*.dwg")                (("SAMPLE.DWG" . 54189.0)("PROJECT.DWG" . 24135.0))
--------------------
dos_filesys      (dos_filesys )      返回驱动器类型
Example
(dos_filesys)                "FAT"
(dos_filesys "d:")      "NTFS"
--------------------
dos_find      (dos_find filename )搜寻文件
Example
(dos_find "acad.dwg")                ("C:\\ ACAD\\ ACAD.DWG" "C:\\ ACAD\\ BACKUP\\ ACAD.DWG")
(dos_find "acad.dwg" "x:")      ("X:\\ PROJECTS\\ MASTERS\\ ACAD.DWG")
--------------------
dos_getfilem      (dos_getfilem title path filter) 多选文件对话框!!!
Example
(dos_getfilem "Select Drawings" "C:\\ DRAWINGS\\" "Drawing Files (*.DWG)|*.DWG")
    ("C:\\ DRAWINGS\\" "TITLE1.DWG" "TITLE2.DWG"...)
(dos_getfilem "Select Files" "C:\\ FILES\\" "Text Files(*.TXT)|*.TXT|All Files (*.*)|*.*")
    ("C:\\ FILES\\" "TITLE1.TXT" "TITLE2.TXT"...)
--------------------
dos_move      (dos_move filename1 filename2)移动文件(不能盘间移)
Example
(dos_move "drawing.dwg" "c:\\ backup\\ drawing.dwg")                "C:\\ BACKUP\\ DRAWING.DWG"
(dos_move "drawing.dwg" "c:\\ drawing.dwg")                        "C:\\ DRAWING.DWG"
--------------------
dos_openp      (dos_openp filename)   返回文件的打开状态(网络用)
Example
(dos_openp "drawing.dwg")                T
--------------------
dos_recent      (dos_recent )增加或清除Windows最近用的文档
Example
(dos_recent "c:\\ drawings\\ drawing.dwg")                nil
--------------------
dos_rename      (dos_rename oldfilename newfilename)文件改名
Example
(dos_rename "drawing.dwg" "drawing.bak")      "C:\\ ACAD\\ DRAWING.BAK"
--------------------
dos_search      (dos_search filename environment)      文件搜寻
Example
(dos_search "acad.exe" (dos_path))      "C:\\ ACAD\\ ACAD.EXE"
(dos_search "win.ini" nil)                "C:\\ WINDOWS\\ WIN.INI"
--------------------???
dos_touch      (dos_touch filespec)   给文件赋时间
Example
(dos_touch "c:\\ acad\\ acad.dwg") ("ACAD.EXE")
("ACAD.DWG" "TEST.DWG")                        "C:\\ ACAD\\*.DWG"
--------------------
dos_unix2dos      (dos_unix2dos source dest)      转 dos 型文本文件为 unix 型文本文件
Example
    (dos_unix2dos "data.doc" "data.txt")
====================
*dos_tempfile, (dos_tempfile)生成临时文件前缀"~ac十六进制名.tmp”.nil on error.
Example
(dos_tempfile)-》"C:\\DOCUME~1\\dale\\LOCALS~1\\Temp\\~ac51E2.tmp"
(dos_tempfile)-》"C:\\DOCUME~1\\dale\\LOCALS~1\\Temp\\~ac53E0.tmp"
--------------------
*dos_xreflist. (dos_xreflist )
返回xref文件列表,未指定文件名,则指当前文件
(dos_xreflist)-》("C:\\Program Files\\AutoCAD 2002\\Drawing1.dwg" "C:\\Program Files\\AutoCAD 2002\\Drawing2.dwg")
(dos_xreflist "c:\\program files\\autocad 2002\\sample\\1st floor.dwg")
-->("1st floor plan.dwg" "1st floor architectural.dwg" "1st floor electrical.dwg" "1st floor lighting.dwg")
文件处理函数
函数                                        说明
(close file-desc)                关闭一个已打开的文件
(findfile filename)                在 AutoCAD 库目录路径内搜索指定文件
(open filename mode)                打开文件供其他 AutoLISP I/O 函数访问
(read-char )                从键盘输入缓冲区或已打开的文件中读取一个字符,并返回表示该字符的ASCII代码
(read-line )                从键盘输入缓冲区或已打开的文件中读取一个字符串
(vl-directory-files )      列出给定目录中的所有文件
(vl-file-copy "source-filename" "destination-filename" ) 将一个文件的内容复制或添加到另一个文件中
(vl-file-delete "filename")      删除文件
(vl-file-directory-p "filename")判断一个文件名中是否包含目录
(vl-file-rename "old-filename" "new-filename")      重命名文件
(vl-file-size "filename")      判断文件的大小,以字节为单位
(vl-file-systime "filename")      返回指定文件的最后修改时间
(vl-filename-base "filename")      返回文件名,去掉文件夹路径和扩展名
(vl-filename-directory
"filename")                        返回文件的目录路径,去掉文件名和扩展名
(vl-filename-extension
"filename")                        返回文件的扩展名,去掉名称的其余部分
(vl-filename-mktemp ["pattern" "directory" "extension"])      计算临时文件使用的唯一文件名
(write-char num )      将一个字符写入屏幕或打开的文件中
(write-line string )      将一个字符串写入屏幕或打开的文件中

[目录]

--------------------------------------------------------------------------------


系统打印

dos_getprn      dos_getprn   (dos_getprn) 返回当前系统打印机描述名 nil on error.
Example
(dos_getprn)                "HP LaserJet 5Si/5Si MX"
(setq print_file (getstring "\ nEnter a print file name"))
(setq default_printer (dos_getprn))
(dos_spool print_file default_printer)
--------------------
dos_orient      (dos_orient printer ) 打印方向为 T横向 nil纵向
Examples
    (dos_orient (dos_getprn) T)
    (dos_orient (dos_getprn))
--------------------
dos_printers      (dos_printers) 返回系统打印机名列表 nil on error.
Example
(dos_printers)
    ("HP LaserJet 5Si/5Si MX" "Phantom AutoCAD OLE/ADI Printer")
--------------------
dos_setprn      (dos_setprn printer)         设置当前或缺省系统打印机
Example
(dos_setprn (car (dos_printers))

(dos_setprn "HP LaserJet 5Si/5Si MX")      "HP LaserJet 5Si/5Si MX"
--------------------
dos_spool      (dos_spool filename printer)脱机打印???送入打印
Example
(dos_spool "test.plt" "HP LaserJet 5Si/5Si MX")
"c:\\ drawings\\ test.plt"

(setq print_file (getstring "\ nEnter a print file name"))
(setq default_printer (dos_getprn))
(dos_spool print_file default_printer)

[目录]

--------------------------------------------------------------------------------


注册表

dos_getini      (dos_getini section entry filename)
Example
    (dos_getini "drawings" "dwg1" "dwg.ini")
    (dos_getini "drawings" nil "dwg.ini")
    (dos_getini nil nil "dwg.ini")
--------------------
dos_regdel      (dos_regdel application section key[ T]) 删除注册表内容
Examples
    (dos_regdel "CAD" "Project1" "User")
    (dos_regdel "CAD" "Project2" "User" T)
--------------------
dos_regget      (dos_regget application section key[ T]) 获取注册表内容
?Examples
    (dos_regget "CAD" "Project1" "User")
    (dos_regget "CAD" "Project2" "User" T)
--------------------
dos_regset      (dos_regset application section key value ) 赋值添加注册表内容
Examples
    (dos_regset "CAD" "Project1" "User" "Dale")
    (dos_regset "CAD" "Project2" "User" "Mary" T)
--------------------
dos_setini          (dos_setini section entry string filename) Windows的ini文件添加
Examples
    (dos_setini "drawings" "dwg1" "dwg1.dwg" "dwg.ini")
    (dos_setini "drawings" "dwg1" nil "dwg.ini")
--------------------
*dos_regkey,(dos_regkey key) key-注册表子键列表 nil on error.
(dos_regkey "HKEY_LOCAL_MACHINE\\")-->("HARDWARE" "SAM" "SECURITY" "SOFTWARE" "SYSTEM")
[目录]

--------------------------------------------------------------------------------


运行命令

dos_command      (dos_command command-line )      运行COMMAND.COM内部命令.
show缺省为 Normal (0).Bit value Description
            0 Normal.
      1 No Active..
      2 Minimized.
      3 Minimized
      4 Maximized.
Example
    (dos_command "copy *.dwg a:")
--------------------
dos_execute      (dos_execute command-line )          运行外部命令.
Examples
    (dos_execute "format.com a: /s")
    (dos_execute "notepad.exe" 4)
--------------------
dos_exewait      (dos_exewait command-line )      运行外部命令.等待终止。
Examples
    (dos_exewait "notepad.exe")
    (dos_exewait "notepad.exe" 4)
--------------------
dos_processes      (dos_processes )      已运行文件列表
T 全路径
Example
    (dos_processes)
--------------------
dos_shellexe      (dos_shellexe file parameters ])      打开或打印 执行文件或文档文件
parameters=nil为文档文件
operation
    0 Open the executable or document.
    1 Print the document.
    2 Explore the specified folder
Example
(dos_shellexe "notepad.exe" "readme.txt")
(dos_shellexe "www.mcneel.com" nil)
(dos_shellexe "c:\\ drawings\\" nil 2)
[目录]

--------------------------------------------------------------------------------


*字串类

dos_strcase, (dos_strcase string ) 大小写转换(有t为小写)nil on error.
(dos_strcase "AutoCAD 2002")->"AUTOCAD 2002"
(dos_strcase "AutoCAD 2002" T)->"autocad 2002"
--------------------
dos_strcat, (dos_strcat ... ]) 连字串,不提供字串则返回空串
(dos_strcat "Hockey " "is " "the " "best.")--》"Hockey is the best."
--------------------
dos_strchar, (dos_strchar string index )
字串index位置显示或替换,index从0开始计数
Example
(dos_strchar "AutoCAD 2000" 11)-->0"
(dos_strchar "AutoCAD 2000" 11 "2")-->"AutoCAD 2002"
--------------------
dos_strcompare, (dos_strcompare string1 string2 )
字串比较,相同=0;字串1<字串2,<0;字串1>字串,2>0;
有参数T时大小写忽略
(dos_strcompare "AutoCAD" "AUTOCAD")-》1
(dos_strcompare "AutoCAD" "AUTOCAD" T)-》0
--------------------
dos_strdelete, (dos_strdelete string index count)
字串删减,index从0计数,删count个字符,超长删到尾
(setq str "Hockey is the best.")->"Hockey is the best."
(dos_strdelete str 6 8)->"Hockeybest."
--------------------
dos_strexcluding, (dos_strexcluding string charset)
返回非特征字串 charset的字串
(dos_strexcluding "1.0,1.0,1.0" ";,-:")-->"1.0"
--------------------
dos_strfind, (dos_strfind string substring )
从index开始字串搜寻,返回位置,没有则返回-1
(dos_strfind "AutoCAD 2002" "C")-》4
(dos_strfind "The stars are aligned." "e" 5)-》12
--------------------
dos_strfindoneof, (dos_strfindoneof string charset)
匹配特征字串charset的位置,没有则返回-1
(dos_strfindoneof "abcdefg" "xd")-》3
--------------------
dos_strincluding, (dos_strincluding string charset)
返回包含在特征字串charset中的所有字串,第一个字不包含则返回空串
(dos_strincluding "cabbage" "abc")--》"cabba"
--------------------
dos_strinsert, (dos_strinsert string index chars)
在index之前插入字串,从0计数,index=0从头插,index大于字节数则连尾巴
(setq str "HockeyBest.")->"HockeyBest."
(dos_strinsert str 6 " is the ") "Hockey is the Best."
--------------------
dos_strleft, (dos_strleft string count)
左数count之前的字串,count超长则返回整个字串
(dos_strleft "AutoCAD 2002" 7)-》"AutoCAD"
--------------------
dos_strright, (dos_strright string count)
右数count之后的字串,count超长则返回整个字串
(dos_strright "AutoCAD 2002" 4)-》"2002"
--------------------
dos_strlength, (dos_strlength string)
返回字串长度
(dos_strlength "AutoCAD 2002")->12???????????
--------------------
dos_strmatch, (dos_strmatch string wildcard)
字串匹配,wildcard可用(* and ?). 返回t或nil
(dos_strmatch "MyLayerName" "My*")-》T
(dos_strmatch "MyDrawing.dwg" "My*.*")-》T
--------------------
dos_strmid, (dos_strmid string index )
返回从index位置之后的count位字串。无count返回剩余
(dos_strmid "AutoCAD 2002" 8)->"2002"
(dos_strmid "AutoCAD 2002" 4 3)->"CAD"
--------------------
dos_strremove, (dos_strremove string char)
去掉所有char字串 nil on error.
(dos_strremove "AutoCAD 2002" "A")-》"utoCD 2002"
--------------------
dos_strreplace, (dos_strreplace string oldchars newchars )
新旧字串替换,有T时对大小写不敏感
(setq str "Everybody likes ice hockey.")-》"Everybody likes ice hockey."
(dos_strreplace str "hockey" "golf")-》"Everybody likes ice golf."
--------------------
dos_strreverse, (dos_strreverse string)
字串倒序---支持中文否?
(dos_strreverse "AutoCAD 2002")-》"2002 DACotuA"
dos_strreversefind, (dos_strreversefind string char)
反向搜寻的最后一个char,(不就是第一个?)没有则返回-1
(dos_strreversefind "abcabc" "b")-》4
--------------------
dos_strtokens, (dos_strtokens string tokens)
以字串的分界符tokens组成字串表
(dos_strtokens "Hockey is the best." " ")->("Hockey" "is" "the" "best.")
(dos_strtokens "A string\tof ,,tokens\nand some more tokens" " ,\t\n")
    -->("A" "string" "of" "tokens" "and" "some" "more" "tokens")
--------------------
dos_strtrimleft, (dos_strtrimleft string )
字串左剪切,没有chars时,去掉字头的换行,空格,tab符
(dos_strtrimleft "****Hockey is the best" "*")
    -》"Hockey is the best"
(dos_strtrimleft "\t\tHockey is the best")
    -》"Hockey is the best"
--------------------
dos_strtrimright,
字串右剪切,没有chars时,去掉字尾的换行,空格,tab符
(dos_strtrimright "Hockey is the best!!!!" "!")
    -》"Hockey is the best"
(dos_strtrimright "Hockey is the best ")
    -》"Hockey is the best"
====================
dos_compactpath,(dos_compactpath path maxchars)
限制路径的最长值maxchars。
(dos_compactpath "c:\\program files\\autocad 2002\\acad.exe" 30)-》"c:\\program files\\...\\acad.exe"
(dos_compactpath "c:\\winnt\\win.ini" 12)-》"...\\win.ini"
--------------------
dos_shortpath, (dos_shortpath path) 长目录名--》短目录名,nil on error.
(dos_shortpath "c:\\program files\\autocad 2002\\) ->"c:\\progra~1\\autoca~2\\"

[目录]

--------------------------------------------------------------------------------


对话框

dos_checklist      (dos_checklist title message assoc-list)      带开关列表 0表示未选中
Example
   (setq xyz '(("layer1" . 0) ("Layer2" . 0) ("Layer3" . 0)))
   (dos_checklist "--by陈勇--" "Layers to turn off" xyz)
--------------------
dos_combolist      (dos_combolist title message list )    下拉编辑框
Example
   (setq xyz '("layer1" "Layer2" "Layer3"))
   (dos_combolist "--by陈勇--" "Layer to turn off" xyz)
--------------------
dos_dwgpreview(dos_dwgpreview title path )               对话框文件列表并预览
Example
   (dos_dwgpreview "Insert a block" "c:\\ blocks\\")
   (dos_dwgpreview "Insert a block" "c:\\ blocks\\" t)
--------------------
dos_editlist      (dos_editlist title message list)      对话框增减项目并排序
Example
   (setq xyz '("layer1" "Layer2" "Layer3"))
   (dos_editlist "--by陈勇--" "Layers to create" xyz)
--------------------
dos_getcancel         信息框, 带 CANCEL 钮
(dos_getcancel title message)
(dos_getcancel T) T== Close the dialog box.
(dos_getcancel)
Example
    (setq x 0)
    (dos_getcancel "Test" "Testing, please wait") ;initialize
    (while (and (dos_getcancel) (< x 10000)) ;check
      (setq x (1+ x))
    )
    (if (= x 10000)
      (dos_getcancel t) ;close
    )
--------------------
dos_getint      (dos_getint title message )         输入整数
Example
   (dos_getint "--by陈勇--" "Enter number of copies")
--------------------
dos_getpassword                (dos_getpassword title message )输入密码
Example
   (dos_getpassword "密码机--by陈勇--" "请您输入密码:" "cy956")
--------------------
dos_getprogress进程框
(dos_getprogress title message maxvalue )
(dos_getprogress abs/-rel)
(dos_getprogress T) ;close
(dos_getprogress)
Example
    (setq x 0 y 1000)
    (dos_getprogress "Test" "Testing, please wait" y) ;initialize
    (while (< x y)
      (dos_getprogress -1) ;increment relative by 1
      (setq x (1+ x))
    )
    (dos_getprogress t) ;close
--------------------
dos_getreal      (dos_getreal title message )          对话框输入实数
Example
   (dos_getreal "--by陈勇--" "Enter a distance")
--------------------
dos_getstring      (dos_getstring title message )      对话框输入字串
Example
    (dos_getstring "--by陈勇--" "输入要查找的函名")
--------------------
dos_listbox      (dos_listbox title message list )          对话框输入单选表
Example
(setq xyz '("layer1" "Layer2" "Layer3"))
(dos_combolist "--by陈勇--" "Select a layer" xyz "Layer3")
--------------------
dos_multilist          (dos_multilist title message list)      对话框输入多选表
(setq xyz '("layer1" "Layer2" "Layer3"))
(dos_multilist "--by陈勇--" "Select a layer" xyz)
--------------------
dos_msgbox      (dos_msgbox text title button icon )信息框
button The push button format. The allowable values are as follows: Bit value Description
      0 Abort, Retry and Ignore
      1 OK
      2 OK and Cancel
      3 Retry and Cancel
      4 Yes and No
      5 Yes, No and Cancel
icon The icon. The allowable values are as follows:      Bit value Description
      0 Asterisk      I
      1 Exclamation   !
      2 Hand                X
      3 Information      I
      4 Question         ?
      5 Stop                X
返回值:
      0 Abort
      1 Cancel
      2 Ignore
      3 No
      4 OK
      5 Retry
      6 yes
duration=持续时间,button= 1 2 3 5 时用
Example
    (dos_msgbox "--by陈勇--" "Save" 4 3)
--------------------
dos_progbar      状态行处出现进程框
(dos_progbar label maxvalue)
(dos_progbar abs/-rel)
(dos_progbar)
Example
    (dos_progbar "Wait..." 10)
    (dos_progbar –1); move relative to previous location
    (dos_progbar)
    (setq x 0 y 1000)
    (dos_progbar "Test" y) ;initialize
    (while (< x y)
      (dos_progbar -1) ;increment relative by 1
      (setq x (1+ x))
    )
    (dos_progbar) ;close
--------------------
dos_proplist      (dos_proplist title message list)      多组编辑框
Example
   (setq xyz '(("Title" . "Floorplan") ("Project" . "Project A")))
   (dos_proplist "--by陈勇--" "Modify Properties" xyz)
--------------------
dos_splash      (dos_splash filename duration)屏显256色bmp图形
Example
    (dos_splash "mylogo.bmp" 5)
--------------------
dos_waitcursor      (dos_waitcursor )改变鼠标指针
Options
    T Toggles on the沙漏指针.
Examples
   (dos_waitcursor T)
   (dos_waitcursor)
----------------------------------------
*dos_getfiled, (dos_getfiled title path filter) 对话框取文件
(dos_getfiled "选择文件" "c:\\program files\\autocad 2002\\" "Drawing files (*.dwg)|*.dwg|All files (*.*)|*.*||")
--------------------
dos_getfilem      (dos_getfilem title path filter) 多选文件对话框!!!
Example
(dos_getfilem "Select Drawings" "C:\\ DRAWINGS\\" "Drawing Files (*.DWG)|*.DWG")
    ("C:\\ DRAWINGS\\" "TITLE1.DWG" "TITLE2.DWG"...)
(dos_getfilem "Select Files" "C:\\ FILES\\" "Text Files(*.TXT)|*.TXT|All Files (*.*)|*.*")
    ("C:\\ FILES\\" "TITLE1.TXT" "TITLE2.TXT"...)
========================================
dos_getdir      dos_getdir   (dos_getdir title )浏览器选择目录
Example
(dos_getdir "Select a Directory" "c:\\")      "C:\\ DRAWINGS\\ PROJECTS\\"


[目录]

--------------------------------------------------------------------------------


系统环境


[目录]

--------------------------------------------------------------------------------


本机操作

dos_clipboard      (dos_clipboard )返回或赋值剪贴板
Examples
    (dos_clipboard)
    (dos_clipboard "Hello World!")
--------------------
dos_capslock      (dos_capslock )      切换大小写键
T Turn on the Caps Lock.
Example
    (dos_capslock T)
    (dos_capslock)
--------------------
dos_numlock      (dos_numlock )      切换数字键
T Turn on the Num Lock.
Example
    (dos_numlock T)
    (dos_numlock)
--------------------
dos_scrolllock      (dos_scrolllock )      切换<Scroll Lock>键
--------------------
dos_beep      (dos_beep ) 喇叭一响
Bit value Description
          0 Standard beep
      1 System Asterisk
      2 System Exclamation
      3 System Hand
      4 System Question
      5 System Default
Example
    (dos_beep 1)
--------------------
dos_wav                (dos_wav filename)演奏*.WAV文件
Example
    (dos_wav "boink.wav")
--------------------
dos_speaker      (dos_sortlist frequency duration)      扬声器 频率 延时
Example
    (dos_speaker 1000 5)
--------------------


[目录]

--------------------------------------------------------------------------------


本机环境

dos_mem                (dos_mem)返回系统内存
The return values of dos_mem are as follows:Value Description
    MemLoad The percent of memory in use (integer).
    TotalPhys Bytes of physical memory.
    AvailPhys Free physical memory bytes.
    TotalPageFile Bytes of paging file.
    AvailPageFile Free bytes of the page file.
    TotalVirtual User bytes of address space.
    AvailVirtual Free user bytes.
--------------------
dos_macaddress      (dos_macaddress)      Returns the system’s media access control (MAC) addresses
--------------------
dos_ping      (dos_ping host/addr)         TCP/IP诊断工具
Example
    (dos_ping "robert.mcneel.com")
--------------------???
dos_random      (dos_random)Returns a pseudorandom number
Example
    (dos_random)
    (rem (dos_random) n) ;a random number between 0 and n.
--------------------
*dos_guidgen, (dos_guidgen)
生成图形用户界面,128位的唯一数
(dos_guidgen)--》"947823AD-9F0B-4171-85B9-81C73F46E801"
--------------------
*DOS_ADMINP(dos_adminp)
判断当前用户是否有管理员权限.This is done by confirming
   membership in the local Administrators group.
是返回T, nil if not a member or on error.
(dos_adminp) -> T

[目录]

--------------------------------------------------------------------------------


acad控制

dos_pause      (dos_pause duration)      暂停。。。秒
Example
    (dos_pause 5)
--------------------
dos_closeall      (dos_closeall)关闭所有文档 (AutoCAD 2000 only).
--------------------
dos_saveall      (dos_saveall)                  储存所有文档 (AutoCAD 2000 only).
--------------------
dos_show      (dos_show method)控制AutoCAD窗口
Bit value Description
      0 Maximize
      1 Minimize
      2 Restore
Example
    (dos_show 0)
--------------------
*dos_lisplist, (dos_lisplist) 返回已加载的lisp,vlisp文件表
--------------------
dos_demandload      (dos_demandload ) 改变doslib命令加载方式
T Sets DOSLib to demand-load at AutoCAD startup.
Examples
    (dos_demandload)
    (dos_demandload t)
--------------------
[目录]

--------------------------------------------------------------------------------


系统用户

dos_date      (dos_date )   返回或设定当前系统时间
Examples
    (dos_date)
    (dos_date "1-1-2000")
--------------------
dos_time      (dos_time )返回或改变当前系统时间
Examples
    (dos_time)                "11:57:43a"
    (dos_time "17:00")
--------------------
*dos_cdate,(dos_cdate format)
系统时间的返回格式
%a 简短星期%A 星期
%b 简短月%B 月
%c 当地的日期和时间
%d 一月内的日期(01 – 31)
%H 24小时(00 – 23)
%I 12小时(01 – 12)
%j 一年内的日期(001 – 366)
%m 一年内的月份(01 – 12)
%M 一小时内的分钟(00 – 59)
%p 现在时间 A.M./P.M. 12小时制
%S 一分钟内的秒(00 – 59)
%U 一年内的星期(00 – 53) ,以星期天为头
%W 一年内的星期(00 – 53),以星期一为头
%w 一星期内的第几天(0 – 6; Sunday is 0)
%x 当地日期
%X 当地时间
%y 两位年份(00 – 99)
%Y 四位年份
%z or %Z 时区全称或简写; no characters if time zone is unknown
%% 百分数
%#a, %#A, %#b, %#B, %#p, %#X, %#z, %#Z, %#%
                # flag is ignored.
%#c         Long date and time representation, appropriate for current locale.
                For example: “Tuesday, March 14, 1995, 12:41:29”.
%#x         Long date representation, appropriate to current locale.
            For example: “Tuesday, March 14, 1995”.
%#d, %#H, %#I, %#j, %#m, %#M, %#S, %#U, %#w, %#W, %#y, %#Y
            Remove leading
(dos_cdate "%m/%d/%y")--》"01/09/02"
(dos_cdate "%A, %B %d, %Y")--》"Wednesday, January 09, 2002"
(dos_cdate "Today is %A, day %d of %B in the year %Y.")
    --》"Today is Wednesday, day 09 of January in the year 2002."
--------------------
dos_computer      (dos_computer ) 返回或设定当前系统的电脑名
Examples
    (dos_computer)
    (dos_computer "SPEEDY")
--------------------
dos_hostname      (dos_hostname)      Returns a systems local DNS hostname
--------------------
dos_ipaddress          (dos_ipaddress)      Returns a list of local TCP/IP addresses
--------------------
dos_username      (dos_username)      返回用户名
--------------------


[目录]

--------------------------------------------------------------------------------


其他

其他
dos_sortlist      (dos_sortlist list) 实数,整数或字串排序
Example
    (dos_sortlist ’(4 3 6 5 7 1 2))
--------------------
dos_winhelp      (dos_winhelp filename )      引用win帮助文件,加索引
Examples
    (dos_winhelp "myhelp.hlp")
    (dos_winhelp "myhelp.hlp" "Introduction")
--------------------
*DOS_ACITORGB(dos_acitorgb aci-value)
   转换acad颜色数(ACI)为RGB颜色数。
   aci-value =1 ~ 255 的整数,返回一个三数表
   (dos_acitorgb 1) -> (255 0 0)
--------------------
*DOS_GETCOLOR(dos_getcolor title )
显示一个win标准的颜色选择框,用于选择 RGB 色。
*title - The dialog box title.
*aci-value/rgb-value= 1 ~ 255 或者一个表示RGB色的三数表,
返回一个表示RGB色的三数表,nil on error
(dos_getcolor "选择一个颜色" 1) -> (128 128 128)
(dos_getcolor "选择一个颜色" '(255 0 0)) -> (128 128 128)
--------------------
*DOS_RGBTOACI(dos_rgbtoaci rgb-value)
转换RGB色(三数表)为最相近的cad(ACI)颜色数, nil on error.
(dos_rgbtoaci '(255 0 0)) -> 1


[目录]

--------------------------------------------------------------------------------


关于doslib

dos_about      (dos_about)显示DOSLib版本和版权
--------------------
dos_help      (dos_help)列出所有有用的DOSLib功能
--------------------
dos_ver                (dos_ver)返回操作系统版本号
--------------------
dos_version      (dos_version)      返回 Doslib 版本号
--------------------
[目录]

langke52 发表于 2018-1-4 16:42:11


感谢楼主分享
页: [1]
查看完整版本: DOSLIB6.0函数简介--by陈勇笔记020201