Google
www ResExcellence

Application Makeovers
Desktop Snapshots
iTunes Skins
Mighty Mouse Cursors
Uploads
Boot Images
Dock Poofs
Links List
Photoshop Goodies
Users Forum
Boot Panels
Download Stats
Log-In Panels
REALbasic
Clocks
GUI Software
Mac OS X Mods
Safari Stuff
Desktop Pictures
Icons
Mac OS X Themes
Splash Screens
Homepage
Download a free demo of REALbasic!
Download a free demo of REALbasic!
Recent Articles...
3D
3D Photo Gallery (Part 2)
3D Photo Gallery (Part 1)

Audio
iPod Tricks (Part 3)
iPod Tricks (Part 2)
iPod Tricks (Part 1)
Laugh Track Machine
Audio Player with Reverb
Shepard Melody
RB Phone Home
Build a Drum Machine

Custom Controls
Custom Buttons
Custom Buttons Part II
iTunes-style Listboxes
Custom Controls

General RB
Wiggle Window
JPEG in PDF
Hey! You got your Checkbox in my Listbox!
Background Applications
Listbox Auto-Find
Virtual Volumes
Time Tracker
Software Distribution (Part 4)
Software Distribution (Part 3)
Software Distribution (Part 2)
Software Distribution (Part 1)
Exceptions
Living on the Edge
Tips and Tricks
Review of REALbasic 3.0
Text Clippings Made Easy

Graphics
Image Spinner
Cropping Graphics (Part 4)
Cropping Graphics (Part 3)
Cropping Graphics (Part 2)
Cropping Graphics (Part 1)
Shimmer Graphics
Lissajous Figures
Simple Screen Capture
Vector Graphics
Kaleidoscope Images
Stegonography
Spirals!
Image Table
RB Magnifying Lens
Screen Capture
Color Picker Tutorial

Hacks
Ghost Grab
Speedy Mouse Extension
iTunes Plugins
iTunes Skinner

Internet
Display Web Image In Canvas
HTML IMG Tags
Version Tracking
Even Smarter Instant Messaging
Web Tiler
JavaScript and REALbasic
Stock Ticker (Part 2)
Stock Ticker (Part I)
AIM Mate

Mac OS X
Using Sheets in REALbasic
Build a Bundle (Part 2)
Build a Bundle (Part 1)
Dock Your Passwords
Mac OS X Debugging
REALbasic Mac OS X Icon Tutorial
Animate Your Dock
RB and the Command Line

Novelty
Guessing Game
Calendar Trivia
Tile Mixer
Zip Code Finder
Happy Valentine's Day
Merlin Simulator (Part 3)
Merlin Simulator (Part 2)
Merlin Simulator (Part 1)
Buzzword Machine
AppleSoft BASIC

Printing
Print to PDF

Registration
Registration Code Validation

Resources
Picture Extractor (Part 2)
Picture Extractor (Part 1)

Serial
Caller ID (Part 3)
Caller ID (Part 2)
Caller ID (Part 1)

Speech
Speech Recognition

Video
Big Brother Video Capture

Newest Dev Tools!

Book Alert !
REALbasic for Dummies
by Erick Tejkowski
$19.99 @ Amazon

Made with REALbasic!

Problems?
Downloads are in StuffIt 5 format (free download).
Tell me about a bad link (Thanks!).
Submission Policy

8-23-01

Create an iTunes Plugin with REALbasic by Erick Tejkowsi

This week we'll create a simple REALbasic application that enables you to churn out custom iTunes visual plugins. Have a fun message you want to surprise a co-worker or loved one with? Try passing it along via iTunes to really get their attention.

I know what you're saying.... "You can't build an iTunes plugin with REALbasic!". Fundamentally this is true. Using a few tricks, though, we can fake it. Using an existing plugin, we will replace a few items within it and build a new copy of the plugin with the revised settings, thus making a "new" plugin. The end effect is an iTunes plugin of your very own that happily draws your name in multiple colors when run.

Build the Interface

This week's interface is drop-dead simple to create. Launch REALbasic, open Window1 and drag an EditField, StaticText, and PushButton into the window. The EditField will be used as a place to enter your name. Pressing the PushButton will:

  • Open a "Save" dialog to let you name the plugin file
  • Build the plugin

To give you an idea of how this might look:

08-23_interface.jpg (5k)

Add the Code

Before we jump in and start coding, you need to know a few things. First, the plugins you will create are based on a template plugin named "ResexPlugin". When installed, this plugin is a fully functioning. It displays the word "ResExcellence" in flickering colors. Further, the name of the plugin (as it appears in the iTunes menu) is "ResEx Plugin". If you do a quick count, you will see the following:

ResExcellence 13 characters long
ResEx Plugin 12 characters long

The plan is to replace these two bits of information with your own data. Since this resides within the data fork of the plugin, it is vital that you not change the length of either string. Changing them will likely render the plugin useless. Don't need all the characters? We'll fill in any blank spots with a "space", since it maintains the string lengths yet won't alter the display.

The code is fairly minimal this week as well. For starters, double-click PushButton1 and enter the following code:

dim src,dest as folderItem
dim s,yourname,yourpluginname as string
dim binin as binaryStream

//find the default plugin
src=GetFolderItem("ResexPlugin")
if src<>nil and src.exists then

  dest = GetSaveFolderItem("",EditField1.text+" plugin")
  if dest<>nil then
    CopyFileOrFolder(src,dest)

    //we are going to change the file , so openAsBinaryFile(TRUE)
    binin = dest.openAsBinaryFile(TRUE)

    //ResExcellence = default text drawn onscreen
    //ResEx Plugin = default plugin name

    s = binin.read(binin.length+1)
    //add thirteen spaces to the name to be certain we
    //have the minimum number of characters
    yourname = left(Editfield1.text+" ",13)
    s = replaceAll(s,"ResExcellence",yourname)

    //the longest plugin name is 12 characters
    yourpluginname = left(Editfield1.text+ " Plugin ",12)
    s = replaceAll(s,"ResEx Plugin",yourpluginname)

    binin.position = 0
    binin.write s
    binin.close
  end if
end if

If you were paying attention, you may have noticed the undefined CopyFileOrFolder call. This leads us to our last code example. Select Edit->New Method and create a new method:

08-23_copymethod.jpg (20k)

You may recognize this method from the Language Reference in REALbasic. In fact, if you navigate to the "FolderItem" entry in the Language Reference, you will find the code for CopyFileOrFolder, which you can drag from into your new method. In case you like to type, the code is:

Dim i as Integer
Dim newFolder as FolderItem
If source.directory then //it's a folder
  newFolder=destination.child(source.name)
  newFolder.createAsFolder
  For i=1 to source.count //go through each item
    If source.item(i).directory then
      //it's a folder
      CopyFileOrFolder source.item(i), newFolder
      //recursively call this
      //routine passing it the folder
         else
source.item(i).CopyFileTo newFolder //it's a file so copy it
    end if
  next
else //it's not a folder
  source.CopyFileTo destination
end if

Conclusion

That's it! Test the project and when you're happy with the results, build the final application. The resulting plugin should produce somthing that looks like this:

08-23_resexview.jpg (8k)

Don't forget to keep a copy of the template plugin (entitled "ResexPlugin") in the same folder as your application. As usual, you can download the application and completed project. It also includes the C source code in case you are interested in building your own iTunes plugin in CodeWarrior. Until next week!


8-21-01

REALbasic News by Erick Tejkowsi

REALbasic 3.5 Arrives! REALbasic 3.5 has reached final release. In case you missed it, this version includes the following new features:

  1. 3D graphics
  2. Regular Expressions
  3. REALbasic interpreter
  4. Office Automation
  5. New database control
  6. Bug fixes

A set of links to get your REALbasic fix:

Another MacTech Challenge MacTech runs a monthly code contest. This time they are permitting you to submit your entry in REALbasic. The challenge involves building an application capable of rendering Nassi-Schneiderman diagrams.

db Reports 2.5. db Reports has reached version 2.5. db Reports is a cross platform report writing application that works on Mac OS Classic, Mac OS X, and any Win32 platform. With db Reports, you can extract, format and print data from one of various data sources.

Out in the Garage. RB Garage has posted a new version of their Euro Converter (version 2.5).

What's your angle? George Clark has released a new reusable class called TexTangle

...based on the Canvas Class, combines the features of a StaticText control and a Rectangle control into one convenient package. All of the properties of a StaticText (with the exception of MultiLine; a TexTangle is always in "multiline" mode), and of a Rectangle are duplicated in a TexTangle. Plus TexTangle adds some refinements all its own...

Position text vertically (top, center, bottom) as well as horizontally (left, center, right)

LeftMargin and RightMargin properties allow you to place text horizontally just where you want it

A VerticalOffset property to add extra padding above text aligned at the top, or below text aligned at the bottom, of the TexTangle TexTangle uses the Backdrop property of the Canvas class, so you have full access to all of the other Events of a Canvas. TexTangle is made with pure REALbasic code, and requires no plug-ins.

Help for Balloon Help. Don't miss the new BalloonHelp 1.2 class. This version allows you to compile Carbon or Win32 builds (where balloon help is not supported) without problems.


Application Makeovers
Desktop Snapshots
iTunes Skins
Mighty Mouse Cursors
Uploads
Boot Images
Dock Poofs
Links List
Photoshop Goodies
Users Forum
Boot Panels
Download Stats
Log-In Panels
REALbasic
Clocks
GUI Software
Mac OS X Mods
Safari Stuff
Desktop Pictures
Icons
Mac OS X Themes
Splash Screens
Homepage

Maintained by the Staff of ResExcellence. This entire site ©1997-2003 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement.

[an error occurred while processing this directive]on the ResEx LinuxPPC Server