且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我如何检查是否文本可以转换为AppleScript的一个数字?

更新时间:2023-11-08 14:15:10

你已经读过有错误的工作的AppleScript的指南?

Did you already read working with errors in the Applescript guide?

样code:

set CB to the clipboard
try
    set bugNum to CB as number
on error errStr number errNum
    set bugNum to -1
end try
display dialog "Number from the clipboard: " & bugNum

我跳过了code中的第一次全面,因为我想通了导游是pretty清晰,远远超过任何我可以在这里写更多有用:)

I skipped the code the first time round since I figured the guide was pretty clear, and far more useful than anything I could write here :)