Slack 特定のチャンネルに 3x3 の 💪 を入力する AppleScript
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
# Slack の入力欄に :muscle: をたくさん打ち込むスクリプト | |
# 3x3 に渡ってたくさんの muscle を自動で打ち込む | |
property channelName : "" | |
on run argv # TIPS: {"arg1", "arg2"...} と複数設定できる | |
if (count of argv) > 0 then | |
set channelName to argv | |
else | |
set channelName to "my-rails" # 未指定の場合、この値を設定 | |
end if | |
# NOTE: すでにアプリケーションが起動している必要がある | |
tell application "Slack" | |
activate | |
delay 0.2 | |
# キーストロークをシステムイベントとして送信 | |
# NOTE: 適宜 delay を入れないと操作が速すぎて 受け付けてもらえない | |
tell application "System Events" | |
keystroke "k" using command down | |
delay 1.0 | |
# 指定されたチャンネル名に切り替え | |
keystroke channelName | |
delay 0.5 | |
keystroke return | |
delay 0.5 | |
# 入力欄にフォーカスを移動 | |
keystroke tab | |
# 3x3 の :muscle: の入力と送信 | |
repeat 3 times | |
repeat 3 times | |
keystroke ":muscle" | |
keystroke return | |
delay 0.1 | |
end repeat | |
keystroke return using {control down} | |
end repeat | |
keystroke return | |
end tell | |
end tell | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment