我想用类型图片过滤列表文件。但是我的代码没有工作。
这是我的代码:
local tFolder
answer folder "Please choose the folder"
put it into tFolder
set the defaultFolder to tFolder
if there is a folder tFolder then
put the files into field "listFile"
filter fld "listFile" with "JPEG file, *.jpg; *.jpeg"
else
beep
end if
我想过滤所有图片类型。我该怎么做?
谢谢
答案 0 :(得分:0)
编辑answer file
文件对话框以便仅显示图像数据可能更容易
answer files "Select the images you wish to view:" with type "JPEG Images|jpg|JPEG"
答案 1 :(得分:0)
以下代码列出了所有.jpg,.png(和.JPG,.PNG)文件。您可以向正则表达式添加更多文件类型以列出更多类型:)
put the files into field "listFile"
filter lines of field "listFile" with regex pattern "(?i)\.(jpg|png)$"
答案 2 :(得分:0)
过滤目录图像。
function imagesFiles pPathFolder
local tFiles, tListImagesFiles
put files(pPathFolder) into tFiles
filter lines of tFiles with "*[.png - .jpg - .jpeg - .gif - .bmp]" into tListImagesFiles
return tListImagesFiles
end imagesFiles