Replace_chars Subroutine just doesn't work for me
Replace_chars Subroutine just doesn't work for me
- Subject: Replace_chars Subroutine just doesn't work for me
- From: Dan Doughtie <email@hidden>
- Date: Fri, 24 Oct 2003 18:12:01 -0400
I9m a big fan of Acme Scripting Widgets (Acme replace) but it is hosing my
computer (running 10.2) by eating up all of the memory. I tried using the
replace_chars sub-routine on the Apple site but it just doesn9t do anything.
Maybe it would hose my system to if it actually did something. I9ve got to
search and replace about 30 things, in order, and it just doesn9t appear to
be doing anything. I9m using it to clean up email then writing it to a file
so a publishing system can suck it up (getting rid of carriage returns in
mid-sentence etc). Am I missing something here in the syntax because the
Script Debugger log doesn9t show where this subroutine is being called at
all
set MyText to content of x as string
my replace_chars(MyText, "5", "g")
my replace_chars(MyText, "m", "'")
my replace_chars(MyText, "l", "\"")
my replace_chars(MyText, "n", "\"")
my replace_chars(MyText, "V", " ")
my replace_chars(MyText, ",\"", "2")
my replace_chars(MyText, ".\"", ".2") --
my replace_chars(MyText, "3 ", "2 ")
my replace_chars(MyText, "\"", "3")
my replace_chars(MyText, ".
", ".
")-- THIS LAST ONE IS WHERE I9m replacing carriage returns etc) These are
just a few of the 30 or so I throw to the subroutine.
on replace_chars(MyText, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of MyText
set AppleScript's text item delimiters to the replacement_string
set MyText to the item_list as string
set AppleScript's text item delimiters to ""
return MyText
end replace_chars
Also, is there a way to see memory use to troubleshoot memory issues?
Dan Doughtie
Augusta, GA
_______________________________________________
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.