Mac在一段时间不使用后,应用会自动退出的解决方法

解决方法:
在系统偏好设置-安全性与隐私-通用-高级
把“在XX分钟不活跃后注销”的勾去掉就好。

### 回答1: 我可以提供一段代码给你,可以实现Mac开机开启随航功能,并连接iPad: # 开启随航功能 defaults write com.apple.BluetoothAutoPowerOnAndConnected -bool true# 连接iPad osascript -e 'tell application "System Events" to Bluetooth connect device iPad' ### 回答2: 可以使用AppleScript编写一段代码来实现Mac开机开启随航功能并连接iPad。 首先,打开Script Editor(脚本编辑器)应用程序。然后,在脚本编辑器中输入以下代码: ``` tell application "System Events" tell process "SystemUIServer" set frontApp to name of first application process whose frontmost is true end tell end tell if frontApp is "Finder" then tell application "System Events" tell application "System Preferences" to activate tell application "System Preferences" reveal pane id "com.apple.preference.sidecar" delay 1 tell application "System Events" tell application process "System Preferences" repeat until exists tab group 1 of window 1 end repeat tell tab group 1 of window 1 tell radio group 1 click radio button "Display" end tell end tell end tell end tell delay 0.5 tell application "System Events" tell application process "System Preferences" click button "连接" of window 1 end tell end tell end tell end tell end if ``` 然后,点击脚本编辑器中的运行按钮来运行脚本。当你的Mac开机并且Finder是前台应用程序时,脚本自动打开“显示”选项卡,并点击“连接”按钮来连接iPad,开启随航功能。 希望这段代码能够帮到你!如果你有任何问题,请随时提问。 ### 回答3: 要实现Mac开机开启随航功能并连接iPad,你可以使用Apple提供的自动化工具——自动化脚本。具体步骤如下: 1. 打开Script Editor(脚本编辑器),此应用程序可以在“应用程序”文件夹中找到。 2. 在Script Editor中创建一个新的脚本。 3. 输入以下代码,实现开机自动开启随航功能: ``` tell application "System Events" tell process "SystemUIServer" set theMenu to menu bar item 4 of menu bar 1 click theMenu delay 0.5 click menu item "随航" of menu 1 of theMenu end tell end tell ``` 4. 输入以下代码,实现自动连接iPad: ``` tell application "System Events" tell process "SystemUIServer" set theMenu to menu bar item 4 of menu bar 1 click theMenu delay 0.5 click menu item "蓝牙" of menu 1 of theMenu delay 0.5 click menu item "连接新设备..." of menu 1 of menu item "蓝牙" of menu 1 of theMenu delay 1 click button "继续" of window 1 delay 1 click button "下一步" of sheet 1 of window 1 delay 1 click button "完成" of sheet 1 of window 1 end tell end tell ``` 5. 保存脚本,选择一个你喜欢的名称。 6. 将脚本添加到登录项中。 - 从菜单栏中选择“苹果菜单” > “系统偏好设置”。 - 点击“用户与群组”。 - 点击左下角的锁图标,输入你的密码解锁设置。 - 点击“登录项”选项卡。 - 点击“+”按钮,在弹出窗口中找到并选择你保存的脚本文件。 - 退出系统偏好设置。 这样,当Mac开机后,随航功能将自动开启,并连接到您的iPad。请确保在运行脚本之前添加了您的iPad到蓝牙设备中。
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值