Archive for the 'Advanced OS X' Category

Search for a File You Worked on in the Past Month in the Finder

November 20th, 2007 by steveblue

Can’t remember the name of a file you created or edited the other day, last week, or even in the past month?

Search for Files from the Past Week

The Finder makes searching for files really easy in OS X Leopard. Open a Finder window and look for The SEARCH FOR section of the Side Bar. Click “Past Week” and all the files you have edited in the past week will open chronologically, starting with the latest.

But what if the document you are looking for was created in the past month? The Spotlight in the Finder allows you to make searches using AND, OR, and NOT in OS X 10.5 Leopard. You can use the Finder window to add specifications to the search as well. Furthermore, you can Save Searches and then add them to the Side Bar.

In this short tutorial, I will show you how to set up a Saved Search for the Past Month in the Side Bar. The ideas in this tutorial can be expanded for other search criteria too.

Open the Finder, Select the Mac from the Side Bar, put a period (.) in the Spotlight Search Bar (you will erase this period later) and Hit Return.

New Spotlight Search Bar in the Finder in OS X 10.5 Leopard

Notice how a new Search Bar appears under the Tool Bar. It tells you where you are searching, and even gives the options to search the contents of files or just the file names. But look directly to the right and you will see a plus (+) sign. Click the plus sign. A new search criteria will appear, and it will say “Kind is Any”. Change these variables to say “Created date is within last 31 days”.

Change these variables to say “Created date is within last 31 days”.

The following is not necessary for these steps but good to know when making customizable searches in the Finder.

If you hold down Option at this point the plus sign will become a … button. This will allow you to add further criteria to the search string using Any (OR), All (AND), or None (NOT).

Remove the . (period) from the Search bar you originally used to start the Search.

Save the Custom Search in Spotlight

Click the Save Button. Name the new Search something meaningful like “Past Month”. Make sure Add to Sidebar is checked. Hit Save. A new Search called “Past Month” will now be available in the Search For section of the Sidebar.

For a more technical explanation and even a video, visit MacWorld: Max OS X Hints Article, “Add Conditions to Finder Searches.

Customize The Dock in OS X Leopard

November 5th, 2007 by steveblue

It seems a lot of people do not like the 3D Dock in OS X Leopard. There is even a website totally dedicated to modding the Leopard Dock.

How to Make New Stationery for Mail (Getting Started)

October 29th, 2007 by steveblue

This post will outline everything someone will need who wants to start designing new Stationery for Mail in OS X Leopard. Hopefully, this will turn into an ongoing series about Stationery in Mail.

How to Make Stationary for Mail in OS X

First Attempt at Skinning the Air Mail Stationery

What you will need to create new Stationery for Mail:

  • OS X 10.5 Leopard
  • XCode Installed
  • Photoshop (or other Image Editor capable of editing .jpg and transparent .png)
  • HTML / XML Editor
  • Package Maker (installed w/ XCode)

Do not overwrite existing files. If you wish to the modify existing files, backup the originals before changing anything!

The default Stationery you see in Mail is stored in a folder at the following location:

/System/Library/Application Support/Apple/Mail/Stationary/Apple/Contents/Resources/

/System/Library/Application Support/Apple/Mail/Stationary/Apple/Contents/Resources/

TableofContents.plist

If you navigate to this folder, you will notice a file called TableofContents.plist. This file contains the XML necessary for Mail.app to list the Categories of Mail Stationery.

Notice how each Category has it’s own Folder? By default there are Announcements, Birthday, Photos, Sentiments, and Stationery Folders. If you click on one of these folders, you will see it has it’s own directory structure: /Announcements/Contents/Resources. You will find the the actual stationery in the Resources folder for a specific Category.

Resources Folder for Announcements Category

There are two oddball files among the Stationery, another TableofContents.plist and an English.lproj Folder (I imagine for others running Leopard in other languages this folder may change, can someone confirm?). TableofContents.plist here is another XML document that lists the Category’s Stationery in a format Mail.app can understand. Does anyone know what the Stationery ID parameter in this file might be for? How can I create a new Stationary ID or a new piece of Stationery? The English.lproj folder contains a file called DisplayName.strings. In this file there is a comment that says: “Stationery category name as appears in the stationery selection pane in the New Message window after clicking Show Stationery toolbar item.”

If you go back to the Resources folder and Ctrl+Click on a .mailstationery file, you can select Show Package Contents from the menu. This will open the Stationery’s Directory Structure which is the same: /Stationary/Content/Resources/. Here you will find the files that make up a piece of Stationery in Mail.

Stickies Stationery Package Contents

There will most likely be the following basic files:

  • bg_pattern.jpg : The Background Image
  • top.jpg : Header Image
  • bottom.jpg : Footer Image
  • content.html : The HTML Template
  • Description.plist : The XML File Necessary for Interactivity in Mail.app
  • English.lproj folder : Contains DisplayName.strings (file that names the Stationery for Mail.app)
  • thumbnail.png : The Thumbnail for the Selection Screen in Mail

Air Mail Stationary Package Contents

Photo Stationery may have the following:

  • Mask1.png : The Mask for Drop Zones
  • placeholder1.jpg : The Placeholder Image for Drop Zones
  • banner.jpg : Usually the Background for the Masked Drop Zones
  • frames.png : The Template for the Drop Zones

The Workflow:

Do not overwrite existing files. If you wish the modify existing files, backup the originals before changing anything!

  • Create New Folder for “Custom” Stationery in the Resources folder, give it the Directory Structure /Content/Resources/
  • In this folder, make a file called TableofContents.plist. You will need to enter XML data here for the Individual Stationery inside the “Custom” Category. Project Folders and eventually Packages will go in this folder. An English.lproj folder with DisplayName.strings (for the Category name) must be in this folder as well.
  • Make a New Folder for the new Stationery and give it the same directory structure: /Content/Resources/
  • This is the folder you will place the HTML template (content.html), XML template (Description.plist), all images, and the English.lproj folder with DisplayName.strings (Name of the individual Stationery)
  • Use Package Maker to create a Package for the Stationery (must have .mailstationary as a filename and the correct Directory Structure)
  • Backup TableofContents.plist in /System/Library/Application Support/Apple/Mail/Stationary/Apple/Contents/Resources/
  • Add new lines in TableofContents.plist for the new Category

Can anyone tell me what that the Stationery ID is for in TableofContents.plist and how to create unique Stationery IDs for new Stationery and is this necessary?

If anyone ends up creating new Stationery because they read this tutorial, I would gladly post custom templates on iUseApple.com.

How to Install Leopard from External Firewire Hard Drive

October 29th, 2007 by steveblue

Here I will show you briefly how to set up the external partition correctly for the OS X Leopard Install, make an image of the Install Disc, restore that image to the external partition, and finally how to boot from an external firewire drive.

Unpackaging Leopard OS X 10.5: Front of Box

It is a good idea to place a partition called “Mac OS X Install DVD” on an external hard drive for several reasons. The foremost is for DVD challenged Macs. Perhaps your Superdrive or Combo Drive is broken? It provides a handy method of fixing disk permissions, updating Firmware passwords, and whatever else you can do off the Install, without the actual DVD. In OS X Leopard, Time Machine can be used to Restore Backed Up versions of OS X. The catch is, it needs the Leopard Install DVD to do this. Wouldn’t it be nice to have a copy of the Leopard Install partitioned right next to our backup data on an External Hard Drive? Installing from an external hard drive can also be faster than booting off the DVD.

You will need the following:

  • OS X 10.5 Leopard Install Disk and/or .dmg Disk Image
  • A Mac Running OS X 10.4 Tiger
  • A working DVD Drive (for those copying from DVD to External)
  • External Firewire Hard Drive + FW Cable

Backup OS X Tiger 10.4 Before You Install

Before you install any new Operating System on a Mac it is highly recommended you backup your entire hard drive first to another hard drive, usually an external hard drive. I used SuperDuper! to clone OS X Tiger onto a bootable Backup Partition. You should do the same. This means we will take all our files and duplicate them onto another drive. It is really handy to own an external hard drive, mainly for this purpose and also if we want to take advantages of the instant backup nature of Time Machine in Leopard. So, before you install Leopard go out and purchase a Lacie or similar External Firewire hard drive. If you have a Mac Pro, G5 or MacBook Pro 17″ or most 15″ and 17″ PowerBooks, you should be shopping for an external hard drive with Firewire 800 connectivity. All other Macs should be connected to a Firewire 400 Hard Drive. USB 2.0 Externals will not boot on a PowerMac, but will boot using an Intel Mac.

iUseApple.com or any of it’s writers are not responsible for the damage caused to files or to a hard drive that anyone formats or partitions.

The Steps:

  • Make a Disk Image (.DMG) from Install DVD using Disk Utility
  • Partition External Hard Drive for Install Partition
  • Restore the Partition from .DMG of Install DVD
  • Restart, Booting from Install Partition

For those who have the OS X Leopard Install DVD:
Skip here if you already have a .dmg file.

Make a .DMG from the Leopard Install DVD

First, you need to make a disk image of the DVD using Disk Utility. Disk Utility is found in /System/Applications/Utilities/Disk Utility.app. Put the Install DVD into your Mac’s Combo Drive, Superdrive, or External DVD Reader.

Make a .DMG in Disk Utility

You will see the Install DVD appear on the left in Disk Utility. Single Click the listing from Mac OS X Install DVD. Then select New Image from the Tool Bar. Change the Image Format to “entire device”. Find a place to save the disk image, name it Mac OS X Install DVD. Click Save. Wait until the process is complete (This can take a while, so go outside and play).

.DMG in Progress

When it is finished, you will have a .dmg of the Install DVD on your hard drive.


Make a 10.0GB Partition on the External Hard Drive

Do you have files on this External Hard Drive? If so, you will want to back these up before proceeding. When partitioning a drive in Tiger, it means you must erase the drive and segment it. If you have a fresh Hard Drive, this process is much easier in OS X Tiger, since you will not lose any data.

A Brief Note About the Difference Between Partition Maps for
PowerPC and Intel Macs

You may need to change the Partition Table for the drive. The Partition Table you are currently using is highlighted in Disk Utility, under the Partition Tab, in the Options… menu. If you are making a bootable partition for PowerPC, you will need to select Apple Partition Map if it is not already selected. Intel Mac users should select GUID Partition Table. If you have to reformat the Partition Table, this means you will need to completely format the drive and will lose all data. Other World Computing has a detailed explanation about Partitioning Drives on PowerPC vs. Intel Mac.

If you have the Leopard Install DVD and can boot from it: Restart the Mac and hold down the C key while starting up. Right after you select the language (the first install window), you can use the Leopard version of Disk Utility to resize existing Partitions on the External Hard Drive. Disk Utility is found in the menu bar. In the Leopard version of Disk Utility, you can divide existing Partitions and resize them accordingly. On screen instructions for this are found in Disk Utility itself, but I’ll tell you anyways. In Disk Utility, Select the Hard Drive you wish to Partition (not the name of the drive, but the device name). Click on the Partition Tab. Single Click on an existing Partition under the Volume Scheme. Click the Plus Sign just beneath that. Click on the new Partition and name it “Mac OS X Install DVD”, Format: Mac OS Extended (Journaled), Size: 10GB. Click Apply. After you are finished resizing the partitions, exit the installer and startup regularly in OS X Tiger. Skip the next paragraph.

Partitioning a Drive in Disk Utility (OS X Tiger)

If you cannot boot from the Leopard Install DVD: In Disk Utility, Select the Hard Drive you wish to Partition (not the name of the drive, but the device name). Click on the Partition Tab. Directly under Volume Scheme, select the number of Partitions you want. Make sure one of the Partitions is named “Mac OS X Install DVD”, Format: Mac OS Extended (Journaled), Size: 10GB. Why these settings? I’m ultra paranoid that it won’t work without the name and 10 GB is ample room for the DVD. Partition the rest of the drive as you wish. Click the Partition button in the lower right only when you are sure of the settings and have backed up any data that was on the drive.

Restore the External Partition from the .DMG

Select the “Mac OS X Install DVD” Partition from the left in Disk Utility.

Restore Drive Using Disk Utility

Now Select the Restore Tab. Drag the .DMG into the Source field. Drag the External Partition into the Destination Field. Click Restore in the lower right corner.

Click Install OS X.app

Once this is finished, the Auto Start Screen from the Leopard Install DVD should appear. You now have a copy of the Leopard Install DVD on the External Hard Drive.

Boot Leopard Install from External Hard Drive

I suggest if you have the Install DVD inside the Mac still to eject it. Make sure the Firewire External Hard Drive is connected. Restart the Mac, while holding down the Option key until a blue screen appears. Wait for the waiting cursor to change into a mouse cursor. Select the “Mac OS X Install DVD” partition from the list. The Mac will now boot the Leopard Install from the External Hard Drive.

