|
6-6-03
iPod Trickery with REALbasic (Part 1) by
Erick Tejkowsi
Have you ever wondered how all those neat iPod utilities work? This week
we start a multi-week tutorial about using REALbasic to have some fun with your iPod.
Everyone knows that an iPod is really just a specialized external hard drive.
When you mount your iPod on the desktop, you can double-click its icon to view its contents,
copy files to the iPod, and select "Get Info" to learn about the drive.
Working with the iPod in REALbasic is really just as easy as working with files on any other drive.
There are, however, a few simple secrets you need to know about first. Let's see what those secrets are!
iPod Secrets
Yes, an iPod is really just a hard drive. Apple has made judicious use of invisible files on the iPod, though.
Using REALbasic, you can easily scan through the items on the drive, looking for invisible files and folders. If you do,
you'll soon discover that there is one invisible folder named iPod_Control. Inside that folder is another folder named
Music. Look inside the Music folder and you'll find any number of folders with names like F00, F01, and F02...
Within each of those numbered folders, you can find the audio files that make up the Library on your iPod.
For this week's project, we'll find those music files.
Build the Interface
Launch REALbasic and add a Listbox, a PopupMenu, and two Pushbuttons to Window1. Arrange the interface
however you want, but mine looks like this:
Next, add a Property to Window1 to keep track of the found iPods.
iPods(0) as folderItem
Add the Code
The first think we'll do is scan through all mounted drives, looking for an iPod.
All we have to do is look for that iPod_Control folder. If we find one, we
can guess that it's an iPod. Then, we stick the names of all found iPods in the PopupMenu control.
Add the following code to the Action event of PushButton1.
Once we find an iPod, its a simple matter to loop through all of the music folders
to search for files. Add the following code to the Action event of PushButton2 to scan
the iPod for tunes.
Conclusion
That's all there is to it! Choose Debug-Run to see your work. Don't forget to mount an iPod before
you test it, otherwise this project won't do much.
You can download the code for this week's project here.
If you have a lot of files on your iPod,
you might notice that this code takes some time to find the files. Worse yet, it seems to lock up the interface
while it searches. Next week we'll see how to give the user some feedback while the project searches for files.
We'll also make the application more responsive by "threading" the heavy lifting. Finally, we'll improve the utility
by allowing the user the copy files from the iPod to another hard drive. See you next week!
6-4-03
REALbasic News
by Erick Tejkowsi
RealCADD
RealCADD 3.05 is now available for download.
RealCADD is a professional 2D CAD software, easy to use but with many features and a shareware price.
RealCADD is Made with REALBasic and is available for Mac OS 9, Mac OS X and Windows.
ElfData plugin 1.0b5
The ElfData plugin has been updated to 1.0b5.
Version History:
- Totally re-did the technical reference, now comes from XML source and uses a generating application.
- FastString.GetResult now has an "InheritFrom as ElfData" parameter.
- Fixed an obscure bug in .fUTF where we could get a fBigEndian = false with UTF8 or Binary!
- Clarified functionality, by replacing ElfData.UpperCaseM with ElfData.UpperCaseL.
- Implemented the Lexer API! Now other plugin authors can write lexer plugins for the ElfData plugin. (A plugin to a plugin, basically).
- Updated the tests to make sure the bugs found don't come back. Update the tests and documentation to reflect the changes listed.
- Wrote the "ASCII Insensitive" lexer "plugin plugin" and bundled it.
- Remove ElfDataCentral.NewIsFast to improve simplicity.
Flash Plug-in
Michio Ono has updated his Flash plugin to be compatible with REALbasic 5.x. Don't miss
the many other REALbasic plugins he has to offer. Lots of cool stuff here!
REALbasic Developer on Amazon
Now REALbasic Developer magazine is available for purchase on Amazon.
This magazine (for which I work on the Editorial Board) is a great resource
for REALbasic programmers. The entire magazine is devoted only to REALbasic
and there are many fine authors. Check it out!
DoubleSlider
DoubleSlider is a MacOSX-only REALbasic 4.0-and-higher plugin and implements
the HiSlider, DoubleSlider and TripleSlider controls, which can live on
composited and non-composited windows. The controls provide slider bars
with one, two and three thumbs and can be customized by setting flags in
design time or in runtime. The sliders are in it self customized
OSX-controls using the HIToolbox API that was introduced with Jaguar. Users
of this plugin should be aware that Jaguar (OSX 10.2.x) is the minimum
requirement.
|