首页 网站首页 商业信息 脚本 查看内容

iPad随航脚本(Mac13.0Ventura)

admin 2023-1-24 20:31 6777人围观 脚本

参考文章和视频:

将iPad作为Mac Mini主屏幕的实现方式

视频:无屏自动启动随航 iPad作为M1 Mac mini的显现器利用 开机启动随航剧本 教程

iPad无屏随航Mac的APPleScript剧本(Ventura测试版本)


假如你是简体中文用户,想要傻瓜版:去这里 ccccc:傻瓜版-利用快速指令给ipad随航

最新代码(主说话纷歧样代码纷歧样):

1.单iPad的用户利用代码:(间接复制,不需要点窜)

主说话为简体中文的用户:

set counter to 0
set x to 0
beep 1

repeat while counter = 0 and x < 5
tell application "System Settings"

activate

delay 1

tell application "System Events"

tell process "System Settings"

click menu item "显现器" of menu "显现" of menu bar item "显现" of menu bar 1

delay 0.5

tell group 1 of group 2 of splitter group 1 of group 1 of window "显现器"

try

click pop up button 1

delay 0.6

if (menu item "毗连键盘和鼠标至" of menu 1 of pop up button 1) exists then

click menu item 5 of menu 1 of pop up button 1

else

click menu item 2 of menu 1 of pop up button 1

end if

say "iPad Connecting"

set counter to 1

on error

if x = 0 then say "Sorry,Try again"

set x to x + 1

delay 2

end try

end tell

end tell

end tell

end tell
end repeat

if x = 5 then
say "there are some errors"
end if

主体说话为繁体中文的用户:

set counter to 0

set x to 0

beep 1

repeat while counter = 0 and x < 5
tell application "System Settings"
activate
delay 1


tell application "System Events"
tell process "System Settings"

click menu item "顯示器" of menu "顯示方式" of menu bar item "顯示方式" of menu bar 1
delay 0.5
tell group 1 of group 2 of splitter group 1 of group 1 of window "顯示器"
try
click pop up button 1
delay 0.6
if (menu item "將鍵盤和滑鼠連結到" of menu 1 of pop up button 1) exists then
click menu item 5 of menu 1 of pop up button 1
else
click menu item 2 of menu 1 of pop up button 1
end if
say "iPad Connecting"

set counter to 1
on error
if x = 0 then say "Sorry,Try again"

set x to x + 1
delay 2
end try

end tell

end tell
end tell


end tell

end repeat


if x = 5 then

say "there are some errors"

end if



代码道理:



https://www.zhihu.com/video/1571101098517135360

2.多iPad用户利用代码(需要自行点窜)

简体中文:

set counter to 0
set x to 0
beep 1

repeat while counter = 0 and x < 5
tell application "System Settings"

activate

delay 1

tell application "System Events"

tell process "System Settings"

click menu item "显现器" of menu "显现" of menu bar item "显现" of menu bar 1

delay 0.5

tell group 1 of group 2 of splitter group 1 of group 1 of window "显现器"

try

click pop up button 1

delay 0.6

if (menu item "毗连键盘和鼠标至" of menu 1 of pop up button 1) exists then

#点窜之处 按照对应情况点窜数字
click menu item 5 of menu 1 of pop up button 1

else
#点窜之处,按照对应情况点窜数字
click menu item 2 of menu 1 of pop up button 1

end if

say "iPad Connecting"

set counter to 1

on error

if x = 0 then say "Sorry,Try again"

set x to x + 1

delay 2

end try

end tell

end tell

end tell

end tell
end
repeat

if x = 5 then
say "there are some errors"
end if

繁体中文:

set counter to 0

set x to 0

beep 1

repeat while counter = 0 and x < 5
tell application "System Settings"
activate
delay 1


tell application "System Events"
tell process "System Settings"

click menu item "顯示器" of menu "顯示方式" of menu bar item "顯示方式" of menu bar 1
delay 0.5
tell group 1 of group 2 of splitter group 1 of group 1 of window "顯示器"
try
click pop up button 1
delay 0.6
if (menu item "將鍵盤和滑鼠連結到" of menu 1 of pop up button 1) exists then
#点窜之处,按照对应情况点窜数字
click menu item 5 of menu 1 of pop up button 1
else
#点窜之处,按照对应情况点窜数字
click menu item 2 of menu 1 of pop up button 1
end if
say "iPad Connecting"

set counter to 1
on error
if x = 0 then say "Sorry,Try again"

set x to x + 1
delay 2
end try

end tell

end tell
end tell


end tell

end repeat


if x = 5 then

say "there are some errors"

end if

所以假如是多iPad装备用户:就会出现



  • 镜像或扩大至
  • iPad称号
  • iPad称号

假如开启了Universal control,还会出现以以下表



  • 毗连键盘和鼠标至
  • iPad称号
  • iPad称号
  • ---------
  • 镜像或扩大至
  • iPad称号
  • iPad称号

菜单里列表项判定:



这里明显有两个列表项:

  • 镜像或扩大至 1
  • iPad pro2020 2

假如要挑选第二项毗连iPad就点击menu item 2,其中menu item 1不成选



这里明显有五个列表项:

  • 毗连键盘和鼠标至 1
  • iPad pro2020 2
  • --------- 3
  • 镜像或扩大至 4
  • iPad pro2020 5

由于要把iPad当扩大屏,所以1,2,3,4项不斟酌,假如要挑选毗连iPad就点击menu item 5

因而代码2中有以下判定:

#判定菜单里能否有毗连键盘和鼠标至选项
if (menu item "毗连键盘和鼠标至" of menu 1 of pop up button 1) exists then
#假如存在,挑选第五个
click menu item 5 of menu 1 of pop up button 1 --此处menu item 数字 点窜成你要连的iPad位置
else
#假如存在挑选第二个
click menu item 2 of menu 1 of pop up button 1 --此处menu item 数字 点窜成你要连的iPad位置
end if

按照现真相况自行点窜

别的几种代码

1.经过终端界面翻开显现器界面(翻开方式分歧,单iPad用户不需要点窜利用)

set counter to 0
set x to 0
beep 1
#翻开号令行界面
tell application "Terminal"
activate
#翻开显现器偏好设备
do script "open . '/System/Library/PreferencePanes/Displays.prefPane'"
delay 0.5
quit
set visible of application "Finder" to false
end tell
repeat while counter = 0 and x < 5
tell application "System Events"
tell window "显现器" of application process "System Settings"
tell group 1 of group 2 of splitter group 1 of group 1
try

delay 1
click pop up button 1
delay 0.6
if (menu item "毗连键盘和鼠标至" of menu 1 of pop up button 1) exists then
click menu item 5 of menu 1 of pop up button 1
else
click menu item 2 of menu 1 of pop up button 1
end if
say "iPad Connecting"
set counter to 1
on error
if x = 0 then say "Sorry,Try again"
set x to x + 1
delay 1
end try
end tell

end tell
end tell
end repeat

if x = 5 then
say "there are some errors"
end if

主体说话为繁体中文的用户:

set counter to 0
set x to 0
beep 1
#翻开号令行界面
tell application "Terminal"
activate
#翻开显现器偏好设备
do script "open . '/System/Library/PreferencePanes/Displays.prefPane'"
delay 0.5
quit
set visible of application "Finder" to false
end tell
repeat while counter = 0 and x < 5
tell application "System Events"
tell window "顯示器" of application process "System Settings"
tell group 1 of group 2 of splitter group 1 of group 1
try
delay 1
click pop up button 1
delay 0.6
if (menu item "將鍵盤和滑鼠連結到" of menu 1 of pop up button 1) exists then
click menu item 5 of menu 1 of pop up button 1
else
click menu item 2 of menu 1 of pop up button 1
end if
say "iPad Connecting"
set counter to 1
on error
if x = 0 then say "Sorry,Try again"
set x to x + 1
delay 2
end try
end tell

end tell
end tell
end repeat

if x = 5 then
say "there are some errors"
end if

代码假如要运转,需要在帮助功用中翻开“终端”的权限

代码道理:



https://www.zhihu.com/video/1571102590582140930



运转结果

2.经过Mac顶部控制中心翻开(单或多iPad用户需要点窜利用)

set counter to 0
set x to 0

beep 1
repeat while counter = 0 and x < 5

tell application "System Events"
tell application process "ControlCenter"
try

click menu bar item 6 of menu bar 1
repeat until window "控制中心" exists

end repeat

click checkbox 1 of scroll area 1 of group 1 of window "控制中心"
say "iPad Connecting"

set counter to 1
on error

if x = 0 then say "Sorry,Try again"
set x to x + 1
delay 2
end try
end tell
end tell

end repeat


if x = 5 then
say "there are some errors"
end if

代码道理视频:



https://www.zhihu.com/video/1571100302232453120

利用用户需要经过以下代码尝试哪个数字能翻开屏幕镜像的框

在代码编辑器中运转

tell application "System Events"
tell application process "ControlCenter"
#数字6在我的电脑才能生效,你们能够是3,4,5,6,7(自己尝试)
tell menu bar item 6 of menu bar 1
click
end tell

end tell
end tell


运转结果

找到数字后在代码中点窜即可

文雅的利用方式(若何设置):

配合该视频旁观

视频:无屏自动启动随航 iPad作为M1 Mac mini的显现器利用 开机启动随航剧本 教程按照视频里的方式建立翻开

1.设置代码文件

剧本编辑器,粘贴代码,然后



毛病:“剧本编辑器”不答应帮助拜候。"

处理方式:



https://www.zhihu.com/video/1570340646942031872

2.保存文件ctrl+s保存



位置:挑选你需要保存的位置,随意(可是下面iPad快速指令的途径就必须点窜了)

3.双击法式运转

出现不答应帮助拜候



出现授与拜候权限,赞成



出现需要授权帮助功用



和设置代码文件一样的步调,只不外法式换成了立即随航剧本.app




4.设备开启自启动

每次Mac开机城市自动运转该剧本



还需要设备开机不需要密码,否则你开机的时辰只能盲敲密码才能进去,然后自动履行剧本毗连iPad


5.息屏设备

Mac电脑息屏后断开链接,所以只管设备永不,否则息屏后只能盲点激活,然后盲打密码了,然后利用苹果搜索快速键输入立即,然后enter




6.快速指令

iPad太久不利用大概息屏太久会断开题目。

在iPad上面设置个快速指令,可以iPad自动毗连Mac,参考视频:ipad利用siri控制mac随航毗连ipad_哔哩哔哩_bilibili

设置方式:

快速指令链接

https://www.icloud.com/shortcuts/0e15dee4557b47f986672abb8fbcf92b



1.箭头标注的都是需要点窜的地方:

主机:翻开系统设备--》通用--》同享--》主机名(可以在此点窜成你喜好的主机名)

用户:你的用户名

密码:你的密码


你的剧本法式必须放在桌面才行,否则需要点窜途径(倡议小白间接放桌面)若何点窜以下:

代码:

osascript ~/Desktop/立即随航剧本.app

osascript是运转剧本的意义,不需要点窜

~/Desktop/立即随航剧本.app 暗示剧本的寄存途径和称号

若何检察你的剧本寄存的途径和称号

翻开终端Terminal,将剧本拖拽到终端号令行中,即可显现完整途径





2.翻开系统设备--》通用--》同享--》翻开远程登录

这里的主机名需要填在快速指令的主机名里(可以点窜成你喜好的名字)



点击远程登录开关的问号进入具体设备



设备答应和增加用户(没有点+号)




3.确保帮助功用中的剧本是翻开的,还有最下面的sshd也是翻开的




进阶版快速指令(合适多iPad用户)

运转结果:





下载链接:https://www.icloud.com/shortcuts/c8dbea6841c74ed3b0488bf3018f1185

设置:

剧本:

1.获得选项卡菜单的剧本

对应快速指令的test.app

tell application "Terminal"
activate
#翻开键盘偏好设备

do script "open . '/System/Library/PreferencePanes/Displays.prefPane'"
delay 0.5
quit
set visible of application "Finder" to false
end tell

tell application "System Events"

tell window "显现器" of application process "System Settings"
tell group 1 of group 2 of splitter group 1 of group 1
delay 1
click pop up button 1
# 直到UI 元素 menu菜单出现时才竣事循环

repeat until menu 1 of pop up button 1 exists
end repeat
return name of menu item of menu 1 of pop up button 1 --输出:{"毗连键盘和鼠标至", "iPadpro2020", missing value, "镜像或扩大至", "iPadpro2020"}
end tell

end tell
end tell

2.点击选项剧本

对应快速指令的test1.app

on run argv --argv接收需要点击菜单选项的下标

beep 1

tell application "System Events"
tell window "显现器" of application process "System Settings"
tell group 1 of group 2 of splitter group 1 of group 1


try


click menu item argv of menu 1 of pop up button 1 #点击选定的菜单
say "iPad Connecting"
on error
say "Sorry,Please try again"
end try

end tell


end tell


end tell


end run

快速指令需要点窜的地方:

开首:



主机:翻开系统设备--》通用--》同享--》主机名(可以在此点窜成你喜好的主机名)

用户:你的用户名

密码:你的密码

代码:

osascript ~/Desktop/test.app

osascript是运转剧本的意义,不需要点窜

~/Desktop/test.app 暗示剧本的寄存途径和称号

若何检察你的剧本寄存的途径和称号

翻开终端Terminal,将剧本拖拽到终端号令行中,即可显现完整途径

末端:

和开首一样




其他帮助功用之类的如上文快速指令讲的一样:

1.确保test.app和test1.app的帮助功用已翻开

2.翻开远程登录

3.翻开帮助功用的ssh


关于快速指令的弹窗:

这个是提醒初度利用的人不要点这些选项,由因而用来判定iPad位置的

假如感觉麻烦可以删除






运转结果



删除操纵

bug处理:

macOS13.0Ventura版本,由于苹果方面的缘由,不能像Big Sur和Monterey版本一样,不毗连任何显现器让iPad当主屏幕,意义是当前版本假如Mac mini只要iPad一个显现器是会有闪退的bug的,随航是毗连上了可是没有其他显现器的时辰iPad上随航会闪退。

可以经过下载better display(下载better display(https://github.com/waydabber/BetterDisplay)

打不开的去百度网盘:链接: https://pan.baidu.com/s/1fSMlUse1qh8K1hvL47MUNw 提取码: yma3

better display原本是用来开启苹果hidpi显现结果的,道理就是欺骗装备,让他以为你毗连了一个显现器,现实上是虚拟的

1.安装完成后,毗连显现器和iPad停止随航,翻开软件,在上方的菜单栏中找到软件的图标,鄙人拉菜单中找到create new dummy选项,随意选个虚拟显现器



2.然后默许设备为镜像。,这样假如你没有任何显现器,iPad毗连后会自动变成主显现器



3.设备登录项,让better display开性能自启动,和上面设备登录项步调一样。方便那些在外没有显现器,想用iPad毗连Mac mini的人

利用范围:

随航利用范围:

1.需要两台装备都翻开WI-FI和蓝牙功用(wifi连不连网两个装备连的WI-FI纷歧样都没关系,WI-FI蓝牙开关翻开就行)

2.利用数据线毗连两台装备的情况下(在WI-FI或蓝牙功用封闭的情况下)


本文剧本和快速指令利用范围

剧本利用范围:

能随航便可以利用

快速指令利用范围

1.只能在连同一个WI-FI的情况下利用 (ipad毗连A Wi-Fi,电脑毗连B Wi-Fi,会报没法与SSH办事器毗连毛病)

2.数据线毗连IPAD和电脑下利用

拿iPad当主显现器的用户:

设备剧本开机自启动能间接毗连iPad,可是iPad长时候息屏不操纵会断开,这时辰假如电脑未毗连Wi-Fi或毗连的Wi-Fi和iPad纷歧致需要两种方式之一:

1.插上数据线启动快速指令毗连,再拔掉数据线就行了。

2.电脑键盘盲敲 焦距搜索的快速指令(⌘+空格),然后输入剧本称号的前几个字或英文便可以启动剧本。




补充方式:利用快速指令实现随航

碰到题目补充:有人开启了法式的帮助拜候,可是双击运转的时辰还是会报 “不答应帮助拜候“,可以经过以下方式取代 文雅的利用方式1.2.3步

1.在电脑下载快速指令

ShortcutsShortcuts

2.下载完后可以在电脑快速指令利用里看到



3.鼠标右键,点击运转



会出现快速指令不答应帮助拜候



去隐私与平安-帮助功用,翻开siriactionsd



4.再运转一次,成功运转的话就根基完成

5.右击增加到法式坞




6.在法式乌里找到右键-在访达中显现



7.把这里的图标拖到利用法式里






法式坞里的可以移除了




8.设备开机自启动(开机自动毗连ipad,假如你需要的话)

系统设备-通用-登录项-点击+号-在利用法式里找到



8.息屏设备

这里三个选项,第一第二可以不设备,可是第三点需要密码一定要封闭。

假如第一第二不设备永不,息屏后需要利用键盘和鼠标点击一下,等几秒。



9.利用电脑毗连ipad

由于平板熄屏大概电脑熄屏后,会断开毗连,以下两种方式教你毗连iPad

方式1:呼唤siri,间接说翻开毗连平板,便可以了

需要在系统设备-siri与聚焦翻开以下选项



方式2:给毗连平板设备快速键,按快速键毗连

1.翻开自动操纵



2.挑选快速操纵




3.适用工具-开启利用法式-挑选毗连平板.app




4.ctrl+s保存



5.设备快速键

键盘--点击键盘快速键



6.翻开办事--通用--点击无,设备自己喜好的快速键



9.在ipad上点击快速指令毗连随航(需要电脑平板在同一wifi下或电脑平板连上数据线)

1.在ipad高低载快速指令

Shortcuts

2.点窜三处地方



1.箭头标注的都是需要点窜的地方:

主机:翻开系统设备--》通用--》同享--》主机名(可以在此点窜成你喜好的主机名)

用户:你的用户名,这台电脑上的帐号(不是appleID)

密码:你的密码,这台电脑的锁屏密码

2.翻开系统设备--》通用--》同享--》翻开远程登录

这里的主机名需要填在快速指令的主机名里(可以点窜成你喜好的名字)



点击远程登录开关的问号进入具体设备



设备答应和增加用户(没有点+号)




3.隐私与平安-帮助功用里,确保最下面的sshd是翻开的




10.给电脑增加速捷键



高端人脉微信群

高端人脉微信群

人脉=钱脉,我们相信天下没有聚不拢的人脉,扫码进群找到你所需的人脉,对接你所需的资源。

商业合作微信

商业合作微信

本站创始人微信,13年互联网营销经验,擅长引流裂变、商业模式、私域流量,高端人脉资源丰富。

精彩点评
  • luly靓 2023-1-24 20:42
    大佬。 我这里到不了选一个那个截图。 是我还需要设置什么值让我去选择吗?
  • 阿豆学长长ov 2023-1-24 20:42
    发布了
  • 无人岛屿颈 2023-1-24 20:41
    [飙泪笑]更新了再改呗,反正代码逻辑大差不差,我会第一时间改的
  • 知足常乐77 2023-1-24 20:40
    我有猜想过是布局的因素,还擅自修改过里面“第几”的参数,但是没能成。这次Mac OS13又能使一阵子了,之前大版本系统更新每次也都是得调整代码,不知道这次又能用多久[捂脸][捂脸]
  • 明绍宗朱聿键鼻 2023-1-24 20:39
    各位,非常感謝這位版主提供的腳本!非常詳細並且確實能成功!!感謝版主的大恩大德~好人必有好報的[爱][爱][爱]
  • 哈哈SE7 2023-1-24 20:39
    谢谢大佬[赞同]

查看全部评论>>

相关推荐

有哪些超神的油猴脚本?

有哪些超神的油猴脚本?

小编在之前就介绍过很多油猴里的神器插件,这里给大家总结几款经典中的经典。01Usersc

一篇教会你写90%的shell脚本

一篇教会你写90%的shell脚本

shell是外壳的意思,就是操作系统的外壳。我们可以通过shell命令来操作和控制操作系统

脚本怎么写?250+个万能脚本,可直接套用!

脚本怎么写?250+个万能脚本,可直接套用!

作者:厚昌学院特聘讲师,厚昌学院顾问团队核心成员,从事互联网行业从事互联网行业8

浏览器辅助神器:油猴脚本使用教程

浏览器辅助神器:油猴脚本使用教程

前言「油猴脚本」是一段脚本代码,通过它可以让浏览器实现各种各样的扩展功能,和浏览

这100个shell脚本案例,你都知道吗?一篇教会你写90%的 ...

这100个shell脚本案例,你都知道吗?一篇教会你写90%的 ...

shell 是一个应用程序,它连接了用户和 Linux 内核,让用户能够更加高效、安全、低成

最新一波油猴脚本推荐:有了它们,你的浏览器就无敌了

最新一波油猴脚本推荐:有了它们,你的浏览器就无敌了

关注扩展迷、喜欢折腾电脑的小伙伴们,应该都对各种各样的浏览器插件不陌生了。浏览器

最强浏览器插件:油猴脚本的安装及使用教程

最强浏览器插件:油猴脚本的安装及使用教程

Tampermonkey 是一款免费的浏览器扩展和最为流行的用户脚本管理器,它适用于 Chrome,

油猴脚本管理器的超详细下载安装使用教程——新手必看

油猴脚本管理器的超详细下载安装使用教程——新手必看

油猴脚本管理器的超详细下载安装使用教程——新手必看油猴可以帮你干什么:全网VIP视

iPad随航脚本(Mac13.0Ventura)

iPad随航脚本(Mac13.0Ventura)

参考文章和视频:将iPad作为Mac Mini主屏幕的实现方法视频:无屏自动启动随航 iPad作为M

模板很齐全,视频脚本怎么写?50个短视频脚本文案模板 ...

模板很齐全,视频脚本怎么写?50个短视频脚本文案模板 ...

在运营短视频时,你有没有遇到过这样的问题:1、拍了一半发现拍摄场景不行;2、拍摄过

一个油猴脚本,让你体验真正的百度网盘下载不限速!

一个油猴脚本,让你体验真正的百度网盘下载不限速!

我们先看一下这个脚本的下载效果。我是100M的宽带,这直接能飙到20MB/s,所以下载速度

视频拍摄脚本怎么写?完整视频拍摄脚本范文实例分享

视频拍摄脚本怎么写?完整视频拍摄脚本范文实例分享

写脚本?对于没有视频背景的朋友来说可能就会有疑问,脚本是什么?不应该是电影,电视

「小白教程」让浏览器为所欲为!油猴脚本简介与使用心得

「小白教程」让浏览器为所欲为!油猴脚本简介与使用心得

本内容来源于@什么值得买APP,观点仅代表作者本人 |作者:Stark-C大家好,我是Stark-

Tampermonkey油猴插件——安装与使用教程

Tampermonkey油猴插件——安装与使用教程

​初次见面,大家好。相信熟悉浏览器的都知道,尤其是大名鼎鼎的Chrome浏览器,丰富的

这是我见过最牛的shell脚本100例,学习提升面试必备,建议收藏

这是我见过最牛的shell脚本100例,学习提升面试必备,建议收藏

从历史上看,shell一直是类Unix系统的原生命令行解释器。多年来,它已被证明是Unix的

网售几元钱的网红脚本,真是顶流主播的走红秘籍?

网售几元钱的网红脚本,真是顶流主播的走红秘籍?

有人说,网红行业的现状是江山代有才人出,各领风骚“好几天”。的确,即便是行业顶流

115最新转存脚本(可转存和提取SHA1版本)

115最新转存脚本(可转存和提取SHA1版本)

最近115调整了接口,导致115转存助手ui优化版3.8.1版本无法转存或获取SHA1。有大神在

视频脚本创作不完全指南

视频脚本创作不完全指南

根据第49次《中国互联网络发展状况统计报告》数据,截至2022年12月,我国网络视频(含

一文详解Shell脚本编程,从基础到进阶,通俗易懂一目了然

一文详解Shell脚本编程,从基础到进阶,通俗易懂一目了然

Shell脚本编程难,难于上青天!这话不假,尤其很多程序员新人,学了几个月Shell脚本写

好的短视频从脚本制作开始,学会这3招,还怕做不出好脚本?

好的短视频从脚本制作开始,学会这3招,还怕做不出好脚本?

在上期我们做了个形象的比喻,把短视频制作比喻成我们造房子,前面我们已经带领大家打

商业洽谈 文章投递 寻求报道
电话咨询: 15924191378
关注微信