|
From: Todd N. <osx...@ya...> - 2005-02-17 22:11:12
|
Hello to you all! I just found one of the coolest apps since TickleServices now available in Beta, and it is called BellHop (formerly Concierge). BellHop is available at www.versiontracker.com, and is a very nice Scriptable Services system which comes stock with AppleScript Context and Ruby Context Support. I am currently working on making the SenseTalk Context available. In the mean time I have found this little standard new file script usable with SeaShell utilizing the Services Menu item once BellHop is installed. I think you will find the combination of SeaShell and BellHop a very pleasing experience. You can write SenseTalk scripts and use them to filter your text in your SeaShell documents (new doc text, comment addition and removal, so forth). Regards Todd Nathan #! /usr/bin/st # # Thu Feb 17 15:49:43 CST 2005 # Copyright (c) 2005, Todd Nathan. All Rights Reserved. # # Filename: newstdoc # Description: Output a standard file with copyright information, used either in # CLI and Terminal, or with the BellHop application (wonderful tool # inspired by TickleServices in NS 3.x). # Dependencies: There are no dependancies # get chars 1 to -2 of shell("date") put parseParams(the params, "") into opt if usage is in the keys of opt then usage if help is in the keys of opt then usage if d is not in the keys of opt or \ -- creation date opt's d is EMPTY then put it into opt's d if h is not in the keys of opt or \ -- copyright holder opt's h is EMPTY then put "<<Copyright Holder Here>>" into opt's h if y is not in the keys of opt or \ -- copyright year opt's y is EMPTY then put last word of it into opt's y -- copyright year if n is not in the keys of opt or \ -- file name opt's n is EMPTY then put "Run_Handler_Name" into opt's n -- file name put "-- " & item 1 of opt's d put "-- Copyright (c) " & item 1 of opt's y & ", " & item 1 of opt's h & ". All Rights Reserved." put "--" put "-- Filename: " & item 1 of opt's n & ".st" & space put "-- Description: Object Description" put "-- Dependancies: Other Objects/Files Used " put "--" put "" get item 1 of opt's n put "to " & it & "()" put " // your code wonderments here!" put "end " & it put "" put "to fName p1, p2" put " // your function code here" put " return ( aValue )" put "end fName" put "" to usage put short name of me & " -d date -h holder -y year -n filename" exit to sensetalk end usage to parseParams params, rules -- 'rules' support is coming real soon now :) put a new object into obj delete word 1 of params -- toss the handler name set the itemDelimiter to "-" delete item 1 of params -- assume params starts with '-', all filenames at end of CLI repeat with each item option of params set the itemDelimiter to "," put deQuote(item 1 of option) into key -- the key put () into vals repeat with n = 2 to number of items in option get deQuote(item n of option) -- the value if it is empty then next repeat -- likely end of option list insert it after vals end repeat put obj plus properties ((key):(vals)) into obj -- why doesn't merge|replace existing values of key? end repeat return obj end parseParams to deQuote string -- Removes all leading space and quotes of a string, returns that string repeat length of string times -- do leading junk and ... if first char of string is not in quote & space then exit repeat delete first char of string end repeat repeat length of string times -- ... do junk in trunk if last char of string is not in quote & space then exit repeat delete last char of string end repeat return string end deQuote __________________________________ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 |