MT Zap Characters : Source
| Name: | MT Zap Characters
|
| Event Class: | XUVJ
|
| Event ID: | zapc
|
| Resource: | AEVTXUVJzapc
|
Source
--- This source is written in HyperTalk for CompileIt!
global mySize:longInt, myactSize:longInt
global theAEEvent:R,theReply:R, handerRefCon:LongInt
codeResource "osax"
pascal function ZapChars:I theAEEvent:R, theReply:R, handerRefCon:L
put NewPtr(8) into myDescPtr
put AEGetParamDesc(theAEEvent@,"cutc",typeBoolean,myDescPtr@) into err
if myDescPtr@.descriptorType = typeNull then
put true into cutCflg
else
put myDescPtr@.dataHandle@@.booleanType into cutCflg
end if
put AEDisposeDesc(myDescPtr@) into err
---
put AEGetParamDesc(theAEEvent@,"cut8",typeBoolean,myDescPtr@) into err
if myDescPtr@.descriptorType = typeNull then
put true into cut8flg
else
put myDescPtr@.dataHandle@@.booleanType into cut8flg
end if
put AEDisposeDesc(myDescPtr@) into err
---
put AEGetParamDesc(theAEEvent@,keyDirectObject,typeChar,myDescPtr@) into err
if err <> 0 then
DisposPtr myDescPtr
return err
end if
put myDescPtr@.dataHandle into myStrHandle
put GetHandleSize(myStrHandle) into myactSize
if myactSize > 0 then
put myactSize-1 into mySize
repeat with x = 0 to mySize
put CharToNum(myStrHandle@@.charType[x]) into tgX
if tgX < 32 and cutcflg then
if tgX <> 9 and tgx <> 13 then
put NumToChar(32) into myStrHandle@@.charType[x]
end if
else if tgX > 127 and cut8flg then
put NumToChar(32) into myStrHandle@@.charType[x]
end if
end repeat
end if
if theReply@.descriptorType <> typeNull then
put AEPutParamDesc(theReply@, keyDirectObject,myDescPtr@) into err
end if
put AEDisposeDesc(myDescPtr@) into xerr
DisposPtr myDescPtr
return err
end ZapChars
Tanaka's osax : Source
Tanaka's osax