FB Osax

The Download Stuffit Archive (578.9 KB) were part of the long-lost Download Stuffit Archive (158.7 KB). They are left here purely for historical purposes, and for those people still using OS 9.

FB Case

  • FB Case string to case change ignoring case

Changes the case of the string. You can change to “uppercase”, “lowercase”, “sentence”, or “title”. Uppercase and lowercase change the entire string to upper or lower case. “Sentence” changes the string to lowercase, except for characters following “!”, “.”, or “?”, which it changes to uppercase. “Title” does the same, but also changes characters following “ ” to uppercase.

For both “sentence” and “title”, you can specify “ignoring” either uppercase or lowercase.

Examples

  • FB Case "Thursday" to uppercase becomes THURSDAY
  • FB Case "Wednesday" to lowercase becomes wednesday
  • FB Case "he unlocks the suitcase" to title becomes He Unlocks The Suitcase
  • FB Case "the doorbell rings. you open the door! Dave Sayer greets you." to sentence becomes The doorbell rings. You open the door! Dave sayer greets you.
  • FB Case "the doorbell rings. you open the door! Dave Sayer greets you." to sentence ignoring uppercase becomes The doorbell rings. You open the door! Dave Sayer greets you.

FB Chop

  • FB Chop string from starting number or character to ending number or character
  • FB Chop string from starting number or character for number of characters
  • FB Chop string at string with or without empties

Returns the part of the string as specified. If you leave out starting number, it defaults to 1. If you leave out ending number (and don’t use for), it defaults to the length of the string.

If you use negative numbers, they act as “wraparounds”. “From -1” or “to -2” means, “from the last character”, or “to the 2nd to last character”. “For -1” gets one character--this one, and one character back from the end of this one. “For -2” gets two characters--this one, and the character before this one. No matter how you slice them, however, the characters remain in the correct, forward order.

The third syntax can be used alone, or in conjunction with one of the first two. It chops the string into a list, using the “at” string as the delimiter. If you specify “with” empties, empty items are kept. Normally, they will be discarded.

Examples

  • FB Chop "Darcy Farrow" to space becomes "Darcy"
  • FB Chop "Darcy Farrow" from space becomes "Farrow"
  • FB Chop "Welcome to my nightmare" from -1 becomes “e”
  • FB Chop "Welcome to my nightmare" at "to" becomes {"Welcome "," my nightmare"}
  • FB Chop "Heaven's Angels" from 3 to 9 becomes "aven's "
  • FB Chop "This is a total crock." from "s" to "t" becomes “ is a ”

Combinations other than the above four will do wondrous things, but aren’t necessarily guaranteed. For example, FB Chop "This is a total Crock." from space at space will produce {"is","a","total","Crock."}. Chopping of the string occurs before chopping the string into items.

FB DateNumber

  • FB DateNumber of a weekday or month or number in language or in the native tongue

Returns a numeric equivalent for months and weekdays. For example,

  • get FB DateNumber of the weekday of the current date

returns “1” if today is a Sunday (yes, mighty Christian of me, I know), up to “7” if today is a Saturday. Likewise for months,

  • get FB DateNumber of the month of date SomeDateYouGot

will return “1” if the month that the date falls into is January, up to “12” if the date falls in December.

This only works with actual “date”-type dates. It won’t work if you try to get the DateNumber of a string. You can get the DateNumber of Wednesday, March, etc., if you leave the quotes out:

  • get FB DateNumber of Wednesday in the native tongue
  • get FB DateNumber of December

If you add in something, it returns a string, usually in another language. Currently fully supported are English, French, German, and Spanish, because those are the ones I happen to know. Weekdays are also available for “the original” (which ends up being the planets associated with the weekdays), and Assyrian. If you have any other languages you would like supported, modern or archaic, give me the equivalents and I’ll put them in. If they don’t conform to the 12-month year/7-day week, it will help if you let me know how your Macintosh handles those forms.

Most of the time, however, you’ll probably want to use in the native tongue, which returns the weekday or month according to the currently selected language. If they’ve selected Swiss German, it will return it in Swiss German, whether I support it or not (go ahead and try it: you can change the selected language from the Date and Time control panel).

You can also give it numbers, and it will convert them to weekdays or months. It “wraps around”, so that if you ask for the 8th day of the week, you get Sunday, and the 26th month of the year is February.

  • get FB DateNumber of 25 converting to month in Spanish

When asking with a number, it assumes you want the native tongue unless you say otherwise.

FB Glue

  • FB Glue list with string at the front, the back or both ends

Glue takes a list and puts it back together as a string. It puts the “” string between each item (and at the front and/or back, if you specify that). It skips over any non-string items, and does not currently flatten out nested lists--lists inside the list get ignored.

If the list is a completely empty list, an empty string is always returned. FB Glue {} with "," at both ends is “”. FB Glue {""} with "," at both ends is “,,”.

  • get FB Glue {"Charles",23,"John Wayne",29,"Diane",1932,"Elizabeth",{"Four","zero"},"Adolph",1.0E+6} with "<==>" at both ends

returns "<==>Charles<==>John Wayne<==>Diane<==>Elizabeth<==>Adolph<==>"

FB Index

  • FB Index of item in list at the front, the back, or the whole thing with/without case sensitivity

Returns the location of item in the list. The item can be a string, a number, or even another list.

  • get FB Index of 33 in {1,2,3,33}
  • get FB Index of {1,2} in {"Hello","Goodbye",1,{1,2,3},{1,2}}
  • get FB Index of "Mary" in {"Jan","Kathleen","Mary","Maryann"}

returns 4,5, and 3 respectively.

If the item doesn’t exist in the list, FB Index of returns 0.

When looking for a string within a list of strings, you can tell it "without case sensitivity" to ignore case, and tell it to look at "the front", "the back", or "the whole thing", to check for substrings. Those options only work when looking for strings within lists of strings.

  • get FB Index of "Mary" in {"Janice Tower","Mary Bell", "Harvey Mudd"} at the front
  • get FB Index of "Tower" in {"Janice Tower","Mary Bell","Harvey Mudd"} at the back
  • get FB Index of "ten" in {"Five-Ten Variety","Hi Grocery"} at the whole thing without case sensitivity

returns 2, 1, and 1 respectively.

FB Internal

  • FB Internal of item pretending to be a class appending item prepending item

Returns a string of the characters of the internal representation of the item, as passed via appleevents to osaxen. If you get the FB Internal of a string, you just get the string back. FB Internals of lists and records are more interesting.

With "pretending to be a", you can get lists as strings, and then convert them back to lists again (for example). Be very careful when pretending! I have no doubt that you can easily crash your computer, destroy your hard drive, and call forth Cthulhu when using "pretend to be a".

"Prepending" puts the item you specify at the front of what you get back. Most useful for looking at "styled" text--it’s still a string, but if you prepend an arbitrary character, it’ll confuse AppleScript enough to show you the style info. I see no purpose at all for "append", but it’s there to balance out "prepend".

FB Replace

  • FB Replace string with string in string

Replaces every occurence of "string" with the "with" string, in the "in" string. For example

  • FB Replace "Hello" in "Hello, Dolly, Hello" with "Goodbye"

produces "Goodbye, Dolly, Goodbye".

FB Search

  • FB Search for regular expression in string using delimiter character returning the linetext, linecount, linelist, or linenumbers with or without matches

Looks in the string for the regular expression. The default delimiter is "return". Only single characters can be delimiters. If you give a larger string, only the first character is used. "With or without matches" tells FB Search to return lines that match (with) or lines that don’t match (without).

You can tell FB Search to return the matches as a string (linetext), as a list of strings (linelist), or as a list of paragraph numbers (linenumbers). You can also tell it to return the number of matches instead of the matches themselves (linecount).

This is basically a grep. The grep code itself comes from a Unix grep that I got off the net about 10 years ago, and it was already unattributed. It is currently always case insensitive. Regular expressions supposedly supported:

xAn ordinary character (not mentioned below) matches that character.
\The backslash quotes any character. \$ matches a dollar-sign.
^A circumflex at the beginning of an expression matches the beginning of a line.
$A dollar-sign at the end of an expression matches the end of a line.
.A period matches any character except new-line.
:A colon matches a class of characters described by the following character. :a matches any alphabetic, :d matches digits, :n matches alphanumerics, :space matches spaces, tabs, and other control characters, such as new-line.
*An expression followed by an asterisk matches zero or more occurrances of that expression: fo* matches f, fo, foo, etc.
+An expression followed by a plus sign matches one or more occurrances of that expression: fo+ matches fo, etc.
-An expression followed by a minus sign optionally matches the expression.
[]A string enclosed in square brackets matches any character in that string, but no others. If the first character in the string is a circumflex, the expression matches any character except new-line and the characters in the string. For example, [xyz] matches xx and zyx, while [^xyz] matches abc but not axb. A range of characters may be specified by two characters separated by -. Note that, [a-z] matches alphabetics, while [z-a] never matches.
The concatenation of regular expressions is a regular expression.

For example, FB Search for "^[^ ]*@acusd.edu" in UserList returning the linelist will return a list of all users whose addresses are at USD, assuming that the "UserList" begins with e-mail addresses and there is a space after any e-mail address that contains comments or other information.

FB Trim

  • FB Trim list from string at location

Trims characters off the end or beginning of a string. In a fit of drug-crazed programming fury, you can also trim characters off the middle. The "at" locations can be the front, the back, both ends, and the whole thing. It defaults to both ends. For example,

  • get FB Trim {space,"-"} from " This is the end of the inno-"

will return "This is the end of the inno". On the other hand,

  • get FB Trim {space,"-"} from " This is the end of the inno-" at the whole thing

will return "Thisistheendoftheinno", which probably isn’t very useful, but isn’t it nice to know you can do it?

FB Unstylish

  • FB Unstylish of string

Takes styled text and returns unstyled text. Originally written because I didn’t know how to tell Hypercard not to send me styled text. Now that I’ve figured it out, I’m not sure what use this osax is, but there you are.

Details

The osax are provided as both 68k and PPC native. If you’re interested in critiquing or learning from the source, the Codewarrior 9 projects are available. You might also want to take a look at Everything I Know About AppleEvents, which isn’t much, but it might save you some time that I had to waste.

Licensing

Individual
If you are a registered user of either FireShare or the Negative Space Collection, you may use these osaxen in your own personal projects. You cannot distribute the osaxen yourself: you must tell the user(s) in words to use their web browser and come to http://www.hoboes.com/ and follow the links from “Neon Alley” to “Negative Space Collection”.
Freeware and Shareware Distribution
If your software is freely accessible, freely usable, and freely distributable on the Internet, you may purchase a license for your users, for $25. This covers any and all users of the freely accessible, freely usable, freely distributable software. They may use these osaxen with your package, without becoming registered users of either FireShare or the Negative Space Collection. You must include a licensing message of my own device within your standard “readme” file. I’ll give it to you on registration. You must also provide Negative Space/Jerry Stratton with a complimentary licensed copy of any software for which the license applies. Your license may apply to any Freeware/Shareware (as defined above) which you personally create.
Commercial Software Distribution
If your software is commercially available, either on the Internet with timed use, crippled features, whatnot, or as packaged software, or whatever else pretty much isn’t covered under the above definition of Freeware and Shareware, you may purchase a license for your users, for $100. You must include a licensing message of my own device within your manual and on-line documentation, should they exist, and you must provide Negative Space/Jerry Stratton with a complimentary licensed copy of the software for which the license applies. The license applies to only one package.