Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on BTdevice_connected(theDevice)
- try
- set theData to do shell script "system_profiler SPBluetoothDataType"
- set {TID, text item delimiters} to {text item delimiters, theDevice}
- set theData to text item 3 of theData
- set text item delimiters to "Connected: "
- set theData to word 1 of text item 2 of theData
- set text item delimiters to TID
- return theData is "Yes"
- on error
- return false
- end try
- end BTdevice_connected
- mm2_init()
- on inited(a) --초기화 확인
- if a is true then --초기화 되었고
- if BTdevice_connected("Magic Mouse 2") is true then --마우스가 연결되어있다면
- display dialog "a"
- delay 30 --360초동안 대기
- inited(true)
- else --마우스 연결이 해제되었다면
- inited(false) --
- end if
- else --마우스 연결 해제시
- mm2_init() --재초기화 필요
- end if
- end inited
- on mm2_init() --지터치 초기화, 마우스 상태 확인
- if BTdevice_connected("Magic Mouse 2") is true then
- tell application "Jitouch"
- quit
- end tell
- do shell script "open ~/Library/PreferencePanes/Jitouch.prefPane/Contents/Resources/Jitouch.app"
- inited(true)
- else
- display dialog "b"
- delay 10
- mm2_init()
- end if
- end mm2_init
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement