REVO2700 Sup and Sub R R on preopenstack set the style of this stack to palette end preopenstack U Geneva U Geneva U Times U Lucida Grande cREVGeneral scriptChecksum ի-.tO debugObjects bookmarks handlerList preopenstacktempScript prevHandler openstackscriptSelection char 61 to 60script
on preopenstack
set the style of this stack to palette
end preopenstack
P ;--on preopencard -- palette this stack --end preopencard cREVGeneral scriptChecksum Nˀ^ + bookmarks handlerList breakPoints scriptSelection char 1 to 57prevHandler opencardtempScript script--on preopencard
-- palette this stack
--end preopencard
Super and Sub Ep local tSupCharNo,k,m,tSubCharNo,tText,tDestinationField on mouseup --In this example, the text is put into the top field and then parsed. --Anything immediately following "^" is superscripted. --Anything immediately following "~" is subscripted. --It assumes that the super/sub is followed by a space,comma,period,return or end of file (i.e. empty) answer "Click on the Field to be transformed." with "OK" or "Cancel" if it is not "OK" then exit mouseUP wait until the mouseclick put the clickstack into tStackName put the clickLoc into tClickPoint go stack tStackName repeat with i = 1 to the number of fields in stack tStackName put the short name of field i into TheTemp put the rect of field i into temp --of stack tStackName into temp if tClickPoint is within the rect of field i then put the name of field i into tFieldName end if end repeat if tFieldName is "" then Answer "Couldn't find the Field. Try again." with "OK" exit mouseUP end if answer "Click on the destination field." with "OK" or "Cancel" if it is not "OK" then exit mouseUP wait until the mouseclick --put the clickstack into tStackName put the clickLoc into tClickPoint --go stack tStackName repeat with i = 1 to the number of fields in stack tStackName put the short name of field i into TheTemp put the rect of field i into temp --of stack tStackName into temp if tClickPoint is within the rect of field i then put the short name of field i into tDestinationField end if end repeat if tDestinationField is "" then Answer "Couldn't find the Field. Try again." with "OK" exit mouseUP end if put field tFieldName into field tDestinationField findSuperscripts field tDestinationField findSubscripts field tDestinationField fixSuperscripts fixSubscripts removeSupSub --set the text of field 5 to the htmltext of field tDestinationField end mouseup on findSuperscripts tText put 1 into k put offset("^",tText) into tSupCharNo[1] repeat put offset("^",tText,tSupCharNo[k]) into tOffset if tOffset =0 then exit repeat put tOffset + tSupCharNo[k] into tSupCharNo[k+1] add 1 to k end repeat end findSuperscripts on fixSuperscripts repeat with i = 1 to k put tSupCharNo[i]+1 into tNum if tNum is 1 then next repeat put 0 into j put " ,.~" & return into endingChars repeat until (char tNum+1+j of field tDestinationField is in endingChars) or (char tNum+1+j of field tDestinationField is empty) add 1 to j end repeat set the textShift of char tNum to tNum +j of field tDestinationField to -5 set the textSize of char tNum to tNum +j of field tDestinationField to 8 end repeat end fixSuperscripts on findSubscripts tText put 1 into m put offset("~",tText) into tSubCharNo[1] repeat put offset("~",tText,tSubCharNo[m]) into tOffset if tOffset is 0 then exit repeat put tOffset + tSubCharNo[m] into tSubCharNo[m+1] add 1 to m end repeat end findSubscripts on fixSubscripts repeat with i = 1 to m put tSubCharNo[i]+1 into tNum if tNum is 1 then next repeat put 0 into j put " ,.^" & return into endingChars repeat until (char tNum+1+j of field tDestinationField is in endingChars) or (char tNum+1+j of field tDestinationField is empty) add 1 to j end repeat if tNum is not 0 then set the textShift of char tNum to tNum +j of field tDestinationField to 5 set the textSize of char tNum to tNum +j of field tDestinationField to 8 end if end repeat end fixSubscripts on removeSupSub put the htmlText of field tDestinationField into tText replace "^" with "" in tText replace "~" with "" in tText set the htmltext of field tDestinationField to tText end removeSupSub j : R cREVGeneral scriptChecksum ڟ+rhh0breakPoints handlerList Rmouseup findSuperscripts fixSuperscripts findSubscripts fixSubscripts removeSupSubscriptSelection char 903 to 902 bookmarks revUniqueID 1083702772992prevHandler mouseuptempScript script &Mlocal tSupCharNo,k,m,tSubCharNo,tText,tDestinationField
on mouseup
--In this example, the text is put into the top field and then parsed.
--Anything immediately following "^" is superscripted.
--Anything immediately following "~" is subscripted.
--It assumes that the super/sub is followed by a space,comma,period,return or end of file (i.e. empty)
answer "Click on the Field to be transformed." with "OK" or "Cancel"
if it is not "OK" then exit mouseUP
wait until the mouseclick
put the clickstack into tStackName
put the clickLoc into tClickPoint
go stack tStackName
repeat with i = 1 to the number of fields in stack tStackName
put the short name of field i into TheTemp
put the rect of field i into temp --of stack tStackName into temp
if tClickPoint is within the rect of field i then
put the name of field i into tFieldName
end if
end repeat
if tFieldName is "" then
Answer "Couldn't find the Field. Try again." with "OK"
exit mouseUP
end if
answer "Click on the destination field." with "OK" or "Cancel"
if it is not "OK" then exit mouseUP
wait until the mouseclick
--put the clickstack into tStackName
put the clickLoc into tClickPoint
--go stack tStackName
repeat with i = 1 to the number of fields in stack tStackName
put the short name of field i into TheTemp
put the rect of field i into temp --of stack tStackName into temp
if tClickPoint is within the rect of field i then
put the short name of field i into tDestinationField
end if
end repeat
if tDestinationField is "" then
Answer "Couldn't find the Field. Try again." with "OK"
exit mouseUP
end if
put field tFieldName into field tDestinationField
findSuperscripts field tDestinationField
findSubscripts field tDestinationField
fixSuperscripts
fixSubscripts
removeSupSub
--set the text of field 5 to the htmltext of field tDestinationField
end mouseup
on findSuperscripts tText
put 1 into k
put offset("^",tText) into tSupCharNo[1]
repeat
put offset("^",tText,tSupCharNo[k]) into tOffset
if tOffset =0 then exit repeat
put tOffset + tSupCharNo[k] into tSupCharNo[k+1]
add 1 to k
end repeat
end findSuperscripts
on fixSuperscripts
repeat with i = 1 to k
put tSupCharNo[i]+1 into tNum
if tNum is 1 then next repeat
put 0 into j
put " ,.~" & return into endingChars
repeat until (char tNum+1+j of field tDestinationField is in endingChars) or (char tNum+1+j of field tDestinationField is empty)
add 1 to j
end repeat
set the textShift of char tNum to tNum +j of field tDestinationField to -5
set the textSize of char tNum to tNum +j of field tDestinationField to 8
end repeat
end fixSuperscripts
on findSubscripts tText
put 1 into m
put offset("~",tText) into tSubCharNo[1]
repeat
put offset("~",tText,tSubCharNo[m]) into tOffset
if tOffset is 0 then exit repeat
put tOffset + tSubCharNo[m] into tSubCharNo[m+1]
add 1 to m
end repeat
end findSubscripts
on fixSubscripts
repeat with i = 1 to m
put tSubCharNo[i]+1 into tNum
if tNum is 1 then next repeat
put 0 into j
put " ,.^" & return into endingChars
repeat until (char tNum+1+j of field tDestinationField is in endingChars) or (char tNum+1+j of field tDestinationField is empty)
add 1 to j
end repeat
if tNum is not 0 then
set the textShift of char tNum to tNum +j of field tDestinationField to 5
set the textSize of char tNum to tNum +j of field tDestinationField to 8
end if
end repeat
end fixSubscripts
on removeSupSub
put the htmlText of field tDestinationField into tText
replace "^" with "" in tText
replace "~" with "" in tText
set the htmltext of field tDestinationField to tText
end removeSupSub
Field 1 )` J cREVGeneral revUniqueID 1083704659635 First write the text in the field of your choice, using a "^" to denote where the superscripting is to start, and a "~" (tilde) to denote where the subscripting is to start. @ Black @ The parser assumes that the super/sub is followed by a space, comma, period, return or end of file (i.e. empty). That is, superscripting begins with the carrot and ends with a space, etc. @ @ To execute the parsing: @ .1) Click on the "Super and Sup" button above. @ - 52) Follow instructions and click on the sourse text. @ 4 :3) Follow instruciton and click on the destination field. @ 9 }Voila. The parsed text appears in the destination field. (It is too risky to replace the source field with the parsed text.) @ | ` K Example Ep Son mouseUP go to stack "supAndSubHelp" show stack "supAndSubHelp" end mouseUP \ r $ V cREVGeneral scriptChecksum I>8WcH bookmarks revUniqueID 1083705493681handlerList mouseUPscriptSelection char 70 to 69prevHandler mouseUPtempScript scripton mouseUP
go to stack "supAndSubHelp"
show stack "supAndSubHelp"
end mouseUP
SupAndSubHelp @ U geneva U Geneva U Geneva U Lucida Grande U Lucida Grande @ Field 1 )` ( P| cREVGeneral revUniqueID 1083703190388 ;From the Pythagorean theorem we know that x^2 + y^2 = z^2. +The coordinate axes are x~1, x~2 and x~3. z^123 z~124 x^1~2. x^34 + x^2. x^2 + 2x + 1 f(x) = (x + 1)^3 data )` ( \ cREVGeneral revUniqueID 1083703195173 8From the Pythagorean theorem we know that x2 + y2 = z2. + + , 0 1 5 6 (The coordinate axes are x1, x2 and x3. % &