Grasshopper sharing friendly clipboard (just like like Max/MSP)

My journey in VPL started with Max/MSP and, just like Grasshopper, patches/definitions are saved as properly formatted text. In both software, when you copy portions of code from the canvas you just end up with a lot of this unhandy text in the clipboard. The nice thing in Max is that you can copy in clipboard a compressed version of this text that can easily shared just by pasting in a mail, forum or even in a chat if you are working with someone.

As a simple example: this is just an “Hello cat!” panel in grasshoppr that you can copy and paste in yout canvas…

Uncompressed Text
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Archive name="Root">
  <!--Grasshopper archive-->
  <!--Grasshopper and GH_IO.dll are copyrighted by Robert McNeel & Associates-->
  <!--Archive generated by GH_IO.dll file utility library {0.2.0002}-->
  <items count="1">
    <item name="ArchiveVersion" type_name="gh_version" type_code="80">
      <Major>0</Major>
      <Minor>2</Minor>
      <Revision>2</Revision>
    </item>
  </items>
  <chunks count="1">
    <chunk name="Clipboard">
      <items count="1">
        <item name="plugin_version" type_name="gh_version" type_code="80">
          <Major>1</Major>
          <Minor>0</Minor>
          <Revision>8</Revision>
        </item>
      </items>
      <chunks count="5">
        <chunk name="DocumentHeader">
          <items count="5">
            <item name="DocumentID" type_name="gh_guid" type_code="9">4197fb57-f306-4ac5-a76d-340d398fb6a3</item>
            <item name="Preview" type_name="gh_string" type_code="10">Shaded</item>
            <item name="PreviewMeshType" type_name="gh_int32" type_code="3">1</item>
            <item name="PreviewNormal" type_name="gh_drawing_color" type_code="36">
              <ARGB>100;150;0;0</ARGB>
            </item>
            <item name="PreviewSelected" type_name="gh_drawing_color" type_code="36">
              <ARGB>100;0;150;0</ARGB>
            </item>
          </items>
        </chunk>
        <chunk name="DefinitionProperties">
          <items count="4">
            <item name="Date" type_name="gh_date" type_code="8">638539147360474675</item>
            <item name="Description" type_name="gh_string" type_code="10"></item>
            <item name="KeepOpen" type_name="gh_bool" type_code="1">false</item>
            <item name="Name" type_name="gh_string" type_code="10"></item>
          </items>
          <chunks count="3">
            <chunk name="Revisions">
              <items count="1">
                <item name="RevisionCount" type_name="gh_int32" type_code="3">0</item>
              </items>
            </chunk>
            <chunk name="Projection">
              <items count="2">
                <item name="Target" type_name="gh_drawing_point" type_code="30">
                  <X>743</X>
                  <Y>117</Y>
                </item>
                <item name="Zoom" type_name="gh_single" type_code="5">2</item>
              </items>
            </chunk>
            <chunk name="Views">
              <items count="1">
                <item name="ViewCount" type_name="gh_int32" type_code="3">0</item>
              </items>
            </chunk>
          </chunks>
        </chunk>
        <chunk name="RcpLayout">
          <items count="1">
            <item name="GroupCount" type_name="gh_int32" type_code="3">0</item>
          </items>
        </chunk>
        <chunk name="GHALibraries">
          <items count="1">
            <item name="Count" type_name="gh_int32" type_code="3">1</item>
          </items>
          <chunks count="1">
            <chunk name="Library" index="0">
              <items count="4">
                <item name="Author" type_name="gh_string" type_code="10">Robert McNeel &amp; Associates</item>
                <item name="Id" type_name="gh_guid" type_code="9">00000000-0000-0000-0000-000000000000</item>
                <item name="Name" type_name="gh_string" type_code="10">Grasshopper</item>
                <item name="Version" type_name="gh_string" type_code="10">8.7.24138.15431</item>
              </items>
            </chunk>
          </chunks>
        </chunk>
        <chunk name="DefinitionObjects">
          <items count="1">
            <item name="ObjectCount" type_name="gh_int32" type_code="3">1</item>
          </items>
          <chunks count="1">
            <chunk name="Object" index="0">
              <items count="2">
                <item name="GUID" type_name="gh_guid" type_code="9">59e0b89a-e487-49f8-bab8-b5bab16be14c</item>
                <item name="Name" type_name="gh_string" type_code="10">Panel</item>
              </items>
              <chunks count="1">
                <chunk name="Container">
                  <items count="8">
                    <item name="Description" type_name="gh_string" type_code="10">A panel for custom notes and text values</item>
                    <item name="InstanceGuid" type_name="gh_guid" type_code="9">23fa6376-8cf1-4eb9-83a2-6d44246a04b6</item>
                    <item name="Name" type_name="gh_string" type_code="10">Panel</item>
                    <item name="NickName" type_name="gh_string" type_code="10"></item>
                    <item name="Optional" type_name="gh_bool" type_code="1">false</item>
                    <item name="ScrollRatio" type_name="gh_double" type_code="6">0</item>
                    <item name="SourceCount" type_name="gh_int32" type_code="3">0</item>
                    <item name="UserText" type_name="gh_string" type_code="10">Hello cat!</item>
                  </items>
                  <chunks count="2">
                    <chunk name="Attributes">
                      <items count="6">
                        <item name="Bounds" type_name="gh_drawing_rectanglef" type_code="35">
                          <X>44</X>
                          <Y>7</Y>
                          <W>160</W>
                          <H>100</H>
                        </item>
                        <item name="MarginLeft" type_name="gh_int32" type_code="3">0</item>
                        <item name="MarginRight" type_name="gh_int32" type_code="3">0</item>
                        <item name="MarginTop" type_name="gh_int32" type_code="3">0</item>
                        <item name="Pivot" type_name="gh_drawing_pointf" type_code="31">
                          <X>44.5</X>
                          <Y>7</Y>
                        </item>
                        <item name="Selected" type_name="gh_bool" type_code="1">true</item>
                      </items>
                    </chunk>
                    <chunk name="PanelProperties">
                      <items count="7">
                        <item name="Colour" type_name="gh_drawing_color" type_code="36">
                          <ARGB>255;255;250;90</ARGB>
                        </item>
                        <item name="DrawIndices" type_name="gh_bool" type_code="1">true</item>
                        <item name="DrawPaths" type_name="gh_bool" type_code="1">true</item>
                        <item name="Multiline" type_name="gh_bool" type_code="1">true</item>
                        <item name="SpecialCodes" type_name="gh_bool" type_code="1">false</item>
                        <item name="Stream" type_name="gh_bool" type_code="1">false</item>
                        <item name="Wrap" type_name="gh_bool" type_code="1">true</item>
                      </items>
                    </chunk>
                  </chunks>
                </chunk>
              </chunks>
            </chunk>
          </chunks>
        </chunk>
      </chunks>
    </chunk>
  </chunks>