Read Step by Step How to Install OS X Leopard for screenshots from the entire install process.

Screen Sharing from the Dock in Leopard

October 29th, 2007 by steveblue

Screen Sharing from the Dock in Leopard

Have two Macs on the same network? It is rather easy to connect to another Mac via Screen Sharing in the Finder, but I have found another quick way of controlling another Mac rather quickly from the Dock. This tip may be better suited for the techno-savvy crowd.

Screen Sharing.app is found here: /System/Library/CoreServices/Screen Sharing.app. Just drag the Application icon to the Dock! If you open Screen Sharing this way, the Application will ask you for the Host Name of the Mac you wish to connect to. I.P. Addresses can be typed here, but thanks to a tip Brian sent in, you can just type the name of the computer you are trying to connect to i.e. if you have a G5 sitting across the network, just type G5. If you have named the computer in Network Preferences, then type that name.

The Habits of A Leopard: Prepare for OS X 10.5 in Tiger

August 19th, 2007 by steveblue

Since Apple has taken the time to make some changes in OS X Leopard that reflect our workflow habits, I have prepared some smart tips for anyone using Tiger so the transition will be smoother. Leopard is coming out in October and while some Mac users have already preordered Apple, Inc.’s next release of OS X through Amazon.com, others will be skeptical after watching Microsoft users disappointed with Windows Vista.

Even if there are a few bugs when OS X Leopard 10.5 is launched, Apple Inc. will take care of them rapidly with Security Fixes and Updates via Software Update. Will your old Applications work? There should be a seamless transition for the most part. Apple hasn’t reinvented the wheel with this release, just added features that will make your workflow easier and your files well organized.

The idea is to cut down on our Desktop Clutter by moving files that are usually place the Desktop to Folders in the Dock, make the Menu Bar transparent so digital photos can show through, organize open Applications in different Desktops, and set up automatic backups of files using Automator.

The Look and Feel of Leopard

For years, Apple has been changing the look of Application windows. In Panther, there was the blinds look; Tiger had the brushed metal look; and recently iTunes and iLife were given a new and softer appearance. In Leopard, all the windows will be uniform. What what can we do in Tiger to achieve this look? UNO to the rescue. “UNO is a theme that brings the sunken unified toolbar/titlebar look&feel to every single window on your system (cocoa or carbon, metal or aqua and already unified windows as well).”

UNO Icon

Find out more about UNO from the official website.

Place Downloads in the Dock

Downloads Folder in the Tiger Dock

It is easy to redirect Downloads to a folder in the Dock. Just follow these simple steps for Safari:

Safari Preferences

Select Safari: Preferences in the Menu Bar. Click the General Tab in the window that appears. In the Save downloaded files to: field select Other… In the next window, Navigate to Documents and Click New Folder. Name this new folder Downloads and Click Select.

For other Applications like Firefox or iChat, just follow a similar procedure for finding the Downloads location in each Application’s Preferences. Remember, the keyboard shortcut to get into an Application’s Preferences is Apple + ,.

Navigate to the Downloads Folder in the Finder. Drag the Folder to the right side of the Dock, just to the right of the small vertical crease. An alias of the Downloads folder will appear in the Dock. Ctrl + Click the new Dock folder and a listing of the files inside the Downloads Folder will appear.

Make the Menu Bar Transparent

An Application called MenuShade will make the Menu Bar semitransparent until I hover my mouse cursor over it and then it becomes opaque. This Application allows me have digital photos that seamlessly integrate with the Menu Bar.

Example of MenuShade in Action

Download MenuShade from VersionTracker here.

After I install MenuShade, I can adjust the transparency in MenuShade’s Preferences.

Open Menu Shade at Login

I can automatically load MenuShade when I login if I place MenuShade in the Dock and Ctrl+Click the Menu Shade Dock icon. Select Open at Login from the options. Now Menu Shade will load automatically at Login.

Use Multiple Desktops with VirtueDesktops

The motto of Leopard is “Conquer Time and Spaces”. We can certainly accomplish this with Tiger. I don’t have to be constrained to just one Desktop in OS X 10.4 Tiger. VirtueDesktops allows me to create alternate Desktops in a grid fashion. I switch between these spaces using the Menu Bar or the Shift + Control + Arrow Keyboard Shortcut.

Download and Install VirtueDesktops

VirtueDesktops In Action

There are several effects I can apply to the transition of each Desktop. I can even assign certain Applications to specific Desktops. I can set up Templates for the organization of all the Desktops too.

Backup Files Automatically

If I really want to get the most out of Backup, it is best to go out and purchase an external hard drive larger than the one I am backing up. Go out and buy a Lacie that has both Firewire and USB 2.0. If I have a G5 or a Mac Pro, I can even install a second internal hard drive that will make backups happen even faster. For Professionals, get an external hard drive that can connect via eSATA and purchase the appropriate eSATA add on cards for the computer are using.

Leopard uses Time Machine to make automatic backups, but there are several solutions that do the same thing in OS X 10.4 Tiger. The two solutions below are both free. The first option allows me to set up scheduled backups of individual folders using an Automator Action and iCal. It takes a few minutes to set up, but is well worth it if I only want to back up crucial files to a small hard drive. The second option requires downloaded a freeware Application called SuperDuper! that will allow me to backup a copy of my entire System to an external hard drive.

I have written step by step instructions for setting up automatic backups of folders with Automator.

SuperDuper!

If you are looking for a simpler and free method of backing up an entire Hard Drive, I’d recommend an Application called SuperDuper!

Diagnose and Treat My Mac with AppleJack

June 18th, 2007 by steveblue

Apple Jack Can Fix My Mac!

“AppleJack is a user friendly troubleshooting assistant for Mac OS X. With AppleJack you can troubleshoot a computer even if you can’t load the GUI, or don’t have a startup CD handy. AppleJack runs in Single User Mode and is menu-based for ease of use.”

Recently my Macs have been acting up. Maybe its the change of season, all the pollen in the air. Perhaps my anxieties rub off on these machines. My MacBook Pro won’t burn discs. OS X is showing a MEDIUM WRITE ERROR when writing the lead-in. I’ve boiled it down to a problem inside of my User preferences.

Then today all hell broke loose on my Power Mac G5, when suddenly a Capture Now in Final Cut Pro froze OS X and the screen. It rebooted fine, to find the same error again. Then, weird video glitches appeared freezing the computer every time. Looked like it was the video card acting up, so I ran Disk Utility to verify and repair broken Permissions. Disk Utility found wrong permissions in files having to do with my video card. Everything seemed repaired, then suddenly theres the video freeze again when the Dock popped up and froze. Disk Utility never seems to work for me, even when it says it does.

It’s times like these that I am thankful to have installed AppleJack. I completed all five steps in the AppleJack diagnostic tool set and my G5 purred on the next Restart.

Most times a broken Mac will boot up into Single User Mode (hold down Cmd+S when turning on the computer), which is where I can troubleshoot problems associated with Start Up. AppleJack installs right into Single User Mode, allowing me to perform actions like Repair Disks, Repair Permissions, Clean Caches, Validate Preference Files, and Remove Swap Files. A cocktail of all five can be performed automatically! Most Start Up and System Issues can be fixed with this simple utility!

AppleJack is a must have for anyone who owns a Mac with an expired warranty. Did I mention AppleJack is free?

AppleScript 101: Open 3 Applications At Once!

June 7th, 2007 by steveblue

Sometimes I find myself opening the same three Applications when I turn on my Mac. This post shows how to automate this process with AppleScript.

To really know my Mac, I should really get to know AppleScript. According to Apple, “AppleScript is an English-like language used to write script files that automate the actions of the computer and the applications that run on it.” AppleScript is the foundation of Automator.

I chose this example because it will be extremely useful when used with Spaces, a new feature in OS X 10.5 Leopard that allows me to organize Applications into separate desktops. It’s like have four monitors in one! I can even tell my Mac to run it whenever it turns on, giving me touch free access to the Applications I always use.

Below is an AppleScript that tells three applications to open, tells Firefox to visit Gmail, opens Adium, opens and hides another application called Transmission. You can insert your own applications and even substitute Safari for Firefox.

Open Script Editor in User:Applications:Applescript:Script Editor

Type in the following, inserting the names of any Applications you want to open:

Tell AppleScript Get URL Hide Open Applications

In Script Editor, Click Run.

Tada! All the Applications open!

Now, we must save our little Applescript so we can use it in our everyday actions…

Select File: Save As. Name Your Script something like Open Apps.

