The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Speaking of scripting

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Speaking of scripting Posted: Jun 12, 2005 6:15 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Speaking of scripting
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

BottomFeeder includes a workspace that allows scripting - but it's deeper than that. If you save your script to file called .btfrc and put it in the same directory as the image (or exe), it will get filed in at startup. For instance, I just had one of the IRC regulars ask me about a change to the localhost server that Bf runs. If you hit this url - http://localhost:8666/btf - while Bf is running, it will give you a list of your subscriptions, along with the top five items. Well, what if you wanted only the new items? Simple enough, if you have a small change to one method:


printHtmlOn: aStream

	(self link isNil or: [self link isEmpty])
		ifFalse: [
			aStream
				nextPutAll: '<a href="';
				nextPutAll: self link;
				nextPutAll: '">'.
		].
	aStream nextPutAll: self title.
	(self link isNil or: [self link isEmpty])
		ifFalse: [
			aStream nextPutAll: '</a>'.
		].
	(self items notNil and: [self items notEmpty])
		ifTrue: [| toPrint |
				toPrint := self allNewItems.
				aStream nextPutAll: '<ul>'.
				toPrint do: [:each | 
							aStream cr.
							aStream nextPutAll: '<li>'.
							each printHtmlOn: aStream].
				aStream nextPutAll: '</ul>'.
				aStream cr].
	aStream 
		nextPutAll: '<br/>'; 
		cr

The only change was in the line: toPrint := self allNewItems. That had explicitly grabbed the top five before. Now, you do need to know the Bf API to make this sort of change. However, the cool thing is that it doesn't need to be a one-off effort. I've used this feature myself, and I know a few other people who have as well. The nice thing is that I didn't have to go out of my way to add scripting support to the application - it just happened. In fact, I wasn't even the first person to notice :)

Read: Speaking of scripting

Topic: New How-To Documents available! Previous Topic   Next Topic Topic: Meeting Follies

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use