おいしいマクロの作り方 (完結編)

前回までの流れ

 第1回 第2回 第3回 第4回 第5回 第6回

  • 「指定した時間経ったらマナーモードを解除する」マクロを作る
  • 一応完成

最終形

ということでマクロの最終形は以下のようになりました。

起動用設定(ショートカット等)
  • プログラム=\Program Files\CondExec\CondExec.exe
  • パラメータ=-section=MannerToggle
CondExec CondExec.ini
[MannerToggle]
class=DoNothing
title=MannerTimer
check=current
trigger=running
exec=close
onunmatch=\Program Files\SimpleMenu\SimpleMenu.exe|MannerTimer.ini

[MannerTimer]
class=DoNothing
title=MannerTimer
check=both
trigger=closed
exec=\Program Files\SetManner\SetManner.exe|/off
exec=\Program Files\IfMsg\IfMsg.exe|マナーモードを解除しました
polling=10000
SimpleMenu MannerTimer.ini
[30分]
\Program Files\execmulti\execmulti.exe|MannerTimer_30
[60分]
\Program Files\execmulti\execmulti.exe|MannerTimer_60
[90分]
\Program Files\execmulti\execmulti.exe|MannerTimer_90
[120分]
\Program Files\execmulti\execmulti.exe|MannerTimer_120
[180分]
\Program Files\execmulti\execmulti.exe|MannerTimer_180
[連続]
\Program Files\execmulti\execmulti.exe|MannerTimer_Never
ExecMulti execmulti.ini
[MannerTimer_30]
\Program Files\DoNothing\DoNothing.exe|-execmode=open -alivetime=1800000 -showicon=false -title=MannerTimer
\Program Files\execmulti\execmulti.exe|MannerTimer

[MannerTimer_60]
\Program Files\DoNothing\DoNothing.exe|-execmode=open -alivetime=3600000 -showicon=false -title=MannerTimer
\Program Files\execmulti\execmulti.exe|MannerTimer

[MannerTimer_90]
\Program Files\DoNothing\DoNothing.exe|-execmode=open -alivetime=5400000 -showicon=false -title=MannerTimer
\Program Files\execmulti\execmulti.exe|MannerTimer

[MannerTimer_120]
\Program Files\DoNothing\DoNothing.exe|-execmode=open -alivetime=7200000 -showicon=false -title=MannerTimer
\Program Files\execmulti\execmulti.exe|MannerTimer

[MannerTimer_180]
\Program Files\DoNothing\DoNothing.exe|-execmode=open -alivetime=10800000 -showicon=false -title=MannerTimer
\Program Files\execmulti\execmulti.exe|MannerTimer

[MannerTimer_Never]
\Program Files\DoNothing\DoNothing.exe|-execmode=open -alivetime=0 -showicon=false -title=MannerTimer
\Program Files\execmulti\execmulti.exe|MannerTimer

[MannerTimer]
\Program Files\SetManner\SetManner.exe|/on
\Program Files\IfMsg\IfMsg.exe|マナーモードを設定しました
\Program Files\CondExec\CondExec.exe|-execmode=open -showicon=false -section=MannerTimer

変更点は以下のとおり。

  • CondExecの-debug=TRUEを削った
  • CondExec、DoNothingを-showicon=false(常駐中にアイコン非表示)にした
  • SetManner、ExecMultiにタイマー時間を追加した

注意点

  • サスペンド中はCondExecのタイマーも停止するようで、激しく役に立ちません(待て
    • マクロを思いついて作ってみたら役立たず、なんてことはしょっちゅうです、ぐふ。
    • サスペンドしないように設定する」のは電池が勿体無いので没
    • 起動時の時刻から指定分数後を終了時刻として設定し、チェック時にその時刻を過ぎていたら終了する」ような処理ができれば、サスペンド復帰した直後に終了できるんですが・・・例によって誰か作ってくれませんかね(ぉぃ!
  • Todayから[*]キー長押しでマナーモードOn/Offした場合は動作がおかしくなります。
  • あとタイマー中に再起動した場合タイマーは切れますのでご注意を。
    • レジストリ監視でもしないとこれらは対応できません
    • でも逆に監視さえできれば対応できる可能性が・・・(ゴクリ)

まとめ

当初の予定以上に長い連載になったうえ、まともに使えないというオチまでついてしまいましたorz

で、連載の終わりにこんなこというのもアレなんですが・・・紹介した手順でマクロを作るのは、効率が悪いのでお勧めしません。それよりすぐに作り始めて、作りながら仕様をまとめてくほうが絶対に楽です。複数のパターンを比較/検討しないですみますし、何より今回のような不具合もそれだけ早く見つかるからです。


とまぁ最後までグダグダな連載でしたが、皆さんのマクロライフに少しでもお役に経てば幸いです。でももう二度とやらん・・・