See the case study for the rationale behind this suite.
suites.Simple *Copyright* *Modified* *ReadMe* *See Also* *Version* character isLetterOrDigit isDigit isWhitespace isLetter isLower isUpper clipboard getText setText setValue clock beginTimer endTimer secondsToString time today todayString date getThe dialog askQuestion getFile getFolder getApplication getRealNumber getString getInteger file copyItem getCreated getCreatedModified getCreator getModified getType getTypeCreator getUniqueName listFilesInFolder newTextFile outlineFolder parentFromPath readTextFile renameUnique setCreatedModified setTypeCreator surePath touch touchFolder touchParent visitFolderFiltered writeTextFile list *see* append countItems log begin edit end insert insertDirection insertError purge show lookup *ReadMe* constantsByValue [snip] sizeOScript Meridianits *ReadMe* [snip] scriptTableByType mbar optx scpt tabl pict wptx math min max round message moreConstants ff vtab object *See Also* copy copyToTable getSize getTable getType getName getValue newObject rename renameUnique exists setPreferences op collapseToParent copyNLevels deleteDups getLevel getSubs getText goToParent hasSubs insertLeft inTextMode isComment lastSummit lineIsEmpty listToOutline makeComment move moveLine newOutline setTextMode sureOutline unComment visitFlat visitThisLevel preferences *ReadMe* *SeeAlso* collapseVerbOutlines columnTwoSpacing forceTextMode importOSAFolder newScriptAtStartup newScriptWithNewProject scriptSpaceBeforeOn scriptTextCommentChar scriptTextCopyAll scriptTextSpaces scriptTextUnwrap showTableOnNewNote showTableOnNewScript stampNewOutlines stampNewScripts stampNewWPText useTemplateForNewScript verbPrompt verbPromptWhenEmpty script *See Also* copyText getComment newScript openOSAScript pasteText setComment search findNextSelected quickFind promptReplaceAll replaceAllInTarget selection get getBounds getText quoteWith set setBounds setText unQuote speaker meep meepMeep tick string append capitalize countLines deleteAll dropFirstField dropLastField errorIf255 fillLeading fillLeadingZeros find firstChar firstField firstLine firstN hasComment insertAnywhere isDigit isDigit copy isLetterOrDigit isLetter isLower isUpper isWhitespace lastChar lastField lastLine lastN nthLine quoteIt quoteWith range replaceAllLists replaceAllPairs replicate stripNonDigit stripNonLetterOrDigit stripNonLetter stripSpaces stripWhitespace trim trimLeading trimSpaces trimTrailing trimTrailingString trimLeadingString trimWhitespace unQuote table *see also* compare copyAndRename countItems getName listItems nameFromPath newTable outlineTable setCursor sureTable tableFromPath visitItems visitItemsFiltered visitTablesFiltered window frontmostType zoomFrontmost wp insertLine newWPText sureWPText clear
***CaseStudy
or: how did the Simple suite come to be (and why does it have so many verbs?)
5/20/95, 1/27/96, 3/13/98
I think that Frontier is wonderful, and I could (and often do) extoll its virtues at great length. But it's not perfect. No product is! Although the recent focus is on website management, Frontier is and will always remain a powerful, general-purpose scripting tool. (And of course, they go together; the scripting is a vital part of automated websites.)
As the above date shows, I developed most of the "Powerfully Simple" suite ages ago. This case study shows one of my early struggles in some detail, illustrating why I developed the suite and showing some of the design principles: simpler verbs that do more work so the script writer can accomplish more with less effort (e.g. "op.newOutline"), more precise organization so it's easier to access the wealth of features that already exist (e.g. a new "selection" category), more consistent verbs names (e.g. a "get" for every "set") and a simpler approach to common verbs by returning a value instead of passing an address (e.g. "Simple.dialog.getFile" and new clipboard verbs).
This document may sound critical, and I admit to having very high expectations of software. Perhaps it is difficult to distinguish, but I intend the tone to convey the frustration I felt during the struggle, not to stand as harsh intellectual criticism. The fact that I could easily develop all these verbs and call them with the same ease as built-in verbs shows part of the true brilliance of Frontier's design.
---
One of the features that I've always wanted in a word processor, and certainly in a script editor, is the ability to quote & unquote the current selection. (I often type something, then go back and realize I should quote it.) With Frontier, I could write it myself, add it to the menu, and give it a command key. Cool!!! It was one of my first custom scripts.
Of course it's wonderful that Frontier gave me the *power* to add this feature, but it didn't make it easy. I think that Simple makes it easy. Let me take you on a little tour through different versions of the script. (I don't remember exactly how it developed, but I believe the following captures the essence of the process.)
The very first version of the script certainly included the functionality now in "Simple.string.quoteWith". The mere act of quoting is simply string manipulation that has nothing to do with the selection, so it was natural to move this feature to its own verb. I'll begin the tour right after that was moved.
The primary place I needed this feature was in the script editor, which is mostly controlled by the "op" verbs. Unfortunately, I didn't see any "op" verbs to manipulate the selected text. I found nothing in the "string" verbs, and there was no "text" or "selection" category. So, my first iteration just did a copy (once I found editMenu.copy), manipulated the clipboard text (once I figured out that clipboard.get didn't return the contents but took an address), and pasted. I still haven't discovered a way to save the entire clipboard (which may contain multiple datatypes), so even if I remembered to save the text, I still could have lost something. Clearly, that approach was not very satisfying.
Eventually (months later!), I stumbled across the selection verbs -- hidden in the "wp" category. Surprise! I also figured out that wp.insert also inserted text into an outline window. I had assumed that wp verbs were for wptext. I didn't dwell on my frustration for long, and replaced the clipboard strategy with the somewhat cryptic wp.getSelect (which doesn't get the selection, or "get" anything to return as a value: it takes 2 addresses as parameters), the matching wp.setSelect and wp.getSelText (a disappointing departure from Frontier's laudable policy of spelling out words in verb names).
As I used the feature regularly, I found that occasionally I had the entire headline of a script or outline selected, and wanted to quote it all. Sorry! Can t do wp.getselect2 because the target window is not in edit mode, or does not contain editable text. Somehow I figured out that dealing with edit mode in a script or outline was again handled with verbs mysteriously hidden in the wp category: wp.inTextMode and wp.setTextMode. Now I had to give my script different behavior for different types of windows.
Unfortunately, there is no verb for getting the type of the frontmost window. By this time, I had probably learned windowType = typeOf(window.frontmost()) in some other context, and used that. However, that approach only covers windows that represent valid addresses in the object database -- excluding scripts that are embedded in a menu item. I knew that Frontier could do a better job than my oneLiner, since the "modal" menus brought up the Script menu for menuscripts. Browsing the agents table led me to suites.modes.monitor, and a solution. I eventually learned that 2 other cases were left out: QuickScript and the main "Frontier.root" window.
Here's what started out as, and I believe ought to be, a simple script:
on quoteIt() \// quote the selection local windowType adr = window.frontmost() leftEdge = 0 rightEdge = 0if adr != "" \// a window is open [from suites.modes.monitor] if window.isMenuScript (adr) windowType = scripttype else if defined (adr^) windowType = typeOf (adr^) case windowType scriptType outlineType if not wp.inTextMode() \// e.g. entire headline is selected wp.setTextMode(true) \// leaves cursor at the end of the line editMenu.selectAll() \// i.e. the entire headline
wp.getSelect(@leftEdge, @rightEdge) wp.insert( Simple.string.quoteWith( wp.getSelText(), "2 ) ) wp.setSelect(leftEdge, rightEdge + 2) \// leave the new value selected
Here's the current script, using the Simple suite:
on quoteIt() \// quote the selection Simple.selection.set( Simple.string.quoteWith(Simple.selection.get(), "2) )
Note that if you add "Simple" to the paths table, you no longer need the "Simple" prefix. But, I think it's a useful reminder that the verbs are not part of the standard Frontier release.
As you can see, a single desired feature provided motivation (and early scripts) for many aspects of the Simple suite: new clipboard verbs, adding a verb cross reference (e.g. to look for "selection" by topic ... and see "select" and "sel" instead thanks to the alphabetical sort), new "op" verbs, a new window verb and a new "selection" verb category.
I've made so many additions to my Frontier.root, it would take me weeks to describe them all. In case anyone's curious, here are 2 custom menus -- the "SimpleInterface" suite. (Custom verbs are in a different message.) The "Help" menu is a bit dated...
Cool Duplicate Copy Special Copy Item Path Copy Window Path - Copy Script Text Copy Email List - Append to Clipboard Append Script Text TBD Paste Special Script Text Email List Clipboard Text Insert Folder Path File Path File Name File Creator File Type File Creator & Type - Timestamp Current Date & Time Current Date Current Time Date string Selection to Upper to Lower Capitalize - Count Characters Count Words Count Fields - Quote Quote With Unquote - Find Special Quick Find Find Next Selected Replace All in Window Export Special Export an Object Export a Table EXPORT FROM SCRATCHPAD? Export an OSA Script Export a Desktop Script Export a Droplet - New Outline New WP-text Open Text File - Goto Notes OneLiners QuickDebug Preferences SimpleInterface Prefs Log Files - Workspace Scratchpad - Agents Deskscripts Droplets - Startup scripts Shutdown scripts CGI scripts Apple Event handlers - Apps (glue scripts) Extensions - Threads Stack Edit Menus This Menubar Modal (Object) Menus Shared Menus - Send to BackHelp About Powerfully Simple - Verb List Cross Reference Lookup in DocServer Jump to - Release Notes Version 2 Version 2.1 Version 3.0 ReadMe Files (MS Word) Frontier 2.0 Frontier 3.0 Language Keywords Language Constants Index Tips etc. Overview Backing up Exporting Thanks To Grammar ASCII Character Set ASCII (outline) - Helptext table Simple Helptext table - UserLand Online Tech Support - Sample Scripts More Examples