1

I wrote a droplet to hack a set of MS Word files. I have been using the Script Editor. In one incarnation I used the 'recursive file processing droplet' and in another I hacked a bit from a script I found online.

If I drop only .pdf files, it runs fine.

If I drop only .docx files, it runs fine.

If I drop a combination of file types, it doesn't work. Most of the time, the droplet icon starts bouncing in the Dock and never stops. However, other times it goes through some of the files and then exits.

Here's the interesting part: It issues the "starting" message dialog for each file type (name extension) it encounters. This suggests the 'drop' or 'open' is repeated for each filename extension.

Does anyone have any idea why this would be?

-- This droplet processes files dropped onto the applet 
on open these_items
    display dialog "starting"
    repeat with i from 1 to the count of these_items
        process_item(item i of these_items)
    end repeat
end open

on process_item(each_item)
    display dialog "Got an item: " & each_item
end process_item

I re-tested with the simplest possible script and was able to duplicate the failure.

I've put hours and hours into something that should be simple!

  • 2
    Please add the code... – klanomath Mar 29 '17 at 15:30
  • I can confirm that the minimal code does fail in certain scenarios, even though I believe it shouldn't. It is after all supposed to be creating a list of aliases and should display the dialog of each item in the list. Why I can't tell you why, I can say that after adding some code to troubleshoot, some files are not in the list created for these_items and of course why a dialog is not displayed in certain scenarios. IMO This is just another AppleScript bug! – user3439894 Mar 30 '17 at 16:39

You must log in to answer this question.

Browse other questions tagged .