Hi, I am using Automator to extract 3 blocks of text (from a .txt file), using AppleScript it combines the text and displays it in a Dialog Box. I then manually copy the contents of the Dialog and paste it into Notepad. Although a bit clunky, this is working ok but I really would like it to loop through several files at once (between 1 & 10). The resulting text may be too long to fit in a dialog box, so perhaps it could all be combined and saved to a variable (or the clipboard?) for later use?
Currently, I select the appropriate file in finder and right click to run the Quick Action.
Any help would be appreciated. Thanks.
“The Workflow Receives Current [Files or Folders] in [Finder]”
on run {input, parameters}
set theFile to input
set theFileContents to read theFile as text
set AddressStartPosition to offset of "Random Company Ltd" in theFileContents
set AddressEndPosition to offset of "Hampshire" in theFileContents
set FirstPosition to offset of "1.31 Comments" in theFileContents
set SecondPosition to offset of "1.32 Recommendations" in theFileContents
set ThirdPosition to offset of "3.31 Comments" in theFileContents
set ForthPosition to offset of "3.32 Recommendations" in theFileContents
set Address to (characters (AddressStartPosition + 28) thru (AddressEndPosition - 1) of theFileContents) as string
set FirstPageComments to (characters FirstPosition thru (SecondPosition - 1) of theFileContents) as string
set ThirdPageComments to (characters ThirdPosition thru (ForthPosition - 1) of theFileContents) as string
set FullText to Address & FirstPageComments & ThirdPageComments
display dialog FullText
return input
end run