这是一个常见的问题,通常会在使用 AppleScript 时出现。可能会出现以下错误消息:
“Error in Current Tab and Argument String”“Address Book: Current Tab: “Contacts” invalid argument: missing value (readability error -1728)”
使问题解决的最有效的方法是在语法中使用标准的符号和语法结构。尤其是,参数字符串需要具有预期的格式。以下是一个示例 AppleScript,其中包含一个正确的参数字符串格式化程序,它可以帮助您避免这个问题:
set theCurrentTab to missing value
set theArgumentString to ""
try
set theCurrentTab to current tab of application "Address Book"
set theArgumentString to "Hello, World!"
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1 with title "Error!" with icon caution
end try
if theCurrentTab is not missing value then
-- continue with script
else
display dialog "Error: Current Tab is missing." buttons {"OK"} default button 1 with title "Error!" with icon caution
end if
以上是一个简单的示例用于解决该问题的 AppleScript 代码。我们可以通过这种方式来避免“Current Tab and Argument String”错误。