Copy Selection as String

Compatibility: 4.2.3? - 5.0.1 - 5.0.2b20 - 5.1.2 - 6.0 - MacOS - Windows

It's often useful to copy a script, outline, or other item from the ODB as plain text, with some formatting to make it easier for people to read it. For scripts, this means omitting the tabs and curly brackets you get when you call string(script). For menus, this means including the menu items to all levels, but not the item scripts. For other structured types, such as rects and points, it means applying some minimal formatting. Seth's script did what I wanted for scripts, but not for the other types, so I created my own.

  • GetEntryAsString(inEntryAdr), the workhorse. Returns scripts without the extra punctuation (curly brackets and semicolons), menus without the item scripts, formats rects, points, and rgbs like lists; specifically excludes tables, source-removed code, and unknownType items; and uses string(...) to get the string representation of everything else (e.g., outlines, wpTexts, etc.). Useful when called from web page. Also does line-ending substitution for cross-platform compatibility.

  • CopySelectionAsString(), called from the custom menu, calls GetEntryAsString() and places the result on the clipboard.

I have embedded the above script(s) in this page as mimi data. To retrieve the script(s), either (1) View Frame Source in your browser and copy the mimi blocks, (2) save the page as source text and import it using the Mimi->Import From File command, or (3) (if you are on a Mac) select Mimi->Web Page->Import From Web Page.

Copyright © 1998, 1999 by Samuel Reynolds. All rights reserved. Last modified 1999/05/19.
Built with Frontier v.6.0 on Macintosh OS 8.1 on 1999/05/23.