2014-11-03 74 views
0

property slider : missing value if slider's integerValue = 5 then -- Do something end if如何獲取ApplescriptObjC中滑塊的值?

此代碼不起作用。任何想法爲什麼?

+1

integerValue()返回一個可可類。如果你打算在Applescript中進一步使用它們,你總是希望顯式強制數字到一個Applescript類中,當你得到這個值的時候添加一個「整數」。 – jweaks 2014-11-03 16:31:25

回答

1

log class of slider's integerValue返回一些所謂__NSCFNumber

log class of 5回報<NSAppleEventDescriptor: 'long'>

看起來AppleScript的不會自動轉換值你。爲了得到它的工作一(奇怪的看着)轉換將做到這一點:

if slider's integerValue as integer = 5 then 
    -- Do something 
end if 

問候,邁克爾/漢堡

+0

這很奇怪... – James 2014-11-04 03:29:09