<snapdata remixID="8055561"><project name="files" app="Snap! 7, https://snap.berkeley.edu" version="2"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAABy0lEQVR4nO3SoY0iUABF0akNkARI8JQAVSBQFEAbExIcngooA434q3aSFcPIm2HPSZ5/4n4MCH3UB/i/CZCUAEkJkJQASQmQlABJCZCUAEkJkJQASQmQlABJCZCUAEkJkJQASQmQlABJCZCUAEkJkJQASQmQlABJCZCUAEkJkJQASQmQlABJCZCUAEkJkJQASQmQlABJCZCUAEkJkJQASQmQlABJCZCUAEkJkJQASQmQlABJCZCUAEkJkJQASQmQlABJCZCUAL9xvV7H5XKpb7w9Ab4wn8/HarUas9ls7Pf7cb/f60tvR4AvPJ/PsVgsxmq1+tpyuRzr9Xocj8fxeDzqi7+eAH+w2Wz+CfDvJpPJOJ1O9b1fT4Av7Ha7r+Cm0+k4HA7jdrvVt96KAL/x+fk5ttvtOJ/P9ZW3JkBSAiQlQFICJCVAUgIkJUBSAiQlQFICJCVAUgIkJUBSAiQlQFICJCVAUgIkJUBSAiQlQFICJCVAUgIkJUBSAiQlQFICJCVAUgIkJUBSAiQlQFICJCVAUgIkJUBSAiQlQFICJCVAUgIkJUBSAiQlQFICJCVAUgIkJUBSAiQlQFICJCVAUgIkJUBSAiQlQFJ/AKz+sOuSJZpGAAAAAElFTkSuQmCC</thumbnail><scenes select="1"><scene name="files"><notes></notes><hidden></hidden><headers></headers><code></code><blocks><block-definition s="open binary file" type="reporter" category="sensing"><comment w="90" collapsed="false">Loads a raw file, where each character is a single byte. ASCII characters work the same both ways.</comment><header></header><code></code><translations></translations><inputs></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>https://space-elephant.github.io/snap-extensions/files.js</l></list></block><block s="doDeclareVariables"><list><l>finish</l></list></block><block s="doSetVar"><l>finish</l><block s="reportApplyExtension"><l>sav_upload()</l><list></list></block></block><block s="doWaitUntil"><block s="reportListItem"><l>1</l><block var="finish"/></block></block><block s="doReport"><block s="reportListItem"><l>2</l><block var="finish"/></block></block></script></block-definition><block-definition s="save %&apos;data&apos; as %&apos;filename&apos;" type="command" category="sensing"><comment w="90" collapsed="false">Saves a text file. Not quite sure how to save a binary file, feel free to modify it.</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%s">output.txt</input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>https://space-elephant.github.io/snap-extensions/files.js</l></list></block><block s="doApplyExtension"><l>sav_download(data, filename)</l><list><block var="data"/><block var="filename"/></list></block></script></block-definition><block-definition s="open text file" type="reporter" category="sensing"><comment w="185" collapsed="false">Decodes UTF-8 in a file, allowing it to be used as a text input. Should be identical to importing to a variable, although there may be more bugs or slower.</comment><header></header><code></code><translations></translations><inputs></inputs><script><block s="doDeclareVariables"><list><l>binary</l><l>result</l><l>index</l><l>remaining</l></list></block><block s="doSetVar"><l>binary</l><custom-block s="open binary file"></custom-block></block><block s="doSetVar"><l>result</l><block s="reportNewList"><list></list></block></block><block s="doSetVar"><l>index</l><l>1</l></block><block s="doSetVar"><l>remaining</l><l>0</l></block><block s="doUntil"><block s="reportGreaterThan"><block var="index"/><block s="reportStringSize"><block var="binary"/></block></block><script><block s="doIfElse"><block s="reportGreaterThanOrEquals"><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block><l>128</l></block><script><block s="doIfElse"><block s="reportGreaterThanOrEquals"><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block><l>192</l></block><script><block s="doIf"><block s="reportGreaterThan"><block var="remaining"/><l>0</l></block><script><custom-block s="error %txt"><block s="reportJoinWords"><list><l>should have </l><block var="remaining"/><l> continuations: </l><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block><l> is start</l></list></block></custom-block></script></block><block s="doIfElse"><block s="reportGreaterThanOrEquals"><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block><l>224</l></block><script><block s="doIfElse"><block s="reportGreaterThanOrEquals"><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block><l>240</l></block><script><block s="doSetVar"><l>remaining</l><l>3</l></block><block s="doAddToList"><block s="reportModulus"><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block><l>8</l></block><block var="result"/></block></script><script><block s="doSetVar"><l>remaining</l><l>2</l></block><block s="doAddToList"><block s="reportModulus"><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block><l>16</l></block><block var="result"/></block></script></block></script><script><block s="doSetVar"><l>remaining</l><l>1</l></block><block s="doAddToList"><block s="reportModulus"><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block><l>32</l></block><block var="result"/></block></script></block></script><script><block s="doIfElse"><block s="reportGreaterThan"><block var="remaining"/><l>0</l></block><script><block s="doReplaceInList"><l><option>last</option></l><block var="result"/><block s="reportVariadicSum"><list><block s="reportVariadicProduct"><list><block s="reportListItem"><l><option>last</option></l><block var="result"/></block><l>64</l></list></block><block s="reportModulus"><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block><l>64</l></block></list></block></block><block s="doChangeVar"><l>remaining</l><l>-1</l></block></script><script><custom-block s="error %txt"><block s="reportJoinWords"><list><l>nothing to continue with </l><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block></list></block></custom-block></script></block></script></block></script><script><block s="doIf"><block s="reportGreaterThan"><block var="remaining"/><l>0</l></block><script><custom-block s="error %txt"><block s="reportJoinWords"><list><l>should have </l><block var="remaining"/><l> continuations: </l><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block><l> is ASCII</l></list></block></custom-block></script></block><block s="doAddToList"><block s="reportUnicode"><block s="reportLetter"><block var="index"/><block var="binary"/></block></block><block var="result"/></block></script></block><block s="doChangeVar"><l>index</l><l>1</l></block></script></block><block s="doReport"><block s="reportJoinWords"><block s="reportUnicodeAsLetter"><block var="result"/></block></block></block></script></block-definition><block-definition s="safely try %&apos;action&apos; then if %&apos;error&apos; %&apos;handler&apos;" type="command" category="control"><comment x="0" y="0" w="276" collapsed="false">Catch errors.&#xD;&#xD;Runs the first script.  If it succeeds, nothing else happens.&#xD;But if it has an error (something that would otherwise result&#xD;in a red halo around the block), then the second script is run,&#xD;with the text of the error message that would have been shown in the variable ERROR.</comment><header></header><code></code><translations>pt:tenta executar _ e, em caso de erro _ , executa _&#xD;ca:prova de forma segura _ i si _ _&#xD;</translations><inputs><input type="%cs"></input><input type="%upvar"></input><input type="%cs"></input></inputs><script><block s="doApplyExtension"><l>err_try(cmd, catch, err)</l><list><block var="action"/><block var="handler"/><block var="error"/></list></block><block s="doApplyExtension"><l>err_reset</l><list></list></block></script></block-definition><block-definition s="error %&apos;msg&apos;" type="command" category="control"><comment x="0" y="0" w="268.6666666666667" collapsed="false">Throw an error.&#xD;&#xD;Makes a red halo appear around the script that runs it,&#xD;with the input text shown in a speech balloon next to&#xD;the script, just like any Snap! error.&#xD;&#xD;This is useful to put in the second script of SAFELY TRY&#xD;after some other instructions to undo the partial work of&#xD;the first script.</comment><header></header><code></code><translations>pt:lança o erro _&#xD;</translations><inputs><input type="%txt"></input></inputs><script><block s="doApplyExtension"><l>err_error(msg)</l><list><block var="msg"/></list></block></script></block-definition><block-definition s="safely try reporting %&apos;this&apos; then if %&apos;error&apos; report %&apos;that&apos;" type="reporter" category="control"><comment x="0" y="0" w="316.6666666666667" collapsed="false">Catch errors in a reporter.&#xD;&#xD;Evaluates its first input.  If that expression successfully reports a value, this block reports that value.  If the expression causes a Snap! error,&#xD;then the final input slot is evaluated with the text of what would have&#xD;been the error message in variable ERROR.  SAFELY TRY then reports the value of that final expression.&#xD;&#xD;Sometimes you&apos;ll want to throw an error in the final expression.  You&#xD;can put an ERROR block inside a CALL block to do that.</comment><header></header><code></code><translations>ca:prova de forma segura reportant _ i si _ reportant _&#xD;</translations><inputs><input type="%anyUE"></input><input type="%upvar"></input><input type="%anyUE"></input></inputs><script><block s="doDeclareVariables"><list><l>value</l></list></block><custom-block s="safely try %cs then if %upvar %cs"><script><block s="doSetVar"><l>value</l><block s="evaluate"><block var="this"/><list></list></block></block></script><l>err</l><script><block s="doSetVar"><l>error</l><block var="err"/></block><block s="doSetVar"><l>value</l><block s="evaluate"><block var="that"/><list></list></block></block></script></custom-block><block s="doReport"><block var="value"/></block></script></block-definition></blocks><stage name="Stage" width="480" height="360" costume="0" color="255,255,255,1" tempo="60" threadsafe="false" penlog="false" volume="100" pan="0" lines="round" ternary="false" hyperops="true" codify="false" inheritance="true" sublistIDs="false" id="340"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAACtUlEQVR4nO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+Bo3+AAF/RMkcAAAAAElFTkSuQmCC</pentrails><costumes><list struct="atomic" id="341"></list></costumes><sounds><list struct="atomic" id="342"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites select="1"><sprite name="Sprite" idx="1" x="0.5570291777178227" y="-0.39787798408474373" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="80,80,80,1" pen="tip" id="347"><costumes><list struct="atomic" id="348"></list></costumes><sounds><list struct="atomic" id="349"></list></sounds><blocks></blocks><variables></variables><scripts><script x="20" y="20"><block s="receiveGo"></block><custom-block s="save %s as %s"><block s="reportJoinWords"><list><custom-block s="open text file"></custom-block><l>;</l></list></block><l>output.txt</l></custom-block></script><script x="297" y="115.00000000000011"><custom-block s="open text file"></custom-block></script><script x="293" y="157.16666666666674"><custom-block s="open binary file"></custom-block></script></scripts></sprite></sprites></stage><variables></variables></scene></scenes></project><media name="files" app="Snap! 7, https://snap.berkeley.edu" version="2"></media></snapdata>