-- RESID=128 (CW Script Builder plugin needs this)
on get_data()
try
display dialog "This will attempt to format the code. You can not undo this. " & ¬
"It would be a good idea to save before Beautifying your code" & ¬
"Continue?" buttons {"Cancel", "OK"} default button 2
set pressed to button returned of result
if pressed = "Cancel" then
return {no, -1}
end if
on error
return -- do nothing, just here to catch the cancel
end try
-- setup
set docnum to 1
tell application "CodeWarrior IDE 2.1"
set the_text to text of document docnum
on error
beep
return
end try
if the_text = "" then
beep
return
end if
return {the_text, 11, 21, 34}
end tell
end get_data
on set_data(the_text)
set docnum to 1
try
tell application "CodeWarrior IDE 2.1" to set text of document docnum to the_text as text
on error
beep
display dialog "Error setting" buttons {"OK"} default button 1
return
end try
end set_data