为什么不在tell块中调用处理程序?错误是-1708
on stub() -- method is not called in tell block
end stub
tell application "Finder"
stub()
end tell
Run Code Online (Sandbox Code Playgroud) 如何在Python脚本中运行AppleScript?
问题说明了一切..(显然在Mac上)
我使用Hazel在我的Mac上组织下载的文件.我看到每次触发规则时我都可以让它运行applescripts.
我想知道是否有可能让它发送如下:
http://my.server.com?type=Show&name=Big+Bang+Theory
然后我可以创建一个记录所有下载的小页面.
有谁知道该文件InfoPlist.strings是为了什么?它在Xcode 3.2中.它是Applescript中的Cocoa应用程序.
这可能是一个全新的问题,但在这里.我正在制作一个纯AppleScript应用程序.它激活另一个应用程序,然后键入.问题是,当它激活应用程序时,它不会将应用程序窗口置于最前面.我试着告诉应用激活:
tell application "app_name.app"
activate
tell application "System Events" to keystroke "test"
end tell
Run Code Online (Sandbox Code Playgroud)
有帮助吗?谢谢!
我正在尝试使用以下命令创建AppleScript.我遇到的问题是第三行有错误.我lame直接在终端中使用该命令没有问题.此外,lame它不是原生Mac实用程序; 我自己安装了它.有人有解决方案吗?
do shell script "cd ~/Downloads"
do shell script "say -f ~/Downloads/RE.txt -o ~/Downloads/recording.aiff"
do shell script "lame -m m ~/Downloads/recording.aiff ~/Downloads/recording.mp3"
-- error "sh: lame: command not found" number 127
do shell script "rm recording.aiff RE.txt"
Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个Applescript,它将在不知道硬盘驱动器或用户名的情况下在用户的计算机上打开文件,假设该文件位于用户目录中的相同位置.
tell application "Finder" to open "/Users/jim/Dropbox/Getting Started.pdf" as POSIX file
Run Code Online (Sandbox Code Playgroud)
效果很好,而
tell application "Finder" to open "~/Dropbox/Getting Started.pdf" as POSIX file
Run Code Online (Sandbox Code Playgroud)
失败.
有没有办法简单地完成这个?
我正在尝试使用Applescript或终端(或使用do shell脚本命令通过applescript终端)自动从选定的.gif文件中提取帧.我知道如何使用Preview.app进行单击和拖动方法,但有没有办法自动执行此操作?
谢谢!埃里克
在Yosemite更新之前,我使用这个 Applescript来控制我的Spotify.
当我跑步时,一切都充满了魅力/usr/bin/osascript /Users/jdrummond/SpotifyControl.scpt play/pause.
现在我已经将我的OSX更新为Yosemite,当我运行相同的命令时,我会继续这样做:
/Users/jdrummond/SpotifyControl2.scpt:1217:1222: script error: Expected end of line, etc. but found identifier. (-2741)
Run Code Online (Sandbox Code Playgroud)
所以我尝试创建一个简单的Applescript来与Spotify交互:
using terms from application "Spotify"
tell application "Spotify" to play
end using terms from
Run Code Online (Sandbox Code Playgroud)
但我也得到一个错误:

我做错了什么以及如何与优胜美地的Spotify互动?有什么改变?
我在macOS上.我有一个脚本,在使用read终端请求确认后,用于grep检查是否已挂载/ dev/disk1,然后格式化该磁盘.这是一个危险的脚本,因此,为什么先询问它是否合适是至关重要的.
最后,我想让这个脚本成为用户可以双击的可执行文件.但是,不是让用户键入"y"并返回到终端窗口,我宁愿显示"是"和"否"按钮的显示对话框,让他们选择,然后根据他们的答案运行脚本.在bash中这可能吗?
我在一个我没有管理访问权限的环境中工作,所以虽然我可以编写AppleScript服务来完成我想要做的事情并将其优雅地集成到用户界面中,但我无法将该服务集成到没有管理员密码的环境(因为没有它,我无法为用户编辑〜/ Library/Services).此外,我无法下载或安装任何新的库,应用程序 - 任何,真的 - 在环境中; 我必须只在Mac OS X中使用原生bash.
这是我有的:
read -p "Are you sure you want to partition this disk? " -n 1 -r # Can I make this be a dialog box instead?
echo
if [[ $REPLY =~ ^[Yy]$ ]] # Can this accept the result as a condition?
then
if grep -q 'disk1' /dev/ && grep -q 'file.bin' ~/Downloads; then
echo # redacted actual code
else
osascript -e 'tell app …Run Code Online (Sandbox Code Playgroud)