When I run the following script, the value returned is of type ‘utxt’. That
type is not one of the “native” types defined in osx/ae_constants.rb.
Therefore, when I call to_rbobj on the returned object the object is not
turned into a string.
The type ‘utxt’ seems to be returned by iTunes for all text fields, not
just the track name.
Am I doing something wrong? Is ‘utxt’ a new data type that should be added
to this list?
================================================================
require ‘osx/aeosa’
SCRIPT = <<SCRIPT
set track_name to ""
tell application "iTunes"
tell source "Library"
tell playlist "Library"
copy name of the first track to track_name
end tell
end tell
end tell
song
SCRIPT
ret = OSX.do_osascript(SCRIPT)
p ret # => #<AEDesc:0x55a1c type=‘utxt’>
p ret.to_rbobj # => #<AEDesc:0x55a1c type=‘utxt’>
p ret.to_s # => “All Around The World”
================================================================
Jim
···
–
Jim Menard, jimm@io.com, http://www.io.com/~jimm/
“It’s overkill, of course. But you can never have too much overkill.”
– Anonymous Coward on slashdot.org