</Archive>

…and this is the same code compressed with the first online gzip tool I found (zickty.com) that you can decode and past in canvas.

Compressed Text
H4sIAAAAAAAAA8VZW3ObOBR+76+gPOwbDpiL8cShkyYzTmZzGydtk33pCBC2WhkxQrj1dPa/r8A3QAKT2O2mUwdL4tP3HZ1zdKSMPvycY2UBaYpIfKYaPV1VYByQEMXTMzVjkeaqSspAHAJMYnimLmGqfvDejc5pMEMLqMRgzlsnhDDVe6coo/eaNqYgTWckSSBVwGqYpkk741AZX329vu+FGPOhUAlIsqRoOmMwVPylMiE+pEy5De4g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H+ZVGAMe7JWxd1r4ZAcccOJobRIZmQX+ouSboa05oWX3LAbrlO13nPs7SSnBR8P2gUlcOe1+sk3iCe1U5LgN+DCjBeAI4vFAOksyvVVtOY7UiQSYZDeDBZZAI/CmF9Il7W0cTX0GMiRIA9r55goYQLbqqYSpLUbthmy2acSp+xqBYSFYEbVHFw61c+kc+PEyb6nbKcy3IK+Soatv61UkN/9mzrIYafjvmxZNX8qUhXzzD4Wv4pXXQVX5eH51ctcht8YKiv2SOW36MQfENjI7gYXLsSX4L+rvAn0hyfOgHtCDtJ7uad8g2nhJ07h09+1D/eI2CpsshWa5jNGtNda2h3XAc3HZWjt75JtBwAyQI2cb1oGNcXxDMs+VBt2EV6OIerG/bp6v/+ulQejkm2qkb3UtO7DoOUQCFXPS2RRLhHwCb/Rbw2wznf4aIhR36GOCPCeQnK3zB3+9Efu9WLUzAKATCvchRoL9QIKSjPxty4jlpz0vyF95yAqsOKHXuOngArf765P0HovZE1q4bAAA=

Max forum (cycling74) is also designed to easily copy and paste those bits of compressed code and it is really handy.
I suspect it shouldn’t be terribly hard to implement this in grasshopper (surely easier than adding the panic button or solving the problem of keyboard input sended to rhino instead to be kept in grasshopper), and I think it would be great to grow the community.

What’s your opinion?