Save As to User:Library:Scripts.

To be able to click on the AppleScript via the menubar:

Open Applescript Utility found in User:Applications:Applescript:Applescript Utility

Applescript Utility

Check Show Script Menu in Menu Bar. A little black script icon now shows up in the top right of the screen. Click the Script Icon and you will see your Full Screen script, probably at the bottom. Go here whenever you want to view a movie in fullscreen. You’ll notice a bunch of other scripts. If you want to tidy up the Script Menu, go back into the Applescript Utility and uncheck Show Library Scripts.

Create Visuals with NodeBox! (Part 2: Crash Course)

May 16th, 2007 by steveblue

NodeBox: Python Visual Programming Environment

In Part 2 of “Create Visuals with NodeBox!” we will explore the interface and give examples of correct syntax when dealing with common Python commands, for loops, variables, importing images, and templates. This post is a crash course in programming 2D visuals with NodeBox, perfect for the aspiring artist or Mac tinkerer who wants to play around with the powerful graphical capabilities of an Apple computer.

Just a disclaimer: I am not a programming super star! I am learning NodeBox as I write about it. So, if you are the least bit intimidated by programming, take a deep breath and clear your mind. I am a beginner just like you! I can’t believe how easy it is to program graphics with Python. The language is easy to remember and NodeBox is remarkably stable.

What Does This all Do?

To understand NodeBox, we must first understand the interface we will be using. NodeBox is unlike many applications we use for design, since it asserts simplicity over displaying a bunch of buttons. There are three basic parts to the NodeBox interface:

NodeBox Window Example

Code

Code is typed into the upper right portion of the NodeBox window. Any keywords and commands will be highlighted in blue. These are built-in terms NodeBox understands. In the example, def, for, random, fill, rect, and size are all highlighted in blue. Random is a NodeBox command that computes a random number. Rect is a command that outputs a random number.

Output

Once the program is ready for viewing, I can run it by pressing Cmd+R. The output for the program will be displayed to the left.

Messages

Error messages will be displayed on the bottom right of the NodeBox interface. I can figure out how to fix broken code here.

Working with Code in NodeBox

NodeBox makes coding easy. The syntax, or the language, is rather bare, allowing for fewer mistakes when writing code. Lets look at a basic command:

rect(x, y, width, height, roundness=0.0, draw=True)

This is the basic syntax of a command: the name of the command ( parameters ). The name of the command gives us a hint of what it will do. The rect command draws a rectangle. Parameters tell the command how to behave, these are separated by commas inside of brackets. The rect command specifies x and y position, width, height, and edge roundness.

The Coordinate System

2D graphics are displayed using a X, Y coordinate system. The origin point (0,0) for both X and Y is at the top left of the output window. As X increases, the position of an object will move right horizontally across the output window. As Y increases, the position of an object will go down vertically.

Throttle

Throttle

I can easily change the values of numerical parameters with the throttle. Click on a numerical parameter. Hold down Cmd and move the mouse left to decrease the value by 1 or move right to increase the value by 1. Hold Cmd + Option while dragging to increase and decrease by .01. Cmd + Shift by 10.

Defining a Variable

Variables are handy, since they allow me to store a value for the computer to use. Suppose I want to draw a circle in a random position between 0 and 100. I can define the x position as x = random(1,100). Every time the program runs, x and y are given a random value between 1 and 100.

VariablesCircle

Indent the last line of this program to make it work.

The above example draws a circle at a random position between in a 100 x 100 pixel space.

The For Loop

Computers love repetition. The For Loops tells the computer to perform a certain task repetitiously. The syntax for the For Loop looks like this:

The For LoopBlob

Notice how the For Loop has a variable and a range. This is written as: For i in range(10):. i is the variable. The range is 10, meaning everything indented below the for loop will be executed ten times. The colon at the end of the for statement is crucial! Do not forget the colon! All the code I want to loop must be indented below the For statement.

The above example draws ten circles instead of just one. When I run the program, a black blob will appear. This is because all ten circles have the same fill color and stroke.

Fill and StrokeDepth

If I define a Fill and Stroke color before the oval is drawn, I can see depth between the circles (assuming the fill and stroke are different colors).

Colors

