Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

saberahul

macrumors 68040
Original poster
Nov 6, 2008
3,651
120
USA
I want to take all images placed into a folder and put them in a Word document one after the other.

I was able to do this in Automator using the following steps (folder action):
1. Get Folder Contents
2. Create New Word Document
3. Insert Content into Word Document (bottom of document)
4. Save Word Document

This works, partially. The problem is that I have over 100 image files and it takes a little more than 1 second to paste them all into the folder with the folder action. This causes the folder action to make 1 Word document for the pictures that got pasted right away, another for the next set of images, and so forth.

How can I go about making just one document with all images inserted one after the other? I have tried using Combine Word Document, Ask for Confirmation (which does nothing on Yosemite), and Wait for User Action (which did not make any difference as even after hitting OK after 1 full minute, same thing happened).

If someone can point me in the right direction or just give me an AppleScript code (I assume this is easy?), I'd be grateful!
 
I want to take all images placed into a folder and put them in a Word document one after the other.

I was able to do this in Automator using the following steps (folder action):
1. Get Folder Contents
2. Create New Word Document
3. Insert Content into Word Document (bottom of document)
4. Save Word Document

This works, partially. The problem is that I have over 100 image files and it takes a little more than 1 second to paste them all into the folder with the folder action. This causes the folder action to make 1 Word document for the pictures that got pasted right away, another for the next set of images, and so forth.

How can I go about making just one document with all images inserted one after the other? I have tried using Combine Word Document, Ask for Confirmation (which does nothing on Yosemite), and Wait for User Action (which did not make any difference as even after hitting OK after 1 full minute, same thing happened).

If someone can point me in the right direction or just give me an AppleScript code (I assume this is easy?), I'd be grateful!

I'm just guessing that the folder action kicks in before all the images are pasted into the hot folder right? If that's the case you can try this :

In Automator create folder action :

  1. Folder Action receives files and folders added to your folder
  2. Run AppleScript action with the following code

    Code:
    on run {input, parameters}
    	(* Your script goes here *)
    	tell application "Finder" to set theFolder to get container of first item of input
    	-- This should make the folder action wait until files have finished copying to the folder
    	set fSizes to {0}
    	repeat
    		tell application "System Events" to set end of fSizes to size of theFolder
    		if (item -1 of fSizes) = (item -2 of fSizes) then exit repeat
    		delay 1
    	end repeat
    	return input
    end run
  3. Create New Word Document
  4. Save Word Documents

Note : Tested on OS X 10.9.4 and Microsoft Word 14.0.0 with 242 image files dropped into the hot folder. It created a 27 page Word document with all the images. I'm stressing that I dropped files into the hot folder. If you want to process folders as well you'll need to change the script. It is good practice to leave the hot folder empty after processing. This avoids repeated application of the action to the same files.
 

Attachments

  • Screen Shot 2014-07-31 at 03.16.39.png
    Screen Shot 2014-07-31 at 03.16.39.png
    32.8 KB · Views: 168
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.