实际上我有一个简单的代码,它用英语显示页码,无论如何用波斯语或阿拉伯语数字显示它们?
我的苹果是: 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
我希望如此:
۱,۲,۳,۴,۵
答案 0 :(得分:2)
您将页码设置为字符串,因此您可以编写一个例程,以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