Skip to content

Instantly share code, notes, and snippets.

@UskeS
Created July 31, 2020 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UskeS/b779ddfa506616cafc65395ea7a84874 to your computer and use it in GitHub Desktop.
Save UskeS/b779ddfa506616cafc65395ea7a84874 to your computer and use it in GitHub Desktop.
記述範囲の数値をカンマ区切りで取得するJXA
/**
* Automatorの各設定
* ワークフローが受け取る項目:テキスト
* 検索対象:すべてのアプリケーション
* 選択されたテキストを出力で置き換える をオン
*/
function run(input, parameters) {
input = input[0].split(/ *-> */);
if (input.length !== 2) return;
if (isNaN(input[0]) || isNaN(input[1]) || input[0]>=input[1]) return;
var res = [];
for (var i=input[0]; i<input[1]; i++) {
res.push(i);
}
return res.join(", ");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment