Hello Anthony,
You may try the script listed below.
It will ask you the directory which and of which sub directories contain the rtf files and then edit each rtf file such that X is replaced by Y (denoted by X => Y) as follows:
\'bc => {\up 1}{\uc1\u8260/}{\dn 4}
\'bd => {\up 1}{\uc1\u8260/}{\dn 2}
\'be => {\up 3}{\uc1\u8260/}{\dn 4}
I changed the replacement string a little from the one in the earlier post. This one will be safer.
To test the script, please make a test folder and copy a few rtf files you want to edit into it, run the script and choose the test folder when asked by the script. Then it will make a backup copy of each rtf file and create edited version. (Given an orignial file name A, the backup copy is named A.orig and the edited version is named A. Backup copy is made whether or not actual modification to the file takes place. If you wish, you can prevent the script from making backup copy by setting the property _backup to false.)
If the test is fine, please make a copy of the real target folder, run the script and choose the copy for safety. If there're a lot of rtf files in the target tree, it will take a while to finish.
---
By the way, I guess this thread is related to this:
Topic : Import .rtf file int ApppleWorks 6
http://discussions.apple.com/thread.jspa?threadID=1601811
Then your new procedure would be -
1) Edit the rtf file as explained here; and
2) Open the edited rtf file in TextEdit and copy the text; and
3) Paste it into AppleWorks WP document.
Good luck,
Hiroto
P.S. To use the script, copy the entire text from '--SCRIPT3' to '--END OF SCRIPT3' (inclusive) and paste it into new window of Script Editor and run it. (Please copy the text from this web page, not from subscribed email text, for I escaped some characters for posting.)
Perl code has been tested but the entire script has not, for I don't use OSX for myself. Sorry for that.
--SCRIPT3
(*
Edit rtf files suth that
X is replaced with Y (denoted as X => Y) as follows:
\'bc => {\up 1}{\uc1\u8260/}{\dn 4}
\'bd => {\up 1}{\uc1\u8260/}{\dn 2}
\'be => {\up 3}{\uc1\u8260/}{\dn 4}
Usage:
Run this script and it will ask you to locate the root of the directory tree in which the rtf files reside,
and then it will process every rtf file in chosen tree.
(If the property _backup is true, it will make backup copy for each rtf file in advance.
Otherwise (_backup is false) the original rtf file is overwritten without making backup copy)
*)
main()
on main()
script o
property _backup : true -- whether or not to make backup copy ("*.rtf.orig") for each rtf file ("*.rtf") in advance
property mss1 : "Choose root directory under which the rtf files reside."
property mss2 : "You are modifying every rtf file in the directory tree rooted at:" & return & return
property mss3 : "Done."
property pl : "
s(\\\\'bc)({\\\\up 1}{\\\\uc1\\\\u8260/}{\\\\dn 4})og;
s(\\\\'bd)({\\\\up 1}{\\\\uc1\\\\u8260/}{\\\\dn 2})og;
s(\\\\'be)({\\\\up 3}{\\\\uc1\\\\u8260/}{\\\\dn 4})og;"
set da to choose folder with prompt mss1
display dialog mss2 & da with icon 1 -- for confirmation
set dpx_ to quoted form of (da's POSIX path's text 1 thru -2)
if _backup then
-- to edit every *.rtf file after making a backup copy named *.rtf.orig
set sh to "find " & dpx_ & " -type f -iname \"*.rtf\" -print0 | xargs -0 perl -i.orig -pe " & quoted form of pl
else
-- to edit every *.rtf file without making any backup copy.
set sh to "find " & dpx_ & " -type f -iname \"*.rtf\" -print0 | xargs -0 perl -i -pe " & quoted form of pl
end if
do shell script sh
display dialog mss3 with icon 1 giving up after 5
end script
tell o to run
end main
--END OF SCRIPT3
Message was edited by: Hiroto