#!/bin/sh # MetaCard 2.4 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" 6 AnswerDialog 2 2 Managing Answer Dialogs U Lucida Grande W Lucida Grande U Lucida Grande U Lucida Grande U Georgia U Georgia @U Lucida Grande U Verdana @U Verdana U Verdana U Courier U Courier U Lucida Grande U Apple LiSung Light,Chinese U Baskerville U Arial U Baskerville Semibold U Baskerville Semibold W Cochin W Comic Sans MS U Lucida Grande U Lucida Grande U Lucida Grande U Georgia U Comic Sans MS U Lucida Grande cREVOnline fingerprint HdaFCSjzLnZ_lyZX-3UUnA cREVGeneral debugObjects p`on preOpenStack set the style of this stack to "modeless" set the loc of this stack to the screenLoc end preOpenStack ------------------------------------ on preOpenCard put the scriptTextFont into tFont if tFont = empty then switch the platform case "MacOS" set the textFont of fld "Script" to "Courier" break case "Win32" set the textFont of fld "Script" to "Courier New" break default set the textFont of fld "Script" to "Helvetica" end switch else set the textFont of fld "Script" to tFont set the textSize of fld "Script" to 12 put "Enter a prompt here" into fld "Text" set the textFont of char 1 to -1 of fld "Text" to empty lock messages select text of fld "Text" unlock messages BuildCode -- enable btn "Show Dialog" end preOpenCard ------------------------------------ on selectionChanged BuildCode -- end selectionChanged ------------------------------------ on rawKeyUp BuildCode -- set the enabled of btn "Show Dialog" to fld "Text" <> empty set the enabled of btn "Copy" to fld "Script" <> empty pass rawKeyUp end rawKeyUp ------------------------------------ on BuildCode if fld "Text" = empty then put empty into fld "Script" else if the hilite of btn "Use HTML" then put the htmlText of fld "Text" into tPrompt replace quote with quote && "& quote &" && quote in tPrompt else put fld "Text" into tPrompt end if repeat with i = 1 to the number of lines of tPrompt if not the hilite of btn "Use HTML" and quote is in char 2 to -2 of line i of tPrompt then put char 2 to -2 of line i of tPrompt into tempText replace quote with quote && "& quote &" && quote in tempText put tempText into char 2 to -2 of line i of tPrompt end if if char 1 of line i of tPrompt = quote then put "quote &" && quote into char 1 of line i of tPrompt if char -1 of line i of tPrompt = quote then put quote && "& quote" into char -1 of line i of tPrompt if word 1 of line i of tPrompt <> "quote" then put quote & line i of tPrompt into line i of tPrompt if word -1 of line i of tPrompt <> "quote" then put line i of tPrompt & quote into line i of tPrompt if i > 1 then put " & cr & " before line i of tPrompt end repeat replace cr with " \" & cr in tPrompt put "put " before tPrompt put " into tPrompt" after tPrompt put cr & "answer" && the hilitedButtonName of grp "radio" && "tPrompt" && "with " after tPrompt if fld "Default" <> empty then if fld "Button3" <> empty then put quote & fld "Button3" & quote && "or " after tPrompt if fld "Button2" <> empty then put quote & fld "Button2" & quote && "or " after tPrompt put quote & fld "Default" & quote after tPrompt end if if fld "Title" <> empty then put " titled" && quote & fld "Title" & quote after tPrompt if the hilite of btn "Sheet" then put " as sheet" after tPrompt replace " &" && quote & quote & "" with empty in tPrompt replace quote & quote with quote && "& quote &" && quote in tPrompt put tPrompt & cr into fld "Script" revColorScript -- end if end BuildCode ------------------------------------------------ on revColorScript global gREVScriptColors if gREVScriptColors["if"] is empty then revSetupColors put field "script" into tScript put 1 into tCurrentWord lock screen set the textColor of word 1 to -1 of fld "script" to empty -- remove any colors in use repeat for each word w in tScript --block comment color if char 1 to 2 of w is "/*" then put true into tBlockComment end if if tBlockComment then if char 1 to 2 of w is "*/" then set the textColor of word tCurrentWord of fld "script" to "DarkOrchid4" put false into tBlockComment else set the textColor of word tCurrentWord of fld "script" to "DarkOrchid4" add 1 to tCurrentWord next repeat end if end if if char 1 of w is quote then set the textColor of word tCurrentWord of field "script" to empty add 1 to tCurrentWord next repeat end if if gREVScriptColors[token 1 of w] is not empty then set the textColor of token 1 of word tCurrentWord of field "script" to gREVScriptColors[token 1 of w] end if add 1 to tCurrentWord end repeat put min(lineoffset("#", tScript), lineoffset("--", tScript)) into tOldLine if tOldLine is 0 then put max(lineoffset("#", tScript), lineoffset("--", tScript)) into tOldLine put 0 into tLineNo repeat -- while tOldLine is not 0 if tOldLine is 0 then exit repeat add tOldLine to tLineNo put line tLineNo of tScript into tCurrentLine put the number of words in tCurrentLine into tNumWords repeat with tCurrentWord = 1 to tNumWords if char 1 of word tCurrentWord of tCurrentLine is "#" or char 1 to 2 of word tCurrentWord of tCurrentLine is "--" then put the number of words in tCurrentLine into tNumWords set the textColor of word tCurrentWord to tNumWords of line tLineNo of field "script" to "DarkOrchid4" exit repeat end if end repeat put min(lineoffset("#", tScript, tLineNo), lineoffset("--", tScript, tLineNo)) into tOldLine if tOldLine is 0 then put max(lineoffset("#", tScript, tLineNo), lineoffset("--", tScript, tLineNo)) into tOldLine end repeat unlock screen end revColorScript ------------------------------------------------ on revSetupColors global gREVScriptColors delete global gREVScriptColors put the cCustomColorsList of stack "revPreferences" into tColorsList put line 1 of the cBuiltInColors of stack "revPreferences" into tColor replace "command" with tColor in tColorsList repeat for each word w in the commandNames put tColor into gREVScriptColors[w] end repeat put line 2 of the cBuiltInColors of stack "revPreferences" into tColor replace "Control Structure" with tColor in tColorsList repeat for each word w in "if then else repeat for with while on end switch case getprop setprop try catch" put tColor into gREVScriptColors[w] end repeat put line 3 of the cBuiltInColors of stack "revPreferences" into tColor replace "Functions" with tColor in tColorsList repeat for each word w in the functionNames put tColor into gREVScriptColors[w] end repeat put line 4 of the cBuiltInColors of stack "revPreferences" into tColor replace "Property" with tColor in tColorsList repeat for each word w in the propertyNames put tColor into gREVScriptColors[w] end repeat put 1 into tCount put the cCustomWordList of stack "revPreferences" into tWordsList repeat for each line l in tWordsList put line tCount of tColorsList into gREVScriptColors[l] add 1 to tCount end repeat end revSetupColors ------------------------------------------------ on AnswerFramedPage pAction -- as an example; not used in this stack put "
This page uses frames:" & cr & "Can't retrieve relevant data from such an architecture." \ & cr & cr & "To" && pAction && "this reference manually:" & cr \ & cr & "1. Create a .txt file" \ & cr & "2. Put the URL into the first line of it" \ & cr & "3. Paste the contents of the page" \ & cr & "4. Name the file as you wish" \ & cr & "5. Drop the file into your local folder
" into tPrompt replace cr with "" & cr & "" in tPrompt -- that is the trick :-) answer error tPrompt as sheet end AnswerFramedPage cREVGeneral scriptChecksum fIm5d bookmarks handlerList kpreOpenStack preOpenCard selectionChanged rawKeyUp BuildCode revColorScript revSetupColors AnswerFramedPagebreakPoints tempScript prevHandler BuildCodescriptSelection char 785 to 784script s
on preOpenStack
set the style of this stack to "modeless"
set the loc of this stack to the screenLoc
end preOpenStack
------------------------------------
on preOpenCard
put the scriptTextFont into tFont
if tFont = empty then
switch the platform
case "MacOS"
set the textFont of fld "Script" to "Courier"
break
case "Win32"
set the textFont of fld "Script" to "Courier New"
break
default
set the textFont of fld "Script" to "Helvetica"
end switch
else set the textFont of fld "Script" to tFont
set the textSize of fld "Script" to 12
put "Enter a prompt here" into fld "Text"
set the textFont of char 1 to -1 of fld "Text" to empty
lock messages
select text of fld "Text"
unlock messages
BuildCode --
enable btn "Show Dialog"
end preOpenCard
------------------------------------
on selectionChanged
BuildCode --
end selectionChanged
------------------------------------
on rawKeyUp
BuildCode --
set the enabled of btn "Show Dialog" to fld "Text" <> empty
set the enabled of btn "Copy" to fld "Script" <> empty
pass rawKeyUp
end rawKeyUp
------------------------------------
on BuildCode
if fld "Text" = empty then put empty into fld "Script"
else
if the hilite of btn "Use HTML" then
put the htmlText of fld "Text" into tPrompt
replace quote with quote && "& quote &" && quote in tPrompt
else
put fld "Text" into tPrompt
end if
repeat with i = 1 to the number of lines of tPrompt
if not the hilite of btn "Use HTML" and quote is in char 2 to -2 of line i of tPrompt then
put char 2 to -2 of line i of tPrompt into tempText
replace quote with quote && "& quote &" && quote in tempText
put tempText into char 2 to -2 of line i of tPrompt
end if
if char 1 of line i of tPrompt = quote then put "quote &" && quote into char 1 of line i of tPrompt
if char -1 of line i of tPrompt = quote then put quote && "& quote" into char -1 of line i of tPrompt
if word 1 of line i of tPrompt <> "quote" then put quote & line i of tPrompt into line i of tPrompt
if word -1 of line i of tPrompt <> "quote" then put line i of tPrompt & quote into line i of tPrompt
if i > 1 then put " & cr & " before line i of tPrompt
end repeat
replace cr with " \" & cr in tPrompt
put "put " before tPrompt
put " into tPrompt" after tPrompt
put cr & "answer" && the hilitedButtonName of grp "radio" && "tPrompt" && "with " after tPrompt
if fld "Default" <> empty then
if fld "Button3" <> empty then put quote & fld "Button3" & quote && "or " after tPrompt
if fld "Button2" <> empty then put quote & fld "Button2" & quote && "or " after tPrompt
put quote & fld "Default" & quote after tPrompt
end if
if fld "Title" <> empty then put " titled" && quote & fld "Title" & quote after tPrompt
if the hilite of btn "Sheet" then put " as sheet" after tPrompt
replace " &" && quote & quote & "" with empty in tPrompt
replace quote & quote with quote && "& quote &" && quote in tPrompt
put tPrompt & cr into fld "Script"
revColorScript --
end if
end BuildCode
------------------------------------------------
on revColorScript
global gREVScriptColors
if gREVScriptColors["if"] is empty then revSetupColors
put field "script" into tScript
put 1 into tCurrentWord
lock screen
set the textColor of word 1 to -1 of fld "script" to empty -- remove any colors in use
repeat for each word w in tScript
--block comment color
if char 1 to 2 of w is "/*" then
put true into tBlockComment
end if
if tBlockComment then
if char 1 to 2 of w is "*/" then
set the textColor of word tCurrentWord of fld "script" to "DarkOrchid4"
put false into tBlockComment
else
set the textColor of word tCurrentWord of fld "script" to "DarkOrchid4"
add 1 to tCurrentWord
next repeat
end if
end if
if char 1 of w is quote then
set the textColor of word tCurrentWord of field "script" to empty
add 1 to tCurrentWord
next repeat
end if
if gREVScriptColors[token 1 of w] is not empty then
set the textColor of token 1 of word tCurrentWord of field "script" to gREVScriptColors[token 1 of w]
end if
add 1 to tCurrentWord
end repeat
put min(lineoffset("#", tScript), lineoffset("--", tScript)) into tOldLine
if tOldLine is 0 then put max(lineoffset("#", tScript), lineoffset("--", tScript)) into tOldLine
put 0 into tLineNo
repeat -- while tOldLine is not 0
if tOldLine is 0 then exit repeat
add tOldLine to tLineNo
put line tLineNo of tScript into tCurrentLine
put the number of words in tCurrentLine into tNumWords
repeat with tCurrentWord = 1 to tNumWords
if char 1 of word tCurrentWord of tCurrentLine is "#" or char 1 to 2 of word tCurrentWord of tCurrentLine is "--" then
put the number of words in tCurrentLine into tNumWords
set the textColor of word tCurrentWord to tNumWords of line tLineNo of field "script" to "DarkOrchid4"
exit repeat
end if
end repeat
put min(lineoffset("#", tScript, tLineNo), lineoffset("--", tScript, tLineNo)) into tOldLine
if tOldLine is 0 then put max(lineoffset("#", tScript, tLineNo), lineoffset("--", tScript, tLineNo)) into tOldLine
end repeat
unlock screen
end revColorScript
------------------------------------------------
on revSetupColors
global gREVScriptColors
delete global gREVScriptColors
put the cCustomColorsList of stack "revPreferences" into tColorsList
put line 1 of the cBuiltInColors of stack "revPreferences" into tColor
replace "command" with tColor in tColorsList
repeat for each word w in the commandNames
put tColor into gREVScriptColors[w]
end repeat
put line 2 of the cBuiltInColors of stack "revPreferences" into tColor
replace "Control Structure" with tColor in tColorsList
repeat for each word w in "if then else repeat for with while on end switch case getprop setprop try catch"
put tColor into gREVScriptColors[w]
end repeat
put line 3 of the cBuiltInColors of stack "revPreferences" into tColor
replace "Functions" with tColor in tColorsList
repeat for each word w in the functionNames
put tColor into gREVScriptColors[w]
end repeat
put line 4 of the cBuiltInColors of stack "revPreferences" into tColor
replace "Property" with tColor in tColorsList
repeat for each word w in the propertyNames
put tColor into gREVScriptColors[w]
end repeat
put 1 into tCount
put the cCustomWordList of stack "revPreferences" into tWordsList
repeat for each line l in tWordsList
put line tCount of tColorsList into gREVScriptColors[l]
add 1 to tCount
end repeat
end revSetupColors
------------------------------------------------
on AnswerFramedPage pAction -- as an example; not used in this stack
put "<p><b>This page uses frames:</b>" & cr & "Can't retrieve relevant data from such an architecture." \
& cr & cr & "To" && pAction && "this reference manually:" & cr \
& cr & "<i>1. Create a .txt file" \
& cr & "2. Put the URL into the first line of it" \
& cr & "3. Paste the contents of the page" \
& cr & "4. Name the file as you wish" \
& cr & "5. Drop the file into your local folder</i></p>" into tPrompt
replace cr with "</p>" & cr & "<p>" in tPrompt -- that is the trick :-)
answer error tPrompt as sheet
end AnswerFramedPage
# . ! % @ 3 4 5 ' 6 Show Dialog Ep `on mouseUp BuildCode -- C do fld "Script" put "it variable contains:" && it end mouseUp d cREVGeneral scriptChecksum BsW;:handlerList mouseUpbreakPoints scriptSelection char 19 to 18revUniqueID 1113288937307 bookmarks tempScript prevHandler mouseUpscript 2on mouseUp
BuildCode -- C
do fld "Script"
put "it variable contains:" && it
end mouseUp
Script )h @ #KV cREVGeneral revUniqueID 1113288980608 .put "Enter a prompt here
" into tPrompt @ blue * Aanswer info tPrompt with "Cancel" or "OK" titled "Test" as sheet @ blue @ brown # @ blue ; ` hL v a $E SSS.png Hon mouseDown revGoUrl "http://www.sosmartsoftware.com" end mouseDown " -PNG IHDR " . pHYs .# .#x?v 9iCCPPhotoshop ICC profile xڝwTTϽwz0z.0. Qf Ml@DEHb!(`HPb0dFJ|yyǽgs{. $O./ 'z8WGб x 0Y驾A@$/7z HeOOҬT _lN:K"N3"$F/JPrb[䥟}Qd[Sl1x{#bG\NoX3I[ql2 $8xtr p/8pCfq.Knjm͠{r28?.)ɩL^6 g,qm"[Z[Z~Q7%" 3R `̊j[~ : w! $E}kyhyRm333: }=#vʉe tqX)I)B>== <8Xȉ9