In article <z3GWa.1578$jp.1216@newsread4.news.pas.earthlink.net>,
Ben Combee <combee DeleteThis @techwood.org> wrote:
> David Phillip Oster wrote:
>
> > Paste the following into an appleScript document, and save it as:
> > "Make Lower Case" in the (Scripts) folder in your Metrowerks Codewarrior
> > folder.
>
> Cool... I forgot that the Mac OS editor has that nice AppleScript
> integration. We have to resort to more desperate measures to do the
> same thing on the Windows version of the CW IDE.
And I forgot that character <-> asciiValue conversion, although not
documented in the appleScript reference manual is part of the standard
additions, so the script really should look like this:
===============================
global numberOfA
global numberOfZ
on run
set numberOfA to ASCII number "A"
set numberOfZ to ASCII number "Z"
-- setup
tell application "CodeWarrior IDE"
-- get the text to lowercase
set the_text to selection of document 1
set the_val to DoLowerCaseString(the_text) of me
set selection of document 1 to the_val
end tell
end run
-- lower case a single char
-- bugs: ASCII only
on DoLowerCaseChar(local_char)
if (numberOfA ¾ (ASCII number local_char)) and ¬
((ASCII number local_char) ¾ numberOfZ) then
return ASCII character ((ASCII number local_char) + 32)
end if
return local_char
end DoLowerCaseChar
-- lower case a string
on DoLowerCaseString(local_text)
set result_text to ""
set i to 1
repeat with c in local_text
set myC to DoLowerCaseChar(character i of local_text)
set result_text to result_text & myC
set i to i + 1
end repeat
return result_text
end DoLowerCaseString
===============================
Also, you can use the the Key Bindings dialog box on the IDE's Edit menu
to assign a control-key to scripts you want to use frequently.
Also, since appleScript can run other scriptable applications, and Unix
shell scripts, you can easily do some amazing things.<!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: How to change Upperlower case in CW editor