AppleScript 循环询问 (3) 个问题,select 多个查找器文件,将结果合并到一个文本文件中

AppleScript loop to ask (3) questions, select multiple finder files, combine results into a text file

我正在寻求有关设置 Apple 脚本的帮助。我一直试图从网络上的不同示例中复制和过去,但无济于事。我正在为家庭成员设置日志/日记,需要一个包含以下信息的文本文件。

AppleScript 将显示一个对话框,询问三件事:
活动名称 活动日期 事件描述

其中每一个都将存储为一个单独的变量。

然后脚本会要求从 Finder 中选择文件,没有嵌套,只是选择 15 - 30 个文件,所有文件都包含在同一个文件夹中。

最终将创建一个新的 TextEdit 文档 文档的开头会将 (3) 个变量与一些默认文本混合在一起。 根据从查找器中选择的文件数量,文件的中间将填充一个重复循环。它们的文件路径将与其他默认文本混合在一起。 最后一部分仅为默认文本,不需要变量。

我确信我的描述比脚本可能要复杂得多。谁能为我提供这个脚本?将不胜感激。

这是一个粗略的想法,最终会是什么样子。粗体部分是变量。

The activity of the day was scuba diving.
The date you went scuba diving was January 1, 2016.
This is a description of your event. The day was quite beautiful and the water was perfect. You were able to see a wide variety of fishes!

These are the locations of the files from this event.
The first file is /events/scuba/scuba1.txt
These are the locations of the files from this event.
The first file is /events/scuba/scuba2.txt
These are the locations of the files from this event.
The first file is /events/scuba/scuba3.txt

This was a summary of your scuba diving activity. These memories will last a lifetime!

感谢您对此提供的帮助。如果有问题的家庭成员能够表示感谢,请知道他们也会的。

我可以建议使用 Evernote 的替代解决方案吗?

您可以使用 table 创建一个 "template" 便笺,以填写 activity、日期和描述。任何时候你想要一个新的日记条目,只需 select 模板,然后转到笔记 > 复制到笔记本。

然后您可以附加and/or导入文件的文本。

这还可以让您添加图像和其他附件,并使搜索更容易。当然也很容易分享。

如果您想了解更多详情,请告诉我。

示例截图:

你可以这样做:

set evName to text returned of (display dialog "The name of an event" default answer "")
set evdate to text returned of (display dialog "The date of the event" default answer "")
set evDesc to text returned of (display dialog "A description for the event" default answer "")

set theText to "The activity of the day was " & evName & return & "The date you went " & evName & " was " & evdate & return & evDesc & return & return
set x to choose file with multiple selections allowed

set def1 to "These are the locations of the files from this event."
set def2 to "The first file is "
repeat with i in x
    set theText to theText & def1 & return & def2 & (POSIX path of i) & return
end repeat

set theText to theText & return & "This was a summary of your " & evName & " activity. These memories will last a lifetime!"
tell application "TextEdit"
    make new document with properties {text:theText}
    activate
end tell