在 Applescript 中两次触发处理程序导致错误 [英] Trigger Handler twice in Applescript results in error

查看:22
本文介绍了在 Applescript 中两次触发处理程序导致错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我到目前为止编写了这段代码,它运行得很好,唯一的问题是,两次调用代码导致错误脚本"无法理解 Remi 消息.(-1708)

so i written this code so far, it works very well, the only issue is, calling the code twice results with an error «script» doesn’t understand the Remi message. (-1708)

这里有什么要指出的,我如何在触发后取消设置处理程序?

Whats to point here and how can i unset the handler after it was triggered?

代码:

my Remi()

on Remi()
    set cD to (current date)

    tell application "Reminders"
        --set output to name of reminders
        if (count of (reminders whose completed is false)) > 0 then
            set output to ""
            set todoList to name of reminders whose completed is false
            repeat with itemNum from 1 to ((count of (reminders whose completed is false)))
                try
                    set Remi to item itemNum of reminders
                    set remiT to due date of Remi
                    set tim to time string of remiT
                    set dD to date string of remiT
                    set nN to name of Remi
                    if remiT ≤ cD then
                        set val to (tim & " - " & nN & " $$" & dD & "/ENDE")
                        set output to (output & val & return)
                    end if
                end try
            end repeat
        else
            set output to "No reminders available"
        end if
    end tell
    return output
end Remi

感谢帮助

推荐答案

我知道是什么导致了问题.您在Remi()"处理程序中有一个变量Remi".我想你不能那样做!因此,要么更改变量的名称,要么更改处理程序的名称,您应该没问题.

I see what is causing the problem. You have a variable "Remi" inside the "Remi()" handler. I guess you can't do that! So either change the name of the variable or the name of the handler and you should be good.

这篇关于在 Applescript 中两次触发处理程序导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