[求助]用getfiled 命令一次是否能否选多个文件?
请问用getfiled 命令一次是否能否选多个文件? 好像不能,呵呵 列出给定目录中的所有文件(vl-directory-files )
;;选择目录
(WHILE (NOT (SETQ shfolder (VLAX-INVOKE-METHOD (VLAX-CREATE-OBJECT "Shell.Application")
'browseforfolder
0
"选择要插入的目录:"
1
)
)
)
) 但是我只想选择目录中的部分文件 本帖最后由 作者 于 2004-12-18 9:01:34 编辑
虽然感觉象很老的操作系统,不过DCL的功能我暂时也就挖掘了这些
主函数:main,返回选中文件列表
(defunLoad_dlg(/dcl_idffilename)
(setqfilename(strcat(getenv"TMP")"GetFilesDialog.dcl"))
(setqf(openfilename"w"))
(write-line"GetFileDialog:dialog{"f)
(write-line"label=\"文件选择\";"f)
(write-line":text{label=\"\";key=\"name\";}"f)
(write-line":row{"f)
(write-line":list_box{label=\"文件:\";key=\"file\";fixed_height=true;height=18;multiple_select = true;fixed_width=true;width=30;}"f)
(write-line":column{"f)
(write-line":list_box{label=\"路径:\";key=\"dir\";fixed_height=true;height=16;fixed_width=true;width=30;}"f)
(write-line":popup_list{label=\"驱动器:\";key=\"dev\";}}}"f)
(write-line"ok_cancel;}"f)
(closef)
(if(<(setqdcl_id(load_dialogfilename))0)(exit))
(vl-file-deletefilename)
dcl_id
)
(defunGetDevs(/iDeviceDevs)
(setqi67)
(while(vl-directory-files(setqDevice(strcat(chri)":")))
(setqDevs(appendDevs(listDevice)))
(setqi(1+i))
)
Devs
)
(defunGet_Files(nsFiles/ff2fsi)
(setqi1)
(setqf2"")
(while(/=(setqf(substrnsi1))"")
(if(=f"")
(progn
(setqfs(appendfs(list(atoif2))))
(setqf2"")
)
(setqf2(strcatf2f))
)
(setqi(1+i))
)
(setqfs(appendfs(list(atoif2))))
(mapcar'(lambda(e)(ntheFiles))fs)
)
(defunGetfiles(pathflag/Files)
(setqFiles(vl-directory-filespathnilflag))
(ifFiles
(setqFiles(acad_strlsortFiles))
)
(vl-remove"."Files)
)
(defunGetParantPath(path)
(setqi0)
(setqn(strlenpath))
(while(/=(substrpath(-ni)1)"\\")
(setqi(1+i))
)
(setqi(1+i))
(substrpath1(-ni))
)
(defunfill_pop(keylst)
(start_listkey)
(mapcar'add_listlst)
(end_list)
)
(defunFill_All(path/dirsFiles)
(fill_pop"dir"(GetFilespath-1))
(fill_pop"file"(GetFilespath1))
)
(defunAct_Dev(nDevices/Dev)
(setqDev(nthnDevices))
(Fill_AllDev)
(set_tile"name"Dev)
Dev
)
(defunAct_Dir(npath/folder)
(setqfolder(nthn(GetFilespath-1)))
(if(=folder"..")
(setqpath(getParantPathpath))
(setqpath(strcatpath"\\"folder))
)
(set_tile"name"path)
(fill_allpath)
path
)
(defunmain(/dcl_idActFilesnsDevicesDirectoriespathR)
(setqdcl_id(Load_dlg))
(if(not(new_dialog"GetFileDialog"dcl_id))(exit))
(setqDevices(GetDevs))
(setqpath(nth0Devices))
(fill_pop"dev"Devices)
(setqpath(Act_Dev0Devices))
(action_tile"dev""(setqpath(Act_Dev(atoi$value)Devices))")
(action_tile"dir""(setqpath(Act_Dir(atoi$value)path))")
(action_tile"accept""(setqns(get_tile\"file\"))(done_dialog1)")
(setqAct(start_dialog))
(if(and(/=ns"")(=Act1))
(progn
(setqFiles(Getfilespath1))
(setqR(Get_FilesnsFiles))
)
(setqRnil)
)
(unload_dialogdcl_id)
(mapcar'(lambda(e)(strcatpath"\\"e))R)
)
;;dos_getfilem
Displays a resizable Windows common file open dialog box that allows for multiple file selection.
Syntax
(dos_getfilem title path filter)
Parameters
title
A string containing the dialog box title.
path
A string identifying an existing directory.
filter
A filename filter string. The filter string consists of two components: a description (for example, "Text Files"), and a filter pattern (for example, "*.TXT"). Multiple filter patterns can be specified for a single item by separating the filter-pattern strings with a semicolon (for example, "*.TXT;*.DOC;*.BAK"). The components must be separated by a pipe character ("|"). The filename filter string can consist of one or more filter strings, each separated by a pipe character ("|"). The entire string must be terminated with two pipe characters ("||").
Returns
A list of filenames if successful. The first element of the list is a qualified path to the selected directory.
nil on cancel or on error.
Examples
Command: (dos_getfilem "Select files" "c:\\program files\\autocad 2002\\sample\\" "Drawing files (*.dwg)|*.dwg||") ok <strong><font color="#ff0000">meflying版主水平就是高,这样的办法都能想出来</font></strong> 的确是个好办法!谢谢! meflying版主的方法灵活好用。
页:
[1]