Search code examples
applescriptapplescript-objc

How to get the value of a slider in ApplescriptObjC?


property slider : missing value if slider's integerValue = 5 then -- Do something end if

This code won't work. Any ideas why?


Solution

  • log class of slider's integerValue returns something called __NSCFNumber

    log class of 5 returns <NSAppleEventDescriptor: 'long'>

    Looks like Applescript does not automatically convert the values for you. To get it working a (strange looking) conversion will do it:

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

    Greetings, Michael / Hamburg