你能用 javascript (jxa) 编写文件夹操作吗?
问题描述:
我正在寻找 AppleScript 的直接翻译
I am looking for a direct translation of AppleScript's
on adding folder items to this_folder
但我似乎无法在任何地方找到它,无论是术语的用法还是关键字 this_folder 本身.
but I can't seem to find it anywhere, neither the usage of the terms or the keyword this_folder itself.
答
使用 Automator 我可以构建一个文件夹操作工作流,以仅使用 JavaScript 来显示移动到文件夹的文件的路径:
Using Automator I could build a Folder Action workflow to display the path of a file moved to a folder using only JavaScript:
function run(input, parameters) {
var app = Application.currentApplication();
app.includeStandardAdditions = true;
var text = "FileName = " + input[0];
var options = { };
app.displayAlert(text, options);
return input;
}
希望能帮到你.