如何在 applescript 中显示波斯数字?

How to show the Persian numbers in applescript?

实际上我有一个简单的代码,它以英文显示页码,无论如何可以用波斯语或阿拉伯语数字显示它们吗?

我的 applescript 是:

    tell application "myApp"
    if (count documents) > 0 then
        set pageCount to count (pages of document 1)
        repeat with pageNumber from 1 to pageCount
            set thePage to page pageNumber of document 1
            make new text imprint at end of imprints of thePage with properties {rich text:pageNumber as rich text, x position:36, y position:36, height:16, width:30}
        end repeat
        return pageCount
    end if
end tell

输出是这样的:

1,2,3,4,5

我想成为这样的人:

۱,۲,۳,۴,۵ 

您将页码设置为字符串,因此您可以编写一个例程,以 integer

的字符串格式显示波斯数字
    tell application "myApp"
    if (count documents) > 0 then
        set pageCount to count (pages of document 1)
        repeat with pageNumber from 1 to pageCount
            set thePage to page pageNumber of document 1
            make new text imprint at end of imprints of thePage with properties {rich text:my intToPersianString(pageNumber), x position:36, y position:36, height:16, width:30}
        end repeat
        return pageCount
    end if
end tell


on intToPersianString(intValue)
    set persianSymbols to "۰۱۲۳۴۵۶۷۸۹"
    set output to {}
    repeat with i in characters of (intValue as string)
        set end of output to character ((i as integer) + 1) of persianSymbols
    end repeat
    return output as string
end intToPersianString