Created
July 31, 2020 01:41
-
-
Save UskeS/b779ddfa506616cafc65395ea7a84874 to your computer and use it in GitHub Desktop.
記述範囲の数値をカンマ区切りで取得するJXA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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