标签: osascript

为什么这个简单的 AppleScript 不起作用?

我有一个 Shell 脚本,我需要在 MacOSX 10.6.X 上创建别名文件夹,所以我调用 osascript 使用以下代码来完成:

Source="/Volumes/Test Project/Folder/SubFolder"
Destination="/Volumes/Test Project/Dest/"

/usr/bin/osascript -e 'tell application "Finder" to make alias file to POSIX file "$Source" at POSIX file "$Destination"'
Run Code Online (Sandbox Code Playgroud)

此代码返回:

29:103:执行错误:Finder 出错:AppleEvent 处理程序失败。(-10000)

有没有人有办法解决吗?

macos bash shell alias osascript

2
推荐指数
1
解决办法
3000
查看次数

bash中$ {1-1}是什么意思?

我正在从这里阅读脚本并试图了解正在发生的事情.此函数执行更改Finder窗口的目录:

function ee { 
 osascript -e 'set cwd to do shell script "pwd"'\
 -e 'tell application "Finder"'\
 -e "if (${1-1} <= (count Finder windows)) then"\
 -e "set the target of window ${1-1} to (POSIX file cwd) as string"\
 -e 'else' -e "open (POSIX file cwd) as string"\
 -e 'end if' -e 'end tell';\
};\
Run Code Online (Sandbox Code Playgroud)

我假设$由bash解释,因为它在双引号内.我一直无法找到可能{1-1}意味着什么.我在单独的测试脚本中使用了表达式但是找不到与plain的区别$1.有任何想法吗?

bash osascript

1
推荐指数
1
解决办法
1443
查看次数

等到某个应用程序退出,然后再启动另一个应用程序

在 OS XI 上,想要执行 osascript 命令,该命令会等待由其完整 .app 路径指定的某个应用程序退出,然后启动另一个应用程序,例如使用/usr/bin/open -n /Applications/MyApp.app.

如何实现等待直到应用程序退出?

macos osascript

1
推荐指数
1
解决办法
2059
查看次数

发送 iMessage 到群聊

如何将 iMessage 发送到群聊?我到处搜索,但找不到任何东西。我想把它发送到一个名为某物的群聊中,可能如果我在聊天中得到一个好友列表,我可以一次发送给每个人吗?问题可能是我也在聊天中,所以这可能是一个问题。

applescript osascript imessage

0
推荐指数
1
解决办法
1783
查看次数

标签 统计

osascript ×4

bash ×2

macos ×2

alias ×1

applescript ×1

imessage ×1

shell ×1