国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Mac切換橫豎屏

2023-03-11 14:31 作者:君匡  | 我要投稿

前言

一個程序猿么,在用不同系統(tǒng)的時候,顯示器的屏幕狀態(tài)會切換的,比如用Mac在看文檔或者擼代碼時用豎屏,用Win打游戲時用橫屏。

其實手動旋轉(zhuǎn)屏幕倒是其次,但是有時候在橫屏狀態(tài)下突然打開Mac就有些麻木了。手動設(shè)置一兩次便不說什么了,但是博主多次設(shè)置后著實覺得有點兒麻煩!所以找了一下腳本。

參考的腳本是有多個顯示器的話,需要遍歷去修改。

我這里提供一個單顯示器的腳本來切換。

系統(tǒng)環(huán)境:Monterey 12.4

腳本代碼

首先,打開腳本編輯器.app這個應(yīng)用。

輸入腳本內(nèi)容:

(*
Now?works?with?Monterey?12.4
Rotate?Display?on?machines,?support?toggling?between?only?two?modes?-?landscape?and?portrait

NOTE:?UI?Scripting?must?be?enabled?for?this?to?work!??Confirm?that
"Enable?access?for?assistive?devices"?is?checked?in?the?
Universal?Access?System?Preference?Pane

*)


(*
v1.2.2022-12-15?updated?to?work?on?Monterey?12.4.??Thanks,?Keen
v1.2.2013-01-26?Thanks,?Rich?Graham?for?pointing?out?that?display?panels?may?have?different?layouts.??"button?1"?below?might?need?to?change?to?"button?2"?(or?3).
v1.1.2012-09-02?updated?to?work?on?10.8?Mountain?Lion.??Thanks,?F.?Parsons
v1.1.2010-08-01?updated?to?work?with?10.6.4's?reverted(?)?display?panel
v1.1.2010-04-08?updated?to?work?with?10.6.3's?revised?display?panel
v1.1.2006-03-01?updated?to?handle?displays?with?the?same?name.
v1.1.2006-05-28-Bryan?updated?to?handle?displays?with?the?same?name.
v1.1.2009-08-02?-?Bryan?updated?to?work?with?Snow?Leopard
*)

--?打開系統(tǒng)偏好設(shè)置中的顯示器
tell?application?"System?Preferences"
?activate
?set?current?pane?to?pane?"com.apple.preference.displays"
end?tell

delay?3

my?setDisplay(1)

on?setDisplay(thisDisplay)
?set?rotatable?to?false
?tell?application?"System?Events"
??tell?process?"System?Preferences"
???tell?window?thisDisplay
????tell?group?1
?????try
??????click?pop?up?button?3
??????tell?pop?up?button?3
???????repeat?with?i?from?1?to?4
????????if?selected?of?menu?item?i?of?menu?1?is?true?then
?????????exit?repeat
????????end?if
???????end?repeat
???????log?i?--?標準水平就是1,90度是2,180度是3,270度是4
???????--?我的邏輯是在標準水平和垂直之間進行切換
???????if?i?is?equal?to?1?then
????????--?is?landscape?now,?switch?to?portrait?mode
????????set?rotateMenuItem?to?4
???????else
????????--?is?not?landscape?now,?switch?to?landscape
????????set?rotateMenuItem?to?1
???????end?if
???????click?menu?item?rotateMenuItem?of?menu?1
??????end?tell
??????--?If?"Standard"?is?selected,?no?confirmation?dialog?is?displayed.
??????if?rotateMenuItem?is?not?1?then
???????set?rotatable?to?true
??????end?if
?????on?error
??????log?"Can't?rotate?display.?It?may?be?the?laptop's?built?in?display."
?????end?try
????end?tell
???end?tell
???
???delay?5
???if?rotatable?then
????--??等切換完成五秒之后,確認窗口
????try
?????tell?window?1
??????tell?sheet?1
???????click?button?"確認"
???????log?"success"
??????end?tell
?????end?tell
????on?error?errText
?????log?errText
?????delay?1
????end?try
???end?if
???
???quit
??end?tell
?end?tell
end?setDisplay

保存成為App文件即可。

注意運行的時候需要打開輔助功能選項。

感謝

用Alfred實現(xiàn)Mac OSX快捷旋轉(zhuǎn)屏幕

Alfred 快捷切換MacBook外接顯示器橫豎屏





Mac切換橫豎屏的評論 (共 條)

分享到微博請遵守國家法律
岑巩县| 仪征市| 庆云县| 白朗县| 平塘县| 留坝县| 眉山市| 封开县| 元阳县| 甘泉县| 霸州市| 昔阳县| 安龙县| 磴口县| 黄平县| 中牟县| 津市市| 琼结县| 湖州市| 图片| 永福县| 沙湾县| 二手房| 合阳县| 虞城县| 东辽县| 弥勒县| 泾源县| 洮南市| 新平| 玛纳斯县| 石嘴山市| 滨海县| 五大连池市| 越西县| 衡水市| 汝南县| 牡丹江市| 高邮市| 姜堰市| 凌源市|