Apple Script List

Discussion in 'Mac Programming' started by element432, May 6, 2014.

  1. element432 macrumors newbie

    Joined:
    May 6, 2014
    #1
    Hey, I havent used applescript in a few year and I had a small program I am trying to recreate. It basically made a list of several files, that were movies, from a folder on my desktop. It open with a list of the files that were in the folder and you would pick on then it would open it. Im basically have all sorts of issues of where to even start with this now. Any help would be appreciated. The movie format is .mkv. Thanks!
     
  2. snorkelman macrumors 6502a

    snorkelman

    Joined:
    Oct 25, 2010
    #2
    Code:
    
    set theExtension to "mkv"
    set theFolder to "Macintosh SSD:Users:stevenc:Desktop:my mkvs:" as alias
    set theApp to "VLC"
    
    tell application "Finder"
    	set file_list to name of every file of theFolder whose name extension is theExtension
    end tell
    
    set theFile to item 1 of (choose from list file_list)
    
    tell application theApp to open ((theFolder as string) & theFile)
    Im sure theres better ways, but above should do what you asked for

    just alter theFolder to reflect path to your particular directory
    and alter theApp to whatever mkv player you're using
     
  3. element432 thread starter macrumors newbie

    Joined:
    May 6, 2014
    #3
    Thanks for your help! Thats basically what I was looking for. It worked great.
     
  4. snorkelman macrumors 6502a

    snorkelman

    Joined:
    Oct 25, 2010
    #4
    you're welcome :)
     

Share This Page