Applescript Play Quicktime

Discussion in 'Mac Programming' started by gumby777, Oct 20, 2007.

  1. gumby777 macrumors newbie

    Joined:
    Sep 22, 2007
    #1
    Hello. I was wondering if I could have some help with the script that I am building. So far I have all of the code but when I run it and click on a button that should play the movie it doesn't. Could someone help me make quicktime play the specific file and if possible be able to move the location of the file around (so that this will work on multiple computers) thanks for the help and if you want I can send you these movie clips so that this will work for you too!!

    set theOptionsM to {"MP - Bridge of Death", "MP - Black Knight).mp4", "MP - Killer Rabbit.mp4", "MP - Knights who say ni.mp4", "MP - Lego.temp.mp4", "MP - Witch.temp.mp4"}
    set theOptionsH to {"HG - Babel Fish.temp.mp4", "HG - Dolphin Song.temp.mp4", "HG - no thinking.temp.mp4", "HG - The Ultimate Question.temp.mp4"}
    display dialog "Which Movie do you prefer?" buttons ["Montey Python", "Hitchhickers Guide to the Galaxy"]
    if button returned of result is "Montey Python" then
    tell application "QuickTime Player"
    open some item of theOptionsM
    display dialog "" buttons ["Quit", "More Montey Python", "Hitchhickers Guide"]
    if button returned of result is "Quit" then
    ignoring application responses
    tell application "QuickTime Player"
    quit
    end tell
    end ignoring
    else if button returned of result is "More Montey Python" then
    tell application "QuickTime Player"
    open some item of theOptionsM
    end tell
    else if button returned of result is "Hitchhickers Guide" then
    tell application "QuickTime Player"
    open some item of theOptionsH
    end tell
    end if
    end tell
    else if button returned of result is "Hitchhickers Guide to the Galaxy" then
    tell application "QuickTime Player"
    open some item of theOptionsH
    display dialog "" buttons {"Quit", "More Hitchhickers Guide", "Montey Python"}
    end tell
    end if






    I have now made the code changing play to open though then I get the error "QuickTIme Player got an error" the movie could not be opened so what do I need to change so that it will open??
     
  2. hhas macrumors regular

    Joined:
    Oct 15, 2007
    #2
    Only if you promise to spell "Monty Python" and "Hitchhiker's Guide" correctly in future, as my brain hurts otherwise.

    If this is a Script Editor applet (as opposed to a Studio application) and it's running on 10.4 or later, save it as an application bundle and put the movie files in the application bundle's 'Resources' folder. You can then use Standard Additions' 'path to resource' command to locate it:

    Code:
    set fileAlias to path to resource theFileName
    tell application "QuickTime Player"
    	open fileAlias
    	play document 1
    end tell
    HTH
     
  3. gumby777 thread starter macrumors newbie

    Joined:
    Sep 22, 2007
    #3
    Reply

    Sorry about all the bad spelling but I downloaded the files and thats how they were named so instead I just kept the names!
     
  4. hhas macrumors regular

    Joined:
    Oct 15, 2007
    #4
    MP3 files? You were lucky!
     

Share This Page