Is it possible to select files in Finder → batch convert from RTFD to Pages?

thanks very much in advance for your time and help

I found a program called "To Text Converter" by Roberto Panetta of Ecleti Software which is free to use for 10 days which seems to be able to do precisely what you want. Are you willing to test it out to see if it works for you? It's available on the Apple App store for macOS. I think it costs about $5 (the price varies by country, of course.) You won't need KM to be able to use this app, as it seems to support batch conversion.

In case you don't want to spend $5, I have three questions for you.

  1. When you say "batch convert", do you really mean "in the background?" Usually when people talk about batch conversions they want the conversion to occur in the background without using the screen. I'm not sure if that's what you want, or if you would be happy with a solution that requires the screen.

  2. Did you try converting a single RTFD document to Pages using Pages or TextEdit? Did it work? According to the wikipedia article on RTFD, it should work....

Like RTF, RTFD files can be opened on macOS, which supports bundles. Mac applications that support RTF and RTFD include Apple's TextEdit and Pages, and a third-party free program called Bean. However, Microsoft's Office for Mac and most other document applications on the platform do not support RTFD.

  1. An RTFD document is a "package" that contains text files, graphic files, and animation files. Do you really want the images/graphics converted, or are you happy just extracting the text? If you just want the text, there might be a much, much simpler solution. Why should you try to build a complex solution if there is a simple solution to meet your needs?

P.S. At first I thought your question was answered because the only question you had was in the title of your message, and the body of your message sounded like someone had completely solved your problem, and you were thanking them. So I almost left thinking that someone solved your problem. In the future I recommend that you actually copy your question into the body of your post, not just place the question in the title, or people might leave, thinking your question was solved.

1 Like

thank you for your post and your research.

  • I know that an RTFD is a package. The issue is than text, format, images and if possible inline PDF.
  • you are right: my post with no body is poorly formulated
  • I bought the app and discovered that it only converts to txt, not Pages. No problem.
  • batch convert means processing multiple files. Foreground is fine.
  • I can open a single RTFD file in Pages and the result is superb (images and format preserved), which is not the case for MS Word. It works with TextEdit, but the app is too limited in terms of formatting. PDFs are simply converted to an image of the first page, not inline.
  • I want the images and if possible the inline PDF. Text only is useless.

In terms of KBM, I thought that it should hopefully be quite straightforward:

  • select multiple files in Finder or drag and drop files
  • to do the equivalent with KBM of selecting and opening multiple RTF/D in Pages → saving in Pages

thank you

Well, if you can open the RTFD in pages, and the result is superb, then that is your solution. KM can solve that for you one file at a time.

The way I normally solve a problem like that is that I document the exact key sequence for doing the conversion then put that sequence in a loop to process all the files in a folder, or perhaps it could also be done for a file selection, as I think you want. The problem is I don't have an RTFD file, so I can't develop the sequence of steps. Are you willing to document the exact sequence of steps?

Yes -- you just drag the files from the Finder and drop them on the Pages app. So, in KM, this will work:

image

...unless you are suffering from the "opening in a specific app throws an error" problem, in which case you can resort to one of the fixes in this thread.

After that it depends on what you want to do with the converted files. Using KM to fire up a "Save…" menu and fill in the path etc is well documented on the Forum. Pages is also AppleScriptable so you could

tell application "Pages"
	tell document 1
		save in file "Macintosh HD:Users:myUserName:Desktop:myFileName.pages"
	end tell
	close document 1
end tell

Further tweaks depend on details. How do you want files naming? Where should the converted copies be saved. Etc.

1 Like

Thank you for your post.

Here are my partial solutions and problems:

  • using Forklift instead of Finder. Solution: in Forklift, manually select all files

  • open in Pages. Yes I get the opening in specific app error using the Open Finder in Pages KBM action.. I can bypass this by simply batch using the context menu "open in" Pages for all selected files or drag and drop files to the Pages icon in the dock. Thank you for the link to a solution to the error but it's too complicated for my level.

  • my next step for which I would need your help (modifying the AppleScript) would be to

  • save all documents , one by one, open in Pages as .pages files. What I don't know is how to say "save files one by one until there are no more files open in Pages"

  • save them to the same folder as the original rtfd files

  • if there happens to be a file with the same name, yes replace automatically

thanks very much @Nige_S

You get a list of the open documents, then work through that list one by one:

tell application "Pages"
	set docList to (get every document)
	repeat with eachDoc in docList
		-- do some stuff
	end repeat
end tell

The "get a list then repeat with each item in that list" is a very useful AS contruct to have up your sleeve. When the list is only used for that one repeat you'll often see it shortened, the repeat and get on one line.

I don't use Forklift so don't know if you can get the path of currently-selected items or similar from it. But you can throw up a dialog in the AS to choose a folder to save everything in. So:

set thePath to (choose folder) as text

tell application "Pages"
	repeat with eachDoc in (get every document)
		save eachDoc in file (thePath & name of eachDoc & ".pages")
		close eachDoc
	end repeat
end tell

Move the set thePath... line into the repeat loop, as the first thing that happens, if you want to choose on a file-by-file basis.

1 Like

thank you very much. I will work through your solution

I'm very sorry: I don't understand how to integrate both scripts.

You don't -- the second one is complete.

I don't use Forklift so I don't know if you can get the paths of the files you are opening. Without that you don't know where to save the converted versions, which is why you have to save them all to a particular folder then sort them out by hand later.

If you were using the Finder you'd use KM's %FinderSelections% token then process each document individually, opening it then saving the converted version to the parent path of the original.

1 Like

thanks again very much