#!/usr/bin/perl -w # # Copyright 2000 by Michael Coyle # Released under GPL. # # Call it with: # [an error occurred while processing this directive] # # Get the file name from the browser... $file_name = $ENV{'QUERY_STRING'}; # Open the file... open (EP, $file_name); # Print to the browser... print "Content-Type: text/html \n\n"; # Load the file and keep spitting it out to the browser... while () { chomp; print "$_ "; } # Close the file and go home... close EP #!/usr/bin/perl -w # # Copyright 2000 by Michael Coyle # Released under GPL. # # Call it with: # [an error occurred while processing this directive] # # Get the file name from the browser... $file_name = $ENV{'QUERY_STRING'}; # Open the file... open (EP, $file_name); # Print to the browser... print "Content-Type: text/html \n\n"; # Load the file and keep spitting it out to the browser... while () { chomp; print "$_ "; } # Close the file and go home... close EP

3D
3D Photo Gallery (Part 1)
3D Photo Gallery (Part 2)

Audio
Poor Man's MIDI
Make A Metronome
iPod Tricks (Part 1)
iPod Tricks (Part 2)
iPod Tricks (Part 3)
Laugh Track Machine
Audio Player with Reverb
Shepard Melody
RB Phone Home
Build a Drum Machine

Custom Controls and Windows
Double Click Listbox
Draggable Metal Window
Double Click Canvas
Custom Buttons
Custom Buttons Part II
iTunes-style Listboxes
Custom Controls


General RB
Scrolling Windows
Using Mesage Dialogs
Case-Sensitive Word Finder
Introduction to Stacks
Wiggle Window
JPEG in PDF
Listbox Checkboxes
Background Applications
Listbox Auto-Find
Virtual Volumes
Time Tracker
Software Distribution (Part 1)
Software Distribution (Part 2)
Software Distribution (Part 3)
Software Distribution (Part 4)
Exceptions
Tips and Tricks
Text Clippings Made Easy

Graphics
Drawing a Simple Gradient
The SpriteSurface: Space Game
Image Spinner
Cropping Graphics (Part 1)
Cropping Graphics (Part 2)
Cropping Graphics (Part 3)
Cropping Graphics (Part 4)
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

Mac OS X
Global Hot Key Event (Carbon Events)
Login Welcomer (Carbon Events)
Add/Remove Buttons
Resizable Sheets
Mac OS X Preferences Window
Using Sheets in REALbasic
Build a Bundle (Part 1)
Build a Bundle (Part 2)
Dock Your Passwords
Mac OS X Debugging
REALbasic Mac OS X Icon Tutorial
Animate Your Dock
RB and the Command Line

Menus
Window Menu
Templates Menu
Listbox Menu

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

Printing
Print to PDF

Registration
Registration Code Validation
Network Registration Codes

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

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

Speech
Speech Recognition

Socket Communication
Easy Peer-to-Peer File Sharing
MacPAD Version Checking
Display Web Image In Canvas
HTML IMG Tags
Version Tracking
Even Smarter Instant Messaging
Web Tiler
JavaScript and REALbasic
Stock Ticker (Part I)
Stock Ticker (Part 2)
AIM Mate

XML Manipulation
Simple XML Introduction

Video
Big Brother Video Capture

Note: All articles without a byline were written by Erick Tejkowski. When cleaning the site I removed them because the code differed from page to page, and I have yet to put them back in.

resexc2.gif (20k)




REALbasic for Dummies
by Erick Tejkowski

$19.99 @ Amazon





Files are in Stuffit 6.5 or earlier, or ZIP format.
Download Stuffit Expander

Tell us about a bad link.

Dock Your Passwords
02-28-04




If you're like me, you have a dozen passwords that you use for a variety of sites on the Internet. After your collection grows beyond a few passwords, it becomes very difficult to memorize them all. Today we'll built a quick little utility that displays your favorite sites in the OS X Dock. Selecting a site will place your password for it on the clipboard.

Introduction

Today's project requires that you first go to Will Cosgrove's site to download his Carbon Events Plugin. He charges a nominal fee to use the plug-in, but it's well worth it if you are a Mac OS X developer. The plug-in adds all sorts of useful OS X functions to REALbasic. The demo plug-in will let you see how it works and is functional enough to complete this tutorial.

Interface

The interface for today is very stripped down. In fact, there really isn't an interface except for the the items listed in the Dock. After installing the plug-in in the Plugins folder, launch REALbasic and select Edit-Project Settings. Choose "None" from the "Default Window" popup menu.

Next, create a new class by selecting File-New Class. Name the class "app" and choose "DockMenuApplication" for the Super property.

Source Code

The code for today's project is also pretty simple. We will add a list of our favorite sites (sites that require passwords) to the popup menu of our application's Dock icon. Navigate to the Open event of the app class and enter the following code:

  
  AppendDockMenuItem "AppleCare"
  AppendDockMenuItem "Apple ADC"
  AppendDockMenuItem "eBay"
  AppendDockMenuItem "Kagi"
  AppendDockMenuItem "New York Times"
  AppendDockMenuItem "Salon"
  

Finally, navigate to the HandleDockMenu event of the app class and add this code:

  
  dim s as string
  dim c as clipboard
  
  c=new clipboard
  s = GetDockMenuItemText(index)
  
  select case s 
  case "AppleCare"
    c.SetText "123"
  case "Apple ADC"
    c.SetText "456"
  case "eBay"
    c.SetText "789"
  case "Kagi"
    c.SetText "abc"
  case "New York Times"
    c.SetText "def"
  case "Salon"
    c.SetText "ghi"
  end select
  

This list of passwords is fake, but you get the idea. Whenever a user chooses, say, AppleCare from the Dock menu, the HandleDockMenu event fires giving us the dock menu item's index. We then use that index to learn about the text that is contained in that menu item and act accordingly by pasting a "password" to the clipboard. A resourceful REALbasic programmer will notice that this project can be improved in many ways. Generally it is a bad idea to hard code information like passwords and web site names. These clearly would have a better home in a text file. That way you could add more links to the list later and the application will just display them. For the sake of this demo, we chose to hard code the information.

Conclusion

Well, that's it for this week! As usual, you can download the finished project in case you get stuck. Have fun and see you next week!






Please support ResExcellence by Visiting our Sponsors. One click makes a difference.


Download REALbasic and create your own software!

#!/usr/bin/perl -w # # Copyright 2000 by Michael Coyle # Released under GPL. # # Call it with: # [an error occurred while processing this directive] # # Get the file name from the browser... $file_name = $ENV{'QUERY_STRING'}; # Open the file... open (EP, $file_name); # Print to the browser... print "Content-Type: text/html \n\n"; # Load the file and keep spitting it out to the browser... while () { chomp; print "$_ "; } # Close the file and go home... close EP #!/usr/bin/perl -w # # Copyright 2000 by Michael Coyle # Released under GPL. # # Call it with: # [an error occurred while processing this directive] # # Get the file name from the browser... $file_name = $ENV{'QUERY_STRING'}; # Open the file... open (EP, $file_name); # Print to the browser... print "Content-Type: text/html \n\n"; # Load the file and keep spitting it out to the browser... while () { chomp; print "$_ "; } # Close the file and go home... close EP