Basic AppleScript help

Discussion in 'macOS' started by jamesvdm, Dec 20, 2011.

  1. jamesvdm macrumors regular

    jamesvdm

    Joined:
    Mar 28, 2011
    Location:
    Perth, Australia
    #1
    I have two scripts to watch folders for files and open in a particular application.

    Script 1 will grab files even if they're in a folder, but Script 2 won't!

    Script 1

    on adding folder items to thisFolder after receiving addedItems

    repeat with movieFile in addedItems
    tell application "iFlicks"
    import movieFile with gui
    end tell
    end repeat

    end adding folder items to


    Script 2

    on adding folder items to thisFolder after receiving addedItems

    repeat with movieFile in addedItems
    if name of (info for movieFile) ends with ".mkv" then
    tell application "iFlicks"
    import movieFile as QuickTime movie without gui
    end tell
    else if name of (info for movieFile) ends with ".avi" then
    tell application "iFlicks"
    import movieFile as Apple TV 2 video without gui
    end tell
    end if
    end repeat

    end adding folder items to


    Can someone please point out what I'm doing wrong? Thanks!
     
  2. jamesvdm thread starter macrumors regular

    jamesvdm

    Joined:
    Mar 28, 2011
    Location:
    Perth, Australia
    #2
    Derp, I had the problem wrong, not the script. The first script would pass the folder to iFlicks, which could then grab the video file. The second script won't pass the folder because it's looking for an extension.
     
  3. r0k macrumors 68040

    r0k

    Joined:
    Mar 3, 2008
    Location:
    Detroit
    #3
    Glad you found the problem!
     

Share This Page