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

pcLoadLetter

macrumors newbie
Original poster
Mar 23, 2017
2
0
I have this script that combines word files into one file. I then drop that Word file onto Quark and drag it off to the side. The problem I'm having is that the imported text cuts off after the first paragraph and the rest of the text is overflowing. I'm trying to figure out how to replace the paragraph break in the code with something that won't cut off in Quark.

Code:
on open of droppedfiles
   with timeout of 1500 seconds
       tell application "Microsoft Word"
           set new_document to make new document
           repeat with afile in droppedfiles
               set file_path to afile as string
               set filename to name of afile
               set paste_range to text object of new_document
               set collapsed_range to collapse range paste_range direction collapse end
               insert file file name file_path at collapsed_range
           end repeat
       end tell
   end timeout
end open
 
Last edited by a moderator:
FWIW in Word search and replace, ^t means tab.

I have no idea about how to apply that in AppleScript. Maybe by plugging keys.

Calling replace is obtained with shift-Cmd-H, but then the caret is in the replace by field. And tab does not go from one field to the other, or even to the replace all button.

Word for Mac does support Visual Basic for Applications (VBA) which should automate that, but I have not touched that in ages.
 
I used to do something similar, but using "find and replace" in word. For example, sometimes documents have 2 "returns" between paragraph, and one at the end of each line. I wanted only one at the end of each para. First search for paragraph "marks"represented by control-p "^p" then replace with a unique string, such as "***". Then, search for ****** (2 instances of paragraph returns) and replace with a single ^p. The result strips away all paragraph marks, then adds one back between each paragraph.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.