gpt4 book ai didi

Applescript:突出显示组中的最新文件

转载 作者:行者123 更新时间:2023-12-02 22:04:15 25 4
gpt4 key购买 nike

我想知道您将如何创建一个操作,您可以在其中突出显示一组文件并从中获取修改日期,然后让它突出显示/选择/标记最近日期的文件。

更新:我想在 Applescript 上做这件事,因为我在这方面做得更进一步。这是我目前所拥有的

set dateList to {}
tell application "Finder"
set inputList to get selection
repeat with i from 1 to count (inputList)
set end of dateList to get modification date of item i of inputList
end repeat
end tell

dateList

--Compare section...

set boolList to {}
set j to 1
repeat with i from 1 to count (dateList)
if i is (count (dateList)) then
set j to 0
end if
set end of boolList to item i of dateList > item (i + j) of dateList
end repeat

boolList

最佳答案

查看您现有的 applescript 代码,这应该按上次修改日期对您选择的所有文件进行排序,并将最新结果返回到对话框中:

set dateList to {}
tell application "Finder"
set inputList to get selection
repeat with i from 1 to count (inputList)
set end of dateList to get modification date of item i of inputList
end repeat
end tell

--Compare section...

set modDate to item 1 of dateList
repeat with i from 1 to count (inputList)
if dateList's item i > modDate then
set modDate to dateList's item i
set theResult to displayed name of item i of inputList
set theResultDate to item i of dateList
end if
end repeat

--Display Result…

display alert "Most recently modified file in selection:" message "" & theResult & "
" & theResultDate

关于Applescript:突出显示组中的最新文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16389511/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com