The RGB system is used anywhere a specific color value can be inserted as a parameter. In the above example, I filled every circle with red using the command fill(1, 0, 0). Color values are based on a numerical value of 0 to 1. Green = (0, 1, 0). Blue = (0, 0, 1). White = (1, 1, 1). Black = (0, 0, 0).

Templates

Templating is a way I can define the certain look of an object once and then call upon that object as many times as I like. This would be called a function in traditional programming. Suppose I want to draw 100 images. I don’t want to write the code from each image 100 times. I can just designate the specific design of one image, then use a For Loop to draw 100 of them.

Basic NodeBox Program

To run this program, save this code as a project file. Download the first image in this post of the NodeBox logo. Create a folder called images where the project file is saved. Put the downloaded nodeboxapp.png file into the images folder. Run the program. It is important to use nodeboxapp.png, since it contains a transparency that the program will need to run. NodeBox looks for images in the folder where the project is saved first and then in the Home Directory.

NodeBox Logos

Notice the def statements? These define a template and have the following structure: def template_name (variables). After each def statement is a colon! Do not forget the colon! The properties of the def statement are then indented beneath the initial syntax. In the above example, def nodeboxlogo (x,y): defines a template for the following image: image(”images/nodeboxapp.png”, x, y, alpha=0.7). So, whenever I call upon nodeboxlogo, it will always draw the image with an alpha of 0.7. The Alpha is the transparency of the image. This image is stored on my hard drive, in a folder called images that is in the same folder as the project file. See how nodeboxlogo has two variables, x and y? At the end of the program, I call upon nodeboxlogo to draw itself at a random position 10 times in a For Loop. x then equals random(0, sizewidth).

Variable Output Size

The size command designates the size of the output window. A good rule of thumb when designing programs for computer screens is to make the output size variable. In the very beginning of the program, I defined two variables: sizewidth=400 and sizeheight=600. I put these two variables into the size command, allowing me to control the output size from the very top of the program. Another time I call upon these two variables is at the bottom of the program, where I assign a random position for each nodeboxlogo.png. This is so the image never escapes the dimensions of the output screen. Otherwise, every time I wanted to change the output size, I would then have to change the range of the random values. This applies to the size of the background rectangle as well. It is superior to have the position of all the objects scaled to the overall dimensions of the output window. With a little tweaking, I could even make it so each NodeBox image always stays within the bounds of the canvas. This would require a little math and variable dimensions for the image. Understand how this is helpful?

Export to PDF

I can export my composition to PDF by selecting File: Export as PDF… The exported dimensions will be dictation by the size command. In the export options, I can designate the number of pages. This is nice with a randomized program, since it will run the program as many times as I like, outputting each randomization as a separate PDF.

In Part 3, I will dive into NodeBox math and drawing paths! Check out the tutorials at the Official NodeBox website.

Watch MacBreak

February 6th, 2007 by steveblue

Sometimes people ask me where I get my tips from. Usually, my tips and tricks come from my own personal experience using a Mac. That’s what iUseApple is all about.

The Digital Set of MacBreak featuring Leo LaPorte and Kenji Kato

Really, the only tips and tricks podcast I watch is MacBreak.

MacBreak is the first HD quality Macintosh Podcast. And they’ve got Leo LaPorte interviewing all the experts. Remember Leo from “Call for Help” on ZDTV years ago when they used to do a Mac tip everyday? The podcast features topics usually targeted at the intermediate or professional level Mac user. The coolest part of MacBreak is that they shoot about 20 shows over the course of a day on a green screen, add the set in digitally, and even show you how they did the entire process in HD! This is actually a great resource for anyone working with Digital Video or Imaging on a Mac.

According to TWiT Netcast Network, MacBreak is “The only Macintosh video show you’ll ever need. Mac experts Leo Laporte, Alex Lindsay, Kendra Arimoto, and Justine Ezarik talk about everything Mac, including hardware, software, pro apps, and tips. Shot in 1080p high def, because your Mac deserves the very best.”

I can subscribe to the MacBreak Podcast in iTunes. Open iTunes. Click the iTunes Store listing on the left side of the iTunes window. This will open the store. Type “macbreak” in the search bar provided in the top right of the iTunes window. Click Subscribe next to the flavor of MacBreak I want to watch, Standard Def video (great to save space on my hard drive), iPod video, or High Definition.



iUseApple is powered by WordPress 2.3.3 and Unnamed SE by Xu Yiyang
Entries (RSS) and Comments (RSS)