标签: applescript

Applescript中的tell块中的处理程序调用错误

为什么不在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)

applescript

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

如何在Python脚本中运行AppleScript?

如何在Python脚本中运行AppleScript?

问题说明了一切..(显然在Mac上)

python macos applescript

6
推荐指数
2
解决办法
4869
查看次数

Applescript子程序有问题

我是一个相当特殊的applecripter,并且已经写了很长时间的脚本.我目前正在创建的应用程序涉及使用"数据库事件"应用程序.我试图通过使用子程序设置字段的值.显然,我"不能继续set_duration",我不知道会出现什么问题.目前的源代码如下.

property first_run : true
on run
if first_run then
display dialog "THIS APPLICATION IS DESIGNED TO CLEAN UP THE FOLDER CONTAINING IT." & return & return & "After a certain number of days that you set, every item in that folder that has not been used for that duration will automatically be moved to a folder named \"Unused Items\"." with icon 1 buttons {"Cancel", "OK"} default button 2
set first_run to false
end if
tell application "Database Events"
set …
Run Code Online (Sandbox Code Playgroud)

applescript subroutine

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

AppleScript:在tell语句中调用处理程序

每次运行此脚本时都会出现此错误:系统事件出错:"Test123"无法理解通知消息.

码:

--more code...
tell application "System Events"
    if some_system_events_property then
         my notify of "Test123" thru "Test"
    end if
end tell
--more code...
to notify of message thru level
    display dialog message with titel level
end notify
Run Code Online (Sandbox Code Playgroud)

我试图替换

my notify of "Test123" thru "Test"
Run Code Online (Sandbox Code Playgroud)

以下,没有任何成功:

notify of "Test123" thru "Test" of me
(notify of "Test123" thru "Test") of me
Run Code Online (Sandbox Code Playgroud)

applescript handler tell

6
推荐指数
2
解决办法
4383
查看次数

如何通过AppleScript设置当前Mail.app外发邮件的发件人?

我想写一个AppleScript来设置Apple的Mail.app中当前外发邮件的发件人.

我试过这个:

tell application "Mail" to set sender of front outgoing message to "<my email address>"
Run Code Online (Sandbox Code Playgroud)

但我得到的错误信息error "Mail got an error: Can’t set sender of item to any." number -10006 from sender of item to any对我来说没有意义.

当我尝试询问前面的外发消息时如下:

tell application "Mail" to get properties of front outgoing message
Run Code Online (Sandbox Code Playgroud)

我得到{class:item}了回报,而不是像我期望的那样的"传出消息"对象.

有任何想法吗?

macos applescript apple-mail

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

如何使用AppleScript获取和解析XML文件?

某些远程服务器上有一个XML文件(http://foo/bar.xml):

<?xml version="1.0" encoding="UTF-8"?> 
<foo> 
  bar
</foo>
Run Code Online (Sandbox Code Playgroud)

如何使用AppleScript获取值"bar"?

applescript

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

Applescript可以发送获取或发布请求吗?

我使用Hazel在我的Mac上组织下载的文件.我看到每次触发规则时我都可以让它运行applescripts.

我想知道是否有可能让它发送如下:

http://my.server.com?type=Show&name=Big+Bang+Theory

然后我可以创建一个记录所有下载的小页面.

php macos applescript get

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

Applescript将应用程序放在特定桌面上

我有一个在Automator中创建的AppleScript,它打开了许多应用程序和文件夹,我将其用作创建相册的工作流程的一部分.我的流程的工作方式是桌面1中的Photoshop Elements,桌面2上的四个Finder窗口,桌面3上的iPhoto和桌面4上的Booksmart.

正如我所知,我的AppleScript打开了每一个,唯一的问题是它打开了我当时在桌面上的所有内容.然后我必须进入任务控制并在我的窗户周围移动,将每个应用程序放到我希望它上面的桌面上.只需在必要的桌面上逐个打开应用程序即可.

我已经尝试将桌面分配给应用程序,但这似乎并不一致.

我可以使用任何可以在特定桌面上打开应用程序的AppleScript吗?

我正在运行OS X 10.8.2.

非常感谢

desktop applescript osx-mountain-lion

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

列出所有应用程序的所有窗口

我正在尝试编写一个可以调整所有打开窗口大小的applescript脚本.为了确保我到达所有窗口,我正在让我的脚本说出应用程序的名称以及该应用程序的打开窗口数.
有趣的是,当我听到所有打开的应用程序的名称时,我的脚本说他们都打开了0个窗口.我该如何解决这个问题?

这是我的代码:

tell application "System Events"
    repeat with theProcess in (every process)
        if background only of theProcess is false then
            if name of theProcess is not "Finder" then
                if name of theProcess is "Google Chrome" then
                    say "Chrome woo hoo"
                    say (count windows as string)
                else
                    say name of theProcess as string
                    say (count windows as string)
                    tell theProcess
                        repeat with theWindow in windows
                            say "found a window of"
                            say (name of theProcess) as string
                            tell theWindow
                                click button …
Run Code Online (Sandbox Code Playgroud)

macos applescript window

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

从GIF中提取帧

我正在尝试使用Applescript或终端(或使用do shell脚本命令通过applescript终端)自动从选定的.gif文件中提取帧.我知道如何使用Preview.app进行单击和拖动方法,但有没有办法自动执行此操作?

谢谢!埃里克

macos applescript extract gif frame

6
推荐指数
3
解决办法
3912
查看次数