Perhaps what I’m trying to do is too convoluted, but I hope someone can help/offer advice.
I’m working with a series of texts, all of which contain inline tags (there contain the symbols </> with any number from 0-9 and up before the “/”) and these need to appear in the final document (docx) or the document will be corrupt and won’t open.
I already have a process in place that will copy the entire original sentence (on a sentence by sentence basis) to a plain text file, I just can’t think of how I can then lift only the tags and then using a keyboard short cut, paste these in the order in which they appear in the original sentence into the reworked sentence.
Here is an example:
Hier <0/>ist<1/> ein Satz auf <2/>deutsch<3/>.
The finished sentence needs to contain these tags, in the same order, but not necessarily in the same exact places. For instance I could have:
This is <0/><1/> a sentence <2/><3/> in German.
I can’t seem, however, to even get AppleScript to grab the contents of the file that contains the given sentence. Here is what I’ve tried so far. It runs fine, but when I try to paste the contents into a text file, nothing is returned:
try
tell application "Finder" to set theFile to item "~/Library/Preferences/OmegaT/script/source.txt"
open for access theFile
set fileContents to (read theFile)
set the clipboard to fileContents
close access theFile
end try
I’ve tried all sorts of permutations of the above, but so far nothing. Not a good start considering I then need to be able to pull the tags out of what I capture.
Can anyone help further?
Thanks,
Bowjest