Skip to content

Instantly share code, notes, and snippets.

@lyokato
Created November 22, 2016 13:34
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 lyokato/5b492ab8583f95ec800fade825ddf104 to your computer and use it in GitHub Desktop.
Save lyokato/5b492ab8583f95ec800fade825ddf104 to your computer and use it in GitHub Desktop.
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "AppKit"
on run {input, parameters}
set bundle to current application's NSBundle's bundleWithPath:"/Applications/Utilities/Keychain Access.app/Contents/Resources/Keychain.menu/"
bundle's load
set aClass to bundle's classNamed:"AppleKeychainExtra"
set aObj to aClass's alloc
set aKeyChain to aObj's init
aKeyChain's performSelector:"_lockScreenMenuHit:" withObject:(null) afterDelay:0.0
delay 0.01
return input
end run
@lyokato
Copy link
Author

lyokato commented Nov 22, 2016

  1. Automatorでworkflow作成
  2. 「AppleScriptを実行」を追加して上のスクリプトを記入
  3. サービスは次の項目を受け取ります-> 「入力なし」
  4. 以上の設定でworkflow保存
  5. 「システム環境設定」のショートカットタブをクリック
  6. 左のメニューからサービスを選択
  7. 上で作ったworkflowが右のリストの中にあるので選択してショーカット追加

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment