gpt4 book ai didi

objective-c - 可以对接第三方程序吗?

转载 作者:行者123 更新时间:2023-12-03 17:22:24 33 4
gpt4 key购买 nike

我有一个应用程序,它通过 AppleScript 从另一个程序员的应用程序获取信息,并使用它通过串行端口转动电机。

我希望我的应用程序在其他应用程序可见时也可见(在顶部)。停靠? child ?这可能吗?我来自 Win 背景,但仍然是 Mac 新手,所以我不确定我问的问题是否正确......

我无权访问其他程序的源代码。作者可能愿意通过脚本提供一些东西。

最佳答案

您可以创建launch agent使用 KeepAlive + OtherJobEnabled 键。

OtherJobEnabled Each key in this dictionary is the label of another job. If the value of the key is true, then this job is kept alive as long as that other job is enabled. Otherwise, if the value is false, then this job is kept alive as long as the other job is disabled.

创建 launchctl plist 并将该 plist 放入 /Library/LaunchAgents 目录或 ~/Library/LaunchAgents 目录(仅为该用户调用)。

列表:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>appName</string>
<key>KeepAlive</key>
<dict>
<key>OtherJobEnabled</key>
<dict>
<key> labelof_another_job</key>
<true/>
</dict>
</dict>
<key>ProgramArguments</key>
<array>
<string>yourApp.app/Contents/MacOS/yourApp</string>
</array>
</dict>
</plist>

现在打开终端并运行

launchctl load pathToplistFile // use sudo if file is in /Library/LaunchAgents

关于objective-c - 可以对接第三方程序吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19428541/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com