Applescript 系统事件返回 .DS_Store - 我怎么能忽略 [英] Applescript System Events Returns .DS_Store - How can I ignore

查看:25
本文介绍了Applescript 系统事件返回 .DS_Store - 我怎么能忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在网上环顾了几个小时来寻找这个答案,所以如果它在某个地方,我深表歉意.下面的这个脚本工作正常,除了它返回 .DS_Store 文件这一事实之外,我如何将它从这个查询和所有其他隐藏文件中排除,但因为我正在我的脚本中创建文件夹,所以只有一个 .DS_Store

I have looked around on the net for hours looking for this answer so I apologize if its there somewhere. This script below works fine except for the fact that it returns the .DS_Store file how can I exclude it from this query and all other hidden files for that matter but because I am creating the folder in my script the only one there is .DS_Store

告诉应用程序系统事件"将 listOfInputs 设置为文件夹 a 的每个磁盘项目的 POSIX 路径作为列表最后告诉

这是下面的完整脚本.创建文件后,我一直将文件放入 in 文件夹中,但最终会在创建文件之前提示输入文件.

Here is the full script below. I have been dropping files into the in folder after it is created but will eventually prompt for files before it is created.

运行中

tell application "Finder"
    if not (exists folder "IN") then
        make new folder at desktop with properties {name:"IN"}
    end if
    if not (exists folder "OUT") then
        make new folder at desktop with properties {name:"OUT"}
    end if
end tell


set theINfolder to path to the desktop as string
set a to theINfolder & "IN:"


tell application "System Events"
    set listOfInputs to POSIX path of every disk item of folder a as list
end tell

set inputs to listOfInputs

set theOutfolder to path to the desktop as string
set outputFolder to theOutfolder & "OUT:"

set params to {}

main(inputs, outputFolder, params)

结束运行

推荐答案

List Folder 命令已被弃用,可能会意外停止工作.

The List Folder command has been deprecated and may stop working unexpectedly.

试试:

set inFolder to (path to desktop as text) & "IN"
do shell script "mkdir -p " & quoted form of (POSIX path of inFolder)
set listOfInputs to paragraphs 2 thru -1 of (do shell script ("find " & quoted form of (POSIX path of inFolder) & " \\! -name \".*\""))

您可以像这样以空格分隔的字符串形式获得结果:

You can get the result as a string separated by spaces like this:

set inFolder to (path to desktop as text) & "IN"
do shell script "mkdir -p " & quoted form of (POSIX path of inFolder)
set {TID, text item delimiters} to {text item delimiters, " "}
set listOfInputs to paragraphs 2 thru -1 of (do shell script ("find " & quoted form of (POSIX path of inFolder) & " \\! -name \".*\"")) as text
set text item delimiters to TID

这篇关于Applescript 系统事件返回 .DS_Store - 我怎么能忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