簡體   English   中英

在Automator中,shell腳本出現問題導致applescript

[英]Having trouble with shell script result in applescript, in Automator

我有一個腳本,該腳本僅允許通過右鍵單擊將標記添加到文件中。 我選擇標簽,腳本將自動添加它們。 它們具有特定的形式:“&tag”,並且用空格隔開。

我想要做的是擁有一個自動化應用程序,其中shell腳本根據特定條件搜索文件,然后該腳本將結果傳遞給applescript。

因此,我的自動化應用程序以“ Run Shell Script”塊開始,這是其中的唯一內容。

mdfind '(kMDItemContentTypeTree == "public.image" || kMDItemContentTypeTree == "public.video") && kMDItemFinderComment == "*&tag*"cd'

這將返回帶有POSIX路徑的文件列表。 像這樣:{“ / User / path1 / file1”,“ / User / path2 / file2”等}

然后,我有一個“運行Applescript”框,我想在其中訪問文件和它們的注釋,但是無論我嘗試多少,它都不起作用。 我嘗試使用POSIX文件,或從“ tell finder”塊訪問注釋。

這是最簡單的代碼,我認為應該可以正常工作,但事實並非如此!

on run {input, parameters}
  repeat with f in input
    display dialog (comment of f) as text
  end repeat
  return input
end run

有誰知道可能是什么問題? 我想念什么? 請幫幫我!

謝謝!

嘗試這樣的事情:

on run {input, parameters}
    tell application "Finder"
        repeat with i from 1 to number of items in input
            display dialog comment of (POSIX file (item i of input) as alias) as text
        end repeat
    end tell
    return input
end run

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM