Last active
July 27, 2020 05:37
-
-
Save incheon-kim/75c9c7d6c20add8851d606395075deed to your computer and use it in GitHub Desktop.
맥OS에서 부트캠프로 재부팅하는 applescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set isTest to false | |
set thePW to "Your PW here - WARNING! - saving password as plain text it not recommended" | |
# if you want type password yourself or use touchID(set askPW to false) / or (set askPW to true) | |
set askPW to false | |
# if you don't want ask dialog(set alwaysYes to true) / if you want dialog (set alwaysYes to false) | |
set alwaysYes to false | |
if not alwaysYes then | |
display dialog "Reboot to Bootcamp Partition?" buttons {"Reboot", "Cancel"} default button "Cancel" | |
end if | |
if alwaysYes or the button returned of the result is "Reboot" then | |
# 시동 디스크 항목 오픈, open startupdisk panel | |
tell application "System Preferences" | |
activate | |
set current pane to pane "com.apple.preference.startupdisk" | |
end tell | |
tell application "System Events" | |
tell process "System Preferences" | |
# 시동 디스크 패널이 로드될 때 까지 기다리기, wait until panel is ready | |
repeat until exists button "변경하려면 자물쇠를 클릭하십시오." of window 1 | |
delay 0.5 | |
end repeat | |
# 자물쇠 버튼 클릭, click unlock button | |
click button 2 of window 1 | |
# 암호 사용 클릭, click use password | |
click button 2 of sheet 1 of window 1 | |
delay 0.5 | |
# 암호 입력, password input | |
if askPW then | |
keystroke thePW | |
keystroke return | |
end if | |
# 암호 입력 창이 닫힐 때 까지 기다리기, wait until password ask modal closed | |
repeat until exists sheet 1 of window 1 | |
delay 0.5 | |
end repeat | |
# 암호 입력 절차가 모두 끝나기를 대기, wait until every procedure end | |
repeat until exists button "더 이상 변경하지 않으려면 자물쇠를 클릭하십시오." of window 1 | |
delay 0.5 | |
end repeat | |
# 부트캠프 파티션 선택, select bootcamp partition | |
click radio button "BOOTCAMP" of radio group 1 of scroll area 1 of group 1 of splitter group 1 of window 1 | |
# 재시동 버튼 클릭, click reboot button | |
click button 1 of window 1 | |
# Confirm | |
repeat until exists sheet 1 of window 1 | |
delay 0.5 | |
end repeat | |
if isTest then | |
get button 1 of sheet 1 of window 1 | |
else | |
click button 1 of sheet 1 of window 1 | |
end if | |
end tell | |
end tell | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment