PiXELS3D & AppleScript
Power to the People

Brief Synopsis

 

Introduction

AppleScript has proven to be an awesome scripting language. Its syntax resembles an actual spoken language. AppleScript is so easy to use for all user levels. AppleScript is also powerful enough to be used by power users. PiXELS3D has its own built in scripting language, but you can use AppleScript as an interface to PiXELS3D's scripting language. This tutorial will demonstrate how to use AppleScript in conjunction with PiXELS3D. In the process you will also learn how to make AppleScript droplets.

This tutorial requires:

Pixels3D | studio | v3.0 or greater

AppleScript

Downloads


DropletDemo.sit [4K]

Creating the Script
 on open my_items

	on open my_items
	
	  repeat with counter from 1 to the count of my_items
		
   (* Open the script *)
		 set refNum to open for access (item counter of my_items) without 
   write permission
		
	 	(* Get the file size *)
 		set fileSize to (get eof of (item counter of my_items))
		
		 (* Read the script *)
		 set scriptData to (read (item counter of my_items) for fileSize)
		
 		(* Tell Studio to execute the script! *)
	 	tell application "Studio 3.7fc3"
		 	do script scriptData
		 end tell
		
 		close access refNum
		
	end repeat
	
end open
AppleScript droplets are fairly new. An droplet is an application which responds to something "dropped" on it. Our script will respond to PiXELScript files and execute them accordingly.

To the left is the script'st code. That is all it takes to send a script to Studio for execution. All communication between AppleScript and Studio take place using the "do script" command.

Paste this code into ScriptEditor, which is located in your AppleExtras folder. Save the script as a droplet and you are ready to go.

Running the Script
 
Now it is time to run the droplet. Simply drop your script(s) on to the droplet icon. Afer this Studio will open ( if not already open ) and execute your script. This is useful for running scripts from your desktop.
More Information
 You can get more information on AppleScript by pointing your browser to http://www.apple.com/applescript. You can download help modules from this site that help you learn more about AppleScript. AppleScirpt is also available in MacOSX, in the Classic, Carbon, and Cocoa layers.