Peroidcly 运行宁 shell 脚本中的 osascript 到 运行 苹果脚本
Peroidcly running osascript in shell script to run apple script
我在做什么
我 运行 定期使用 shell 脚本来检查我的屏幕分辨率。基于此,它将 运行 两个苹果脚本之一,这基本上改变了另一个应用程序(极客工具)的可见性。
我的问题
苹果纸运行本身没问题。我知道 osascript 是调用苹果脚本的方式,因为如果我尝试直接 运行 它会说 "cannot execute binary file"。然而,当我使用 osascript $Home/path/smallscreen.scpt
时,它给了我一个新的错误:
osascript[61390:1405791] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found.
Did find: /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers.
也许我只是误会了什么,但我认为应该直接 运行 这个答案底部的脚本:
声称你可以 运行 你的苹果脚本是这样的
osascript /Users/USERNAME/Desktop/foo.scpt
Shell代码:
rez=$(xdpyinfo | grep dimensions | awk '{print }' | awk -Fx '{print , }')
echo $rez> $HOME/Documents/Geeklets/Displays_temp.txt
rezold=`grep -s . $HOME/Documents/Geeklets/Displays_temp.txt`
if [ "$rezold" != "$rez" ]; then
if [ "$rez" == "1280 777" ]; then
osascript /Users/coolguy/Documents/Geeklets/smallscreen.scpt
else
$HOME/Scripts/Geeklets/largescreen.scpt
fi
fi
我的 Apple 脚本:
tell application "GeekTool Helper"
set smallGroup to group "small"
set largeGroup to group "large"
set defultGroup to group "Default Group"
set visible of smallGroup to true
set visible of largeGroup to false
set visible of defultGroup to true
end tell
我 运行 在 Mac 10.10.3
上安装这个
这解决了我的问题。
https://helpx.adobe.com/photoshop/kb/unit-type-conversion-error-applescript.html
这似乎是 32 位与 64 位问题的某个方面。不是编码问题!希望这最终能帮助到其他人。
我在做什么
我 运行 定期使用 shell 脚本来检查我的屏幕分辨率。基于此,它将 运行 两个苹果脚本之一,这基本上改变了另一个应用程序(极客工具)的可见性。
我的问题
苹果纸运行本身没问题。我知道 osascript 是调用苹果脚本的方式,因为如果我尝试直接 运行 它会说 "cannot execute binary file"。然而,当我使用 osascript $Home/path/smallscreen.scpt
时,它给了我一个新的错误:
osascript[61390:1405791] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found.
Did find: /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers.
也许我只是误会了什么,但我认为应该直接 运行 这个答案底部的脚本:
声称你可以 运行 你的苹果脚本是这样的
osascript /Users/USERNAME/Desktop/foo.scpt
Shell代码:
rez=$(xdpyinfo | grep dimensions | awk '{print }' | awk -Fx '{print , }')
echo $rez> $HOME/Documents/Geeklets/Displays_temp.txt
rezold=`grep -s . $HOME/Documents/Geeklets/Displays_temp.txt`
if [ "$rezold" != "$rez" ]; then
if [ "$rez" == "1280 777" ]; then
osascript /Users/coolguy/Documents/Geeklets/smallscreen.scpt
else
$HOME/Scripts/Geeklets/largescreen.scpt
fi
fi
我的 Apple 脚本:
tell application "GeekTool Helper"
set smallGroup to group "small"
set largeGroup to group "large"
set defultGroup to group "Default Group"
set visible of smallGroup to true
set visible of largeGroup to false
set visible of defultGroup to true
end tell
我 运行 在 Mac 10.10.3
上安装这个这解决了我的问题。 https://helpx.adobe.com/photoshop/kb/unit-type-conversion-error-applescript.html
这似乎是 32 位与 64 位问题的某个方面。不是编码问题!希望这最终能帮助到其他人。