如何使用类型图像过滤列表文件? - 动态代码

时间:2014-05-06 04:33:58

标签: livecode

我想用类型图片过滤列表文件。但是我的代码没有工作。

这是我的代码:

   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

我想过滤所有图片类型。我该怎么做?

谢谢

3 个答案:

答案 0 :(得分:0)

编辑answer file文件对话框以便仅显示图像数据可能更容易

answer files "Select the images you wish to view:" with type "JPEG Images|jpg|JPEG"

更多信息: http://lessons.runrev.com/s/lessons/m/4071/l/11491-how-can-i-restrict-an-answer-file-dialog-to-just-applications

答案 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