Applescript / Excel我想失去小数的答案

我正在编写一个applescript来处理XML的电子表格,而且几乎已经完成了,但是我发现只要它从一个单元格中检索到这个值,并且这个值是一个数字,就会用十进制格式化它。

4变成4.0

我怎样才能强制它只获得整个号码? 数字不是唯一的价值。

以下是相关的代码:

-- Copy field from SS tell application "Microsoft Excel" activate goto reference cellNum set GotValue to value of active cell as string delay 0.3 --tell application "System Events" to keystroke "c" using command down delay 2 end tell 

而且我知道我可以通过一个限定和保留小数点前的第一部分的函数来处理它,但正如我所说的,比数字更多的东西通过这个,段落也可以。 所以这不会很好。

对于任何人来说,这是通过一个函数来检查,如果input是一个真正的,如果是,将其转换为一个整数,然后一个string解决。 喜欢这个:

 on isReal(x) return ({class of x} is in {real}) end isReal if isReal(GotValue) then set GotValue to GotValue as integer end if set GotValue to GotValue as string 
Interesting Posts