Re: deleting text
Re: deleting text
- Subject: Re: deleting text
- From: Emmanuel <email@hidden>
- Date: Tue, 25 Nov 2003 21:32:26 +0100
At 1:51 PM -0500 11/25/03, Ruby Madraswala wrote:
>
Hi all
>
I am having problem with a simple script..........................
>
>
I have text files (over 60 to 200 paragraphs). I am trying to write a script to delete the "\" always in front of a word and "|" (pipe) at end of a word. "\" and "|" can be at beginning and end of one word. Sounds simple but I can't get the delete statement to work. What am I missing here and am I using the wrong command and or wrong approach. (trying with the slash first). Can tell I am a beginner at scripting.
Your problem here is that "delete" just does not work with AppleScript's text descriptors. You have to use a trick such as "set _string to text 2 thru -1 of _string".
Or, you may want to use the Regular expressions. Either by script:
--------------------
set x to "\\\\\\<|\\>\\|"
set theNewText to change x into "" in File1Text
--------------------
(this requires the Satimage osax [1])
Or in a "Find" dialog. For instance, using the Find dialog of Smile [2], enter:
\\\<|\>\|
as the search string, and click "Replace all". If you use Smile's Enhanced Find dialog, you can perform the replacements on all the windows open, or on all the files in a folder. Without [your] scripting.
Smile's URL:
<
http://www.satimage-software.com/en/softx.html>
Emmanuel
[1] A Scripting Addition that my company makes available for free.
[2] An AppleScript editor and scriptable text editor that my company makes available for free.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.