applescript AI and iTunes

Posted:
in Genius Bar edited January 2014
I'd like to write a script (program, whatever works) that I could put in the pull-down menu of iTunes that would automatically post the information of the current song <a href="http://forums.appleinsider.com/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=6&t=001778"; target="_blank">here</a>



any help as to where i should start?

Comments

  • Reply 1 of 20
    ibrowseibrowse Posts: 1,749member
    It sounds like you're going through way too much trouble
  • Reply 2 of 20
    paulpaul Posts: 5,278member
    hahahah im a lazy bastard and i want to learn how to use applescript... it shouldn't be too hard.. right?
  • Reply 3 of 20
    baumanbauman Posts: 1,248member
    Some starting points:



    tell application "iTunes"

    \tset this_name to the name of current track

    \tset this_artist to the artist of current track

    \tset this_album to the album of current track

    end tell



    I believe that you would want to use Mozilla for the next step, and do something like



    tell application "Mozilla"

    \tOpenURL "http://forums.appleinsider.com/cgi-bin/ultimatebb.cgi?ubb=reply&f=6&t=001778";

    \tDo JavaScript "{var revisedMessage; var currentMessage = document.REPLIER.message.value;

    revisedMessage = currentMessage+asdf; document.REPLIER.message.value=revisedMessage;

    document.REPLIER.message.focus(); return;}"

    end tell



    But that doesn't seem to like the javascript . . . . and Javascript is not my area of expertise.



    You could also try the insertion point or selection commands, but I can't seem to get that to work.



    Hopefully, this will give you some idea of what needs to be done. It looked to me that mozilla had the most robust AppleScript environment just from the Dictionary, but I don't know. Good luck, you lazy bastard
  • Reply 4 of 20
    paulpaul Posts: 5,278member
    wow great start.. what about OW?

    and cant I just "record" doing it once and save the recodring and use that?
  • Reply 5 of 20
    paulpaul Posts: 5,278member
    OK, backup a step... wht the hell happened to the script menu in iTunes in OS X?!?!?!!?!?



    is there even apple script in osX?
  • Reply 6 of 20
    torifiletorifile Posts: 4,024member
    [quote]Originally posted by Paul:

    <strong>OK, backup a step... wht the hell happened to the script menu in iTunes in OS X?!?!?!!?!?



    is there even apple script in osX?</strong><hr></blockquote>



    Create a folder called scripts in ~/Library/iTunes/. That'll put a script menu up there. As for the rest... I'm eagerly awaiting an answer. It would be an AI spammers dream
  • Reply 7 of 20
    paulpaul Posts: 5,278member
    ok i am trying to use [code] [post data string] -- Form posting data </pre><hr></blockquote> that string from the netscape dictionary, but it doesnt seem to be working the way I want it to, in fact AS seems to think that "post" is a variable not a function/command



    [code] [post data this_name, this_artist, this_album] </pre><hr></blockquote> is what I have in the apple script and i get this error: {expected "," or "]" but got class name}

    and it stops on the 'data' string...



    am I making any sense to someone out there?



    here is everything I have so far: [code] tell application "iTunes"

    \tset this_name to the name of current track

    \tset this_artist to the artist of current track

    \tset this_album to the album of current track

    end tell

    tell application "Netscape"

    \tGetURL "http://forums.appleinsider.com/cgi-bin/ultimatebb.cgi?ubb=reply&f=6&t=001778";

    \t[post data this_name, this_artist, this_album]

    end tell </pre><hr></blockquote>
  • Reply 8 of 20
    defiantdefiant Posts: 4,876member
    what if u use "paste" instead of post ?
  • Reply 9 of 20
    defiantdefiant Posts: 4,876member
    [code] tell application "iTunes"

    \tset this_name to the name of current track

    \tset this_artist to the artist of current track

    \tset this_album to the album of current track

    end tell

    tell application "OmniWeb"

    \tGetURL "http://forums.appleinsider.com/cgi-bin/ultimatebb.cgi?ubb=reply&f=6&t=001778";

    \t[paste, this_name, this_artist, this_album]

    end tell

    </pre><hr></blockquote>
  • Reply 10 of 20
    paulpaul Posts: 5,278member
    it says the variable paste is not defined...



    i thought applescript was supposed to be easy...



    like a code language mixed with the English language.....
  • Reply 11 of 20
    baumanbauman Posts: 1,248member
    Try dropping the brackets on the post line. Also, does it know where to post it? Do you need to select the text box as an object and insert the text there?
  • Reply 12 of 20
    paulpaul Posts: 5,278member
    it seems that paste is not a command, and im trying to take this one step at a time.... once i get one thing working then i'll worry about the next thing.... so far im not too discouraged tho....
  • Reply 13 of 20
    defiantdefiant Posts: 4,876member
    yeah, I saw that paste didn't worked...



    but what you need to add is a function which presses the "post" button
  • Reply 14 of 20
    paulpaul Posts: 5,278member
    [quote]Originally posted by Defiant:

    <strong>yeah, I saw that paste didn't worked...



    but what you need to add is a function which presses the "post" button</strong><hr></blockquote>



    If i can find a way for AS to simulate the keyboard, with a series of tabs and return I should be able to press the button that way. If I cant, I dont mind pressing it myself @ least all of the typing will be done tho and it wont be as "spammer friendly" heh
  • Reply 15 of 20
    baumanbauman Posts: 1,248member
    If you are really serious . . . I mean $79 serious, you could get QuicKeys for OS X. With that, you have the capability to mix keystrokes and AppleScript, along with many other things. I think you could get it working with that, but it'll cost you 80 bucks.
  • Reply 16 of 20
    defiantdefiant Posts: 4,876member
    [quote]Originally posted by Paul:

    <strong>



    If i can find a way for AS to simulate the keyboard, with a series of tabs and return I should be able to press the button that way. If I cant, I dont mind pressing it myself @ least all of the typing will be done tho and it wont be as "spammer friendly" heh</strong><hr></blockquote>



    what if iTunes just pastes the text into the clipboard ? then you only would have to press apple-v in the browser, press "post" and there you go...



    what do u think ?
  • Reply 17 of 20
    paulpaul Posts: 5,278member
    [quote]Originally posted by Defiant:

    <strong>



    what if iTunes just pastes the text into the clipboard ? then you only would have to press apple-v in the browser, press "post" and there you go...



    what do u think ?</strong><hr></blockquote>



    If i can stay in OW and not have to go into iTunes, i'm down
  • Reply 18 of 20
    defiantdefiant Posts: 4,876member
    [quote]Originally posted by Paul:

    <strong>



    If i can stay in OW and not have to go into iTunes, i'm down</strong><hr></blockquote>



    down?
  • Reply 19 of 20
    paulpaul Posts: 5,278member
    [quote]Originally posted by Defiant:

    <strong>



    down?</strong><hr></blockquote>



    its slang, ie: im all for it, I'll do it... etc....
  • Reply 20 of 20
    defiantdefiant Posts: 4,876member
    [quote]Originally posted by Paul:

    <strong>



    its slang, ie: im all for it, I'll do it... etc....</strong><hr></blockquote>



    ah... <img src="graemlins/embarrassed.gif" border="0" alt="[Embarrassed]" /> and did u succeed yet ?
Sign In or Register to comment.