21.10.17 08:34 작성
·
435
1
듀얼모니터와 관련하여 질문을 드려요~~~
매번 듀얼모니터를 연결하기 위해서
시스템 환경설정 > 디스플레이에 들어가서 연결하는 것이 불편해서 아래와 같이 매크로를 만들었어요.
잘 되기는 하는데..
시간이 살짝 딜레이 되는 부분도 있고,
같은 기능을 애플스크립트로 짜고 싶어요.
답변 6
0
2021. 10. 28. 19:30
와~~ 감사합니다^^
당분간은 업데이트를 하지 않고 사용해야 될 것 같아요.
혹.. 나중에 Monterey 에서 사용이 가능해지면 그 때 업데이트를 해야 겠네요^^
너무 감사하고, 잘 사용하겠습니다^^
0
2021. 10. 28. 18:42
toggle 기능을 추가하였습니다.
++++++++++++++++++++++++++++++++++++++++
(*
The MIT License (MIT)
Copyright (c) 2015 guileschool
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*)
property MYDISPLAY1 : "끔"
property MYDISPLAY2 : "Bedroom"
toggleAirplayDisplay()
--setAirplayDisplay(MYDISPLAY2)
--setAirplayDisplay(MYDISPLAY1)
--
-- setAirplayDisplay
-- 디스플레이 설정
--
on setAirplayDisplay(displayName)
tell application "System Preferences"
set current pane to pane "com.apple.preference.displays"
end tell
delay 0.5
tell application "System Events" to tell application process "System Preferences"
-- 디스플레이 장치가 최대 5개 있다고 가정
repeat with winnum in {1, 2, 3, 4, 5}
-- case 1
try
tell pop up button 1 of window winnum
click
tell menu 1
click menu item displayName
end tell
end tell
exit repeat
end try
-- case 2
try
tell pop up button 1 of group 1 of window winnum
click
tell menu 1
click menu item displayName
end tell
end tell
exit repeat
end try
end repeat
end tell
end setAirplayDisplay
--
-- toggleAirplayDisplay
-- 디스플레이 토글
--
on toggleAirplayDisplay()
tell application "System Preferences"
set current pane to pane "com.apple.preference.displays"
end tell
delay 0.5
tell application "System Events" to tell application process "System Preferences"
-- 디스플레이 장치가 최대 5개 있다고 가정
repeat with winnum in {1, 2, 3, 4, 5}
-- case 1
try
set currentDisplayMode to value of attribute "AXvalue" of pop up button 1 of window winnum
if currentDisplayMode is MYDISPLAY1 then
set selectDisplayMode to MYDISPLAY2
else
set selectDisplayMode to MYDISPLAY1
end if
tell pop up button 1 of window winnum
click
tell menu 1
click menu item selectDisplayMode
end tell
end tell
exit repeat
end try
-- case 2
try
set currentDisplayMode to value of attribute "AXvalue" of pop up button 1 of group 1 of window winnum
if currentDisplayMode is MYDISPLAY1 then
set selectDisplayMode to MYDISPLAY2
else
set selectDisplayMode to MYDISPLAY1
end if
tell pop up button 1 of group 1 of window winnum
click
tell menu 1
click menu item selectDisplayMode
end tell
end tell
exit repeat
end try
end repeat
end tell
end toggleAirplayDisplay
++++++++++++++++++++++++++++++++++++++++
0
2021. 10. 28. 17:21
아.. 그래요..
전 아직 12.0으로 업데이트를 하지 않은 상태인데..
(지금은 잘 작동합니다^^)
Monterey로 업데이트하게 되면..
위 애플스크립트를 수정해야 하는 건가요?
아니면 12.0 에서는 아예 작동하지가 않는 건가요?
(일단 업데이트를 하지 않고 기다려 보도록 하겠습니다ㅠ)
2021. 10. 28. 18:42
몬터레이는 system preferences GUI 에 큰 변화가 있었습니다.
몬터레이에서의 애플 스크립트 코드 구현이 어렵다는 뜻은 아니고, 이 소스는 macOS 몬터레이와 호환이 안된다는 정도로 이해하시면 될 것 같네요.
그리고, 요청하신 토글 디스플레이 기능을 구현하였습니다.
0
2021. 10. 27. 22:51
이태근님!
코드를 만들어 보았습니다. 적당히 수정하여 사용하시면 됩니다.
수고하세요~~
+++++++++++++++++++++++++++++++++++++++
(*
The MIT License (MIT)
Copyright (c) 2015 guileschool
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*)
setAirplayDisplay("애플TV")
--setAirplayDisplay("끔")
on setAirplayDisplay(displayName)
tell application "System Preferences"
set current pane to pane "com.apple.preference.displays"
end tell
delay 0.5
tell application "System Events" to tell application process "System Preferences"
-- 디스플레이 장치가 최대 5개 있다고 가정
repeat with winnum in {1, 2, 3, 4, 5}
-- case 1
try
tell pop up button 1 of window winnum
click
tell menu 1
click menu item displayName
end tell
end tell
exit repeat
end try
-- case 2
try
tell pop up button 1 of group 1 of window winnum
click
tell menu 1
click menu item displayName
end tell
end tell
exit repeat
end try
end repeat
end tell
end setAirplayDisplay
++++++++++++++++++++++++++
0
0
2021. 10. 18. 19:25
이태근님! 반갑습니다:)
애플스크립트로 처리하면 반응 속도나 정확도 모두 좋아지는 것이 맞습니다.
화면 구성으로 보아 macOS 카타리나나 빅서를 사용하시는 것으로 짐작됩니다.
제 개인 사정으로 답변은 조금 기다리셔야 할 것 같아요.
다시 글 남기겠습니다.
2021. 10. 28. 17:07
이태근님!
macOS 12.0 몬터레이에서는 동작하지 않습니다. 참고해주세요.
유용하게 사용하셨으면 좋겠습니다:)