AppleScript to JavaScript

Hi,


Just to test, I'm want to code a simple function in JavaScript to get the artist name of a track in iTunes.


In AppleScript, the script is :

on run {input, parameters}

  set t to input
  tell application "iTunes"
  set artist_name to artist of (item 1 of t)
  end tell
  return artist_name

end run


But in JavaScript, I don't know how to tell iTunes to do something so I tried this :

function run(input, parameters) {
  var t = input;
  var artist_name = t.artist;
  return artist_name;
}

Nothing is returned.


Can you help me ?


Thx.

Posted on May 8, 2015 10:21 AM

Reply
3 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

AppleScript to JavaScript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.