Re: TextEdit Slash SearchReplace impossible (was Basic Script Blues)
Re: TextEdit Slash SearchReplace impossible (was Basic Script Blues)
- Subject: Re: TextEdit Slash SearchReplace impossible (was Basic Script Blues)
- From: "email@hidden" <email@hidden>
- Date: Fri, 20 Nov 2009 22:56:51 -0800
Well, I just tried your script as modified below.
I copied everything between the ------s to the clipboard and your script ran perfectly.
So that's not where the problem is.
What are the "blah blah blah other searchreplace operations" doing? Are they using the same handler?
What applications are involved in this process? What application is the clipboard first created in?
The backslash is the appleScript escape character, but the slash may be an escape character for another ap.
You may also try:
set TheText to my SearchReplace(TheText, "eqUI//l", "equili")
set TheText to my SearchReplace(TheText, "equi//ibration", "equilibration")
Try this too: open your script in script editor.
Insert these commands after you get the text from the clipboard:
log theText
log class of theText
Then open the apple event log and run the script.
Look a the log and see if it tells you anything useful.
HTH
ES
------
equi/ibration
instead of
equilibration
equi/ibration
instead of
equilibration
equi/ibration
instead of
equilibration
equi/ibration
instead of
equilibration
equi/ibration
instead of
equilibration
eqUI/l
eqUI/leqUI/leqUI/l
--------
set TheText to the clipboard
set TheText to my SearchReplace(TheText, "eqUI/l", "equili")
set TheText to my SearchReplace(TheText, "equi/ibration", "equilibration")
set the clipboard to theThext
on SearchReplace(mainString, searchString, replaceString)
set olddelis to AppleScript's text item delimiters
set AppleScript's text item delimiters to (searchString)
set theList to (every text item of mainString)
set AppleScript's text item delimiters to (replaceString)
set theString to theList as string
set AppleScript's text item delimiters to olddelis
return theString
end SearchReplace
>>
>> --
>> set TheText to the clipboard
>>
>> set TheText to my SearchReplace(TheText, "eqUI/l", "equili")
>> -- Blah... Blah... (other SearchReplace operations)
>>
>> set the clipboard to TheText
>>
>> on SearchReplace(mainString, searchString, replaceString)
>> set olddelis to AppleScript's text item delimiters
>> set AppleScript's text item delimiters to (searchString)
>> set theList to (every text item of mainString)
>> set AppleScript's text item delimiters to (replaceString)
>> set theString to theList as string
>> set AppleScript's text item delimiters to olddelis
>> return theString
>> end SearchReplace
>> --
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden