private static String [ ] createOSAScriptCommand ( final File file ) { final String path = file . getAbsolutePath ( ) ; final String playlist = "LittleShoot" ; final String [ ] command = new String [ ] { "osascript" , "-e" , "tell application \"Finder\"" , "-e" , "set hfsFile to (POSIX file \"" + path + "\")" , "-e" , "set thePlaylist to \"" + playlist + "\"" , "-e" , "tell application \"iTunes\"" , // "-e", "activate", // launch and bring to front "-e" , "launch" , // launch in background "-e" , "if not (exists playlist thePlaylist) then" , "-e" , "set thisPlaylist to make new playlist" , "-e" , "set name of thisPlaylist to thePlaylist" , "-e" , "end if" , "-e" , "add hfsFile to playlist thePlaylist" , "-e" , "end tell" , "-e" , "end tell" } ; return command ; }
Constructs and returns a osascript command .