home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-07 | 3.8 KB | 174 lines | [TEXT/ttxt] |
- (*
- CLImax: Useful tricks
- This program is $15 shareware.
-
-
- Want CLImax to turn really useful, really quick? Select all or part of this file, drag-and-drop the
- text onto CLImax, hit return, and you'll automatically get all of the variables, references, and
- handlers given here!
-
- Anything that is preceded by a double hyphen (--) or surrounded by parentheses with asterisks
- will be treated as a comment by AppleScript and not executed. Yes, this entire file is a perfectly
- legal AppleScript, and it won't do anything nasty. :-)
-
- *)
-
-
- -- Useful Shortcuts
- -- ____________________________________________________
- ------------------------------------------------------------
-
- -- making AppleScript less verbose
- set fw to ref front window
- set abm to ref about this macintosh
- set mem to file "memory" of control panels folder
- set views to file "views" of control panels folder
-
-
- -- variables for applications and remote machines
- set finder to app "Finder"
- set climax to app "CLImax"
- set rezcop to machine "rezcop"
- set gallagher to machine "Gallagher" of zone "umich-ENG-CAEN Admin"
- set gallagherf to application "Finder" of gallagher
-
-
- (*
-
- -- saving window sets
- set x to close windows -- temporarily saves the list of open windows while you do something else
- open x -- then restores whatever windows you had open, in the proper order
- set ws1 to windows -- save frequently-used window sets in a variable and open them later!
-
-
- -- general tricks
- delete selection -- in the Finder, if a window is covering the trash...
-
-
- *)
-
-
-
-
- --
- -- Handy Handlers
- -- ____________________________________________________
- ------------------------------------------------------------
-
- -- -- -- -- -- -- -- -- -- Who needs drag and drop when you've got a command line?
- on ctc( t, c )
- tell finder to set file type of selection to t
- tell finder to set creator type of selection to c
- end ctc
-
-
- -- -- -- -- -- -- -- -- -- the inverse of ctc, returns the type and creator of the selection.
- on tc()
- tell app "Finder"
- set n to count files of selection
- if n is 0 then return "No files selected."
- set t to file type of files of selection
- set c to creator type of files of selection
- if n is 1 then return {t,c}
- -- else do some more processing
- set r to {}
- repeat with x from 1 to n
- set r to r & {{item x of t, item x of c}}
- end repeat
- return r
- end tell
- end tc
-
-
- -- -- -- -- -- -- -- -- -- I whipped these up while writing CLImax's documentation...
- on edit()
- ctc("TEXT","ttxt")
- tell app "Finder" to open selection
- tell app "CLImax" to hide window
- end edit
-
-
- on ttro()
- ctc("ttro","ttxt")
- end ttro
-
-
-
- -- -- -- -- -- -- -- -- miscellaneous shortcuts
-
- on frontapp()
- tell finder to set x to processes whose frontmost is true
- if x is {} then set x to finder
- return x
- end
-
- on cfiles()
- tell app "Finder" to return (files of front window whose name ends with ".c")
- end
-
- on textfiles()
- tell finder to return (files of fw whose file type is "TEXT")
- end
-
- -- try this: put away servers()
- on servers()
- tell finder to return (disks whose local volume is false)
- end servers
-
-
-
-
-
-
-
-
- (*
- build( projectList )
-
- This handler accepts a list of project file
- aliases, and will tell CodeWarrior to build
- each of them in the order they appear in the list.
- At the end of the build it will re-open whatever
- project was open at time of invocation. I actually
- used this script while developing CLImax.
-
-
- to build( projectList )
- tell app "CodeWarrior IDE 1.6"
- activate
- set oldProject to Get Project Specifier
-
- repeat with x in projectList
- open x
- Make Project
- end repeat
-
- if (oldProject as text) isn't "" then open oldProject
- end tell
- "Successful."
- end build
-
- *)
-
-
-
-
- -- closing remarks
- return "AppleScript is the bestest language EVER!"
-
-
-
-
-
-
-
-
-
-
-
-
- -- Remember to register CLImax. :-)
- -- Have a nice day.
-
-
-