你能用 javascript (jxa) 编写文件夹操作吗? [英] Can you write folder actions with javascript (jxa)?

查看:21
本文介绍了你能用 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;
}

希望能帮到你.

这篇关于你能用 javascript (jxa) 编写文件夹操作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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