• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Basic Script Blues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic Script Blues


  • Subject: Re: Basic Script Blues
  • From: Thomas Fischer <email@hidden>
  • Date: Sat, 21 Nov 2009 12:44:14 +0100

I suppose it's a backslash (\) problem.

As Ed together with Emmanuel said:

> Ed means: backslash is an applescript escape character

What you have to do is escape the escape, i.e. double the backslash:

>>> set TheText to my SearchReplace(TheText, "equi\\ibration",  "equilibration")

should do the job.

Thomas


Am 20.11.2009 um 08:42 schrieb ba95:

> Le 19 nov. 09 à 21:00, email@hidden a écrit :
>
>> Date: Thu, 19 Nov 2009 11:42:45 -0800
>> From: "Stockly, Ed" <email@hidden>
>
> Thanks a lot Ed.
>
>>
>>
>>> I often encounter the following OCR mistake: "equi/ibration" instead of
>> "equilibration".
>>
>>> The following line does not work ("equi/ibration" is not found)
>>
>>> set TheText to my SearchReplace(TheText, "equi/ibration",  "equilibration")
>>
>> There's nothing about this handler call that would cause it to fail, so the
>> problem may be in the handler itself. Can you post the SearchReplace handler
>> that generates the error?
>
> Here it is
>
> --
> 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
> --
>
>>
>> Unless, is it possible that your OCR is returning a slash \ rather than a
>> backslash /  ?
>>
>> A slash is an appleScript escape character and may be causing problems.
>
> The other SearchReplace operations do perform perfectly.
>
> I do not think so, but I will pay attention next time.
>
> Thanks again.
>
> Best.
>
> _______________________________________________
> 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

 _______________________________________________
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

References: 
 >Re: Basic Script Blues (From: ba95 <email@hidden>)

  • Prev by Date: Re: As Alias List
  • Next by Date: GUI scripting for installers which have root privilege
  • Previous by thread: Re: Basic Script Blues
  • Next by thread: iTunes script problems
  • Index(es):
    • Date
    • Thread