#!/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 "$@" = AskDialog 2 2 Managing Ask 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 cREVGeneral debugObjects pon 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 end preOpenCard ------------------------------------ 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 put fld "Text" into tPrompt repeat with i = 1 to the number of lines of tPrompt put quote & 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 & "ask" && the hilitedButtonName of grp "radio" && "tPrompt" after tPrompt if fld "Default" <> empty then put " with" && quote & fld "Default" & quote after tPrompt 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 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 o$ً0.u bookmarks handlerList ZpreOpenStack preOpenCard rawKeyUp BuildCode revColorScript revSetupColors AnswerFramedPagetempScript prevHandler rawKeyUpscriptSelection char 175 to 174script >
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
end preOpenCard
------------------------------------
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
put fld "Text" into tPrompt
repeat with i = 1 to the number of lines of tPrompt
put quote & 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 & "ask" && the hilitedButtonName of grp "radio" && "tPrompt" after tPrompt
if fld "Default" <> empty then put " with" && quote & fld "Default" & quote after tPrompt
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
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 6 ' = Show Dialog Ep on mouseUp do fld "Script" if it = empty then put "it variable is empty" else put "it variable contains:" && it end mouseUp d cREVGeneral scriptChecksum u]~pp:GhandlerList mouseUpbreakPoints scriptSelection char 76 to 75revUniqueID 1113288937307 bookmarks tempScript prevHandler mouseUpscripton mouseUp
do fld "Script"
if it = empty then put "it variable is empty"
else put "it variable contains:" && it
end mouseUp
Script )h @ #KV cREVGeneral revUniqueID 1113288980608 (put "Enter your nickname:" into tPrompt @ blue $ 6ask info tPrompt with "Jimmy" titled "Login" as sheet @ blue @ brown @ blue 0 ` 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