!7 sS aiConcepts = #1006463; sS exportSnippetID; p { pcall-messagebox { try { doExport(); } catch e { if (containsIC(str(e), "Not your snippet")) { exportSnippetID = null; save("exportSnippetID"); doExport(); } else rethrow(e); } } } svoid doExport { useDataDirOf(aiConcepts); S text = loadConceptsStructure(aiConcepts); if (match("exportable=f", text)) fail("Non-exportable concepts found"); print(javaTokWordWrap(text)); print("Size: " + l(utf8(text))); print(); load("exportSnippetID"); if (empty(exportSnippetID)) { infoBox("Creating a snippet for you..."); exportSnippetID = createSnippet(text, "AI Concepts from " + computerID(), 53); infoBox("Your snippet ID: " + exportSnippetID); save("exportSnippetID"); } else { S oldMD5 = getSnippetMD5(exportSnippetID); S newMD5 = md5(text); if (eq(oldMD5, newMD5)) infoBox("Snippet " + exportSnippetID + " already up to date!"); else { infoBox("Updating snippet: " + exportSnippetID); editSnippet(exportSnippetID, text); S actualMD5 = getSnippetMD5(exportSnippetID); if (eq(actualMD5, newMD5)) infoBox("Export to " + exportSnippetID + " complete (" + n(lUtf8(text), "bytes") + ")."); else if (eq(actualMD5, oldMD5)) infoBox("Export failed for unknown reason"); else infoBox("Hm. Export did something, but MD5 mismatch occurred."); } } }