Re: Change Character
Re: Change Character
- Subject: Re: Change Character
- From: Kim Hunter <email@hidden>
- Date: Sun, 05 Jun 2005 19:58:57 +1000
On 5/6/05 7:49 PM, "Gary (Lists)" <email@hidden> wrote:
> "Kim Hunter" wrote:
>
>> I want to remove the ³:² from a string and replace them with for example
>> either ³-² or ³ - ³ which ever is easier.
>>
>> This works great (in a new script of its own):
>>
>> set str to "Zoom - How to get:set in Photoshop CS? MESSAGES"
>> set FinalSTR to RemoveColons(str)
>>
>>
>> on RemoveColons(Substring)
>> set NewString to do shell script "echo '" & Substring & "' | tr ':'
>> '-'"
>> return NewString
>> end RemoveColons
>>
>> But when I run it within my script it gives an error cannot continue
>> RemoveColons
>>
>> I don¹t know.
>
> Kim, here is an entry-level vanilla AS version, with no calls to the shell.
> Perhaps it will fill the need, at least temporarily.
>
> set inString to "here:you:go:now"
> set outString to SwapChar(inString, ":", "-")
>
> --> "here-you-go-now"
>
> to SwapChar(str, f, r) -- original string, find, replace
> set oTIDs to AppleScript's text item delimiters
> set AppleScript's text item delimiters to f
> set tmp_ to text items of str
> set AppleScript's text item delimiters to r
> set tmp_ to tmp_ as string
> set AppleScript's text item delimiters to oTIDs
> return tmp_
> end SwapChar
>
> HTH
> --
> Gary
>
That still returns the error
Cannot continue with SwapChar
I double checked my code and cant see why its not working
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden