Articles 3D Audio Custom Controls General RB Graphics Hacks Mac OS X Menus Novelty Printing REALbasic 2005 REALbasic 2006 Registration Resources Reviews Serial Speech Sockets XML Video Resource Links News Current News February 2006 January 2006 December 2005 November 2005 October 2005 September 2005 August 2005 July 2005 June 2005 May 2005 April 2005 March 2005 ![]() REALbasic for Dummies by Erick Tejkowski ![]() Learning REALbasic through Applications REALbasic for Macintosh REALbasic Cross-Platform Application Development
Older files are in Stuffit 5 or greater format. Newer files are ".Zip". Download StuffIt Expander |
|
If you're an avid user of AOL Instant Messenger, you may often find yourself retyping some of the same messages and phrases daily. Poor typing skills don't improve the situation. What's an AIM geek to do? This week we'll create a simple REALbasic application, named AIM Mate, that can help alleviate some of the more mundane typing tasks of working with Instant Messenger. Our AIM Mate project will display a list of commonly used phrases and sentences as well as a list of buddies. With the click of a button, you will be able to send any text to whomever you wish. You'll never have to type "LOL" or "BRB" again! Build the Interface Create a new REALbasic project and open Window1. Add two Listboxes and a PushButton to the window:
You can arrange the interface however you wish, but to give you an idea of where we are going with this, here's a sample:
For the sake of convenience, it would also be good to change the Frame property of Window1 to Global Floating Window. This makes the window float above all other applications, giving you easy acces while using AIM. Create Two Text Files When AIM Mate starts up, we will load two text files into the interface:
Create these two text files (SimpleText works fine for this) and place them in the same folder as your REALbasic project. Make sure you name them exactly as shown above. If you decide to change the file names, you will also need to do so in the code that follows. Add the Code Ok, enough of the preparations, let's get to the code! First, add the following code to the Open event of Window1: dim f as folderItemdim textin as textinputStream f=GetFolderItem("Buddies") if f<>nil and f.exists then textin = f.openastextFile while NOT(textin.EOF) BuddyList.addrow textin.readline wend textin.close end if f=GetFolderItem("QuickText") if f<>nil and f.exists then textin = f.openastextFile while NOT(textin.EOF) QuickTextList.addrow textin.readline wend textin.close end if This code loads the two text files you created earlier and places the contents of each in the correspdonding Listbox. Next, place the following code in the Action event of SendButton: if BuddyList.Listindex>=0 and QuickTextList.ListIndex>=0 thenSendAIM BuddyList.text,QuickTextList.text end if This code sends the currently selected text to the currently selected Buddy. But wait! What's that SendAIM command you see there? Easy, it's the name of an AppleScript that will take care of communicating with Instant Messenger for us. Create the AppleScript Launch Script Editor and create a new AppleScript: on run {x, y}tell application "AOL Instant Messenger (SM)" activate SendIM screenName x message y end tell end run Save the script as a "Compiled Script" and give it the name: SendAIM. Finally, drag the new script into your REALbasic project. Conclusion That's it! Test the project and when you're happy with the results, build the final application. Of course, you can download the application and completed project instead. Until next week! |
||||||||||||
|
||||||||||||||||||||||||||||||||
Maintained by the Staff of ResExcellence. This entire site ©1997-2006 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement.
[an error occurred while processing this directive]