[153] | 1 | F-Script Anywhere 1.2 [5 January 2004]
|
---|
| 2 | =====================
|
---|
[7] | 3 |
|
---|
| 4 | Add a F-Script interpreter to Cocoa applications dynamically.
|
---|
| 5 |
|
---|
| 6 | Written by Nicholas Riley <mailto:fsa@sabi.net>.
|
---|
| 7 | Obtain updates from <http://web.sabi.net/nriley/software/>.
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 | WHAT IS IT?
|
---|
| 11 | -----------
|
---|
| 12 |
|
---|
[14] | 13 | Ever wanted to inspect a Cocoa applicationÕs objects from the inside?
|
---|
[7] | 14 | Frustrated with using GDB to debug Objective-C?
|
---|
| 15 |
|
---|
| 16 | You need F-Script Anywhere! (with apologies to Guido van Rossum)
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | INSTALLATION
|
---|
| 20 | ------------
|
---|
| 21 |
|
---|
| 22 | Install F-Script; you can download it at <http://www.fscript.org/>.
|
---|
| 23 | In particular, make sure the framework is installed in a Frameworks
|
---|
| 24 | directory, such as /Library/Frameworks or ~/Library/Frameworks.
|
---|
| 25 |
|
---|
[153] | 26 | F-Script Anywhere 1.2 was tested with FScript.framework 1.2.5
|
---|
| 27 | (20031020) and Mac OS X 10.3.2 (7D24). If you are using an earlier
|
---|
| 28 | F-Script version, please upgrade. F-Script Anywhere 1.2 should also
|
---|
| 29 | work with Mac OS X 10.2.x, but will not work with Mac OS X 10.1 or
|
---|
| 30 | earlier: please use F-Script Anywhere 1.1.5 instead.
|
---|
[7] | 31 |
|
---|
| 32 |
|
---|
| 33 | USAGE
|
---|
| 34 | -----
|
---|
| 35 |
|
---|
| 36 | Open the F-Script Anywhere application. Pick a Cocoa application from
|
---|
| 37 | the list and click Install or press return. F-Script Anywhere will
|
---|
| 38 | either install itself in that application, give you an error message,
|
---|
| 39 | or crash. (Hopefully not the latter!)
|
---|
| 40 |
|
---|
| 41 | Switch to the application, and you should find a ÒFSAÓ menu there.
|
---|
| 42 | Select ÒNew F-Script WorkspaceÓ to display a F-Script workspace.
|
---|
| 43 | This behaves like any other workspace, except it's executing within
|
---|
| 44 | the context of the application.
|
---|
| 45 |
|
---|
| 46 | You can also install F-Script Anywhere by using its dock menu. If
|
---|
| 47 | the frontmost application is a Cocoa application, just pick ÒInstallÉÓ
|
---|
| 48 | from the menu and F-Script Anywhere will install in that application.
|
---|
| 49 | If F-Script Anywhere canÕt install, the menu item will tell you so,
|
---|
| 50 | or F-Script AnywhereÕs icon will bounce to indicate a pending sheet
|
---|
| 51 | explaining the problem.
|
---|
| 52 |
|
---|
[153] | 53 | To remove F-Script Anywhere from an application, quit the application.
|
---|
| 54 | Because of limitations in Apple's Objective-C runtime, it is
|
---|
| 55 | impossible to remove F-Script Anywhere while the application is
|
---|
| 56 | running.
|
---|
[7] | 57 |
|
---|
| 58 |
|
---|
| 59 | BUILDING
|
---|
| 60 | --------
|
---|
| 61 |
|
---|
| 62 | The source to F-Script Anywhere is included. It has a number of
|
---|
| 63 | dependencies.
|
---|
| 64 |
|
---|
| 65 | 1. Install FScript.framework (see above).
|
---|
| 66 |
|
---|
[153] | 67 | 2. Check out the source of 'otool' from the Darwin CVS repository.
|
---|
[7] | 68 | This is required because there's a bug in the function that returns
|
---|
| 69 | the 'flavo(u)r' of an application: Cocoa, Carbon, Classic, etc.
|
---|
| 70 | It identifies all Cocoa applications as Carbon ones. So as a
|
---|
| 71 | workaround, F-Script Anywhere examines the application itself to
|
---|
| 72 | see what libraries it links with. (This may fail if you're doing
|
---|
| 73 | something weird like linking to development versions of Foundation
|
---|
| 74 | and AppKit, but since I don't work for Apple, I couldn't test that
|
---|
| 75 | eventuality.)
|
---|
| 76 |
|
---|
| 77 | Check out Commands/Apple/cctools/{include,libstuff} from Darwin
|
---|
| 78 | CVS into the "Darwin source" directory. If you don't have a CVS
|
---|
| 79 | account, go to <http://www.opensource.apple.com/> and get one.
|
---|
| 80 |
|
---|
| 81 | cd to the libstuff directory and type 'make' (it doesn't use
|
---|
| 82 | jam/pbxbuild). I _think_ this is all you need.
|
---|
| 83 |
|
---|
[229] | 84 | 3. Unzip DSTools-60.1.zip. Open the folder up and open
|
---|
| 85 | DSTools.xcodeproj. Change the active target to the DSCL framework,
|
---|
| 86 | change the build configuration to Deployment, and then build the
|
---|
| 87 | framework. Copy the resulting framework into the FSA Source/
|
---|
| 88 | directory. Alternatively if you're on PPC, you can just remove the
|
---|
| 89 | DSCL framework from the dependancies. The DSCL framework is used
|
---|
| 90 | to determine if you are in the procmod group on intel machines
|
---|
| 91 | (and if not, to prompt you if you want to add yourself) -- something
|
---|
| 92 | that is necessary for use of FSA on x86.
|
---|
[230] | 93 |
|
---|
| 94 | 4. Unzip FScript.framework.zip, or put a newer version of FScript.framework
|
---|
| 95 | in the project path. This is used for the FScript framework auto installer.
|
---|
[229] | 96 |
|
---|
[230] | 97 | 5. Open 'F-Script Anywhere.xcodeproj' in Xcode and build the Application
|
---|
[153] | 98 | target. This target depends on the Bundle and Bundle Loader
|
---|
| 99 | targets, so you don't need to build them separately. You
|
---|
| 100 | shouldnÕt see any errors or warnings, and the F-Script Anywhere
|
---|
| 101 | application (as well as two bundles, which you can ignore because
|
---|
| 102 | they are copied into the application bundle) will appear in the
|
---|
| 103 | build product directory.
|
---|
[7] | 104 |
|
---|
| 105 | If you have any problems building F-Script Anywhere, please let me
|
---|
| 106 | know.
|
---|
| 107 |
|
---|
| 108 |
|
---|
| 109 | FREQUENTLY ASKED QUESTIONS
|
---|
| 110 | --------------------------
|
---|
| 111 |
|
---|
| 112 | Q. What is F-Script?
|
---|
| 113 |
|
---|
| 114 | A. F-Script is a dialect of Smalltalk which includes a bridge to
|
---|
| 115 | the Objective-C runtime on Mac OS X. It's open-source, and
|
---|
| 116 | very nice. Its author, Philippe Mougin, has written several
|
---|
| 117 | articles on it, and documentation is available from the
|
---|
| 118 | F-Script Web site:
|
---|
| 119 |
|
---|
| 120 | <http://www.fscript.org/>
|
---|
| 121 |
|
---|
| 122 |
|
---|
| 123 | Q. How do you access user interface elements?
|
---|
| 124 |
|
---|
[14] | 125 | A. One way is to access a window and its views programmatically:
|
---|
[7] | 126 |
|
---|
| 127 | > app := NSApplication sharedApplication
|
---|
| 128 |
|
---|
| 129 | > windows := app windows
|
---|
| 130 |
|
---|
| 131 | > windows
|
---|
| 132 | NSCFArray {<NSWindow: 0x186770>, <NSWindow: 0x1ba4a0>, <NSWindow:
|
---|
| 133 | 0x1f0cea0>}
|
---|
| 134 |
|
---|
| 135 | > windows collect: [:each | each title]
|
---|
| 136 |
|
---|
| 137 | error: an instance of NSWindow does not respond to "collect:"
|
---|
| 138 |
|
---|
| 139 | (...a gentle reminder that this is not Smalltalk...)
|
---|
| 140 |
|
---|
| 141 | > windows title
|
---|
| 142 | {'F-Script', '', ''}
|
---|
| 143 |
|
---|
| 144 | (...but F-Script has some tricks of its own...)
|
---|
| 145 |
|
---|
| 146 | > fsw := windows at: 0
|
---|
| 147 |
|
---|
| 148 | > fswView := fsw contentView
|
---|
| 149 |
|
---|
[14] | 150 | To open an F-Script object browser on fswView, type:
|
---|
| 151 |
|
---|
| 152 | > sys browse: fswView
|
---|
| 153 |
|
---|
| 154 | Or, click ÒNew Browser: Object...Ó, then click on fswView.
|
---|
| 155 | Click 'subviews' in the message list. You can use 'subviews'
|
---|
[7] | 156 | repeatedly on container views if needed.
|
---|
| 157 |
|
---|
| 158 |
|
---|
[14] | 159 | Q. ThatÕs too hard, especially all that scrolling.
|
---|
[7] | 160 |
|
---|
[16] | 161 | A. If you need to access a view (such as a button or text field), menu or
|
---|
[14] | 162 | window, youÕre in luck. Click in an F-Script workspace window, then
|
---|
| 163 | choose ÒAssociate With InterfaceÓ from the ÒFSAÓ menu.
|
---|
| 164 | Follow the instructions in the window to select a user interface
|
---|
| 165 | element, view it in an object browser or assign it to a variable.
|
---|
[7] | 166 |
|
---|
[153] | 167 | The F-Script object browser now provides a similar feature: click the
|
---|
| 168 | "Select view" button.
|
---|
[7] | 169 |
|
---|
[14] | 170 |
|
---|
[16] | 171 | Q. I donÕt like F-ScriptÕs syntax. I don't like the object browser.
|
---|
| 172 | I donÕt like you either.
|
---|
| 173 |
|
---|
[14] | 174 | A. I didnÕt write F-Script. Please address your questions to
|
---|
| 175 | F-ScriptÕs author or the F-Script mailing list.
|
---|
[7] | 176 |
|
---|
| 177 | <http://www.fscript.org/contacts.htm>
|
---|
| 178 |
|
---|
| 179 | Oh, and get lost.
|
---|
| 180 |
|
---|
| 181 |
|
---|
| 182 | Q. My question isn't answered here.
|
---|
| 183 |
|
---|
| 184 | A. That's not a question. But if you have a question about F-Script
|
---|
| 185 | Anywhere, a suggestion or a bug to report, please email it to me at
|
---|
| 186 | <fsa@sabi.net>. Please try to keep your messages short and to the
|
---|
| 187 | point, and I'll get back to you as soon as my schedule will allow.
|
---|
| 188 | Thanks!
|
---|
| 189 |
|
---|
| 190 |
|
---|
| 191 | VERSION HISTORY
|
---|
| 192 | ---------------
|
---|
[227] | 193 | 1.3 - 5 May 2006 - Fixed leaking of file handles
|
---|
| 194 | - Removed deprecated F-Script functions
|
---|
| 195 | - New associate option that automatically
|
---|
| 196 | brings up a new browser without an
|
---|
| 197 | interpreter window
|
---|
| 198 | - Auto-inject feature
|
---|
[153] | 199 | 1.2 - 5 January 2004 - fixed window behavior on startup, delaying
|
---|
| 200 | display until launch is complete
|
---|
| 201 | - replaced libPatch with mach_inject and
|
---|
| 202 | SCPatch: provides improved compatibility
|
---|
| 203 | with Mac OS X 10.3 (doesn't crash randomly
|
---|
| 204 | any more!)
|
---|
| 205 | - no longer requires F-Script Anywhere
|
---|
| 206 | application to be running while installed
|
---|
| 207 | in applications
|
---|
| 208 | - F-Script Anywhere can now be installed in
|
---|
| 209 | itself
|
---|
| 210 | - check for F-Script version on startup
|
---|
| 211 | - use new, documented F-Script API for
|
---|
| 212 | identifier validation in associate window
|
---|
| 213 | - prepared for localization
|
---|
| 214 | - enable "Install" button when appropriate at
|
---|
| 215 | application startup
|
---|
| 216 | - fixed focus ring "flicker" on Mac OS X 10.3
|
---|
[16] | 217 | 1.1.5 - 1 October 2002 - better identify Cocoa vs. Carbon applications
|
---|
| 218 | on Jaguar; added hierarchical window list to
|
---|
| 219 | FSA menu; fixed startup crash on Puma with
|
---|
| 220 | certain Carbon CFM applications
|
---|
| 221 | 1.1.4 - 25 August 2002 - fixed miscellaneous Jaguar issues; worked
|
---|
| 222 | around broken application quit notifications;
|
---|
| 223 | added unique interpreter/associate window titles
|
---|
| 224 | 1.1.3 - 24 July 2002 - added bullseye-menu targeting cursor; added menu
|
---|
| 225 | association; work around bug by stopping capture
|
---|
| 226 | on suspend; added delegate, data source, target,
|
---|
| 227 | cell selection for views; window controller for
|
---|
| 228 | windows
|
---|
[14] | 229 | 1.1.2 - 18 July 2002 - fixed more startup issues with list management;
|
---|
[7] | 230 | properly scale icons of apps which have no
|
---|
[14] | 231 | small icons; added user interface association
|
---|
[7] | 232 | 1.1.1 - 3 July 2002 - fixed inefficiencies responsible for long
|
---|
| 233 | startup time; reorganized Window menu; support
|
---|
| 234 | paths to applications which contain non-ASCII
|
---|
| 235 | characters [Martin Hcker]; added sample code
|
---|
| 236 | to grab UI elements [Philippe Mougin]; cleaned
|
---|
| 237 | up code and distribution layout
|
---|
| 238 | 1.1 - 25 April 2002 - revised terminology; updated for F-Script 1.2;
|
---|
| 239 | zoom to fit in application list; added help
|
---|
| 240 | tags for workspace; focus workspace initially
|
---|
| 241 | 1.0.2 - (unreleased) - minor cleanups, added error messages, updated
|
---|
| 242 | scroll view component for faster UI response,
|
---|
| 243 | removed help menu item because it's useless
|
---|
| 244 | 1.0.1 - 1 March 2002 - corrected message for error 5; libPatch 1.2;
|
---|
| 245 | fixed endless confirmation on window close
|
---|
| 246 | 1.0.1d1 1 February 2002 - added error messages
|
---|
| 247 | 1.0 - 3 February 2002 - added dock menu, URL launching, check for
|
---|
| 248 | F-Script framework, floating window,
|
---|
| 249 | application name in interpreter window title,
|
---|
| 250 | fixed bugs, cleaned up error handling,
|
---|
| 251 | licensed under the GPL (because of ASM code),
|
---|
| 252 | packaged, added Read Me file and license
|
---|
| 253 | 1.0d1 - 1 February 2002 - proof of feasibility, private test version
|
---|
| 254 |
|
---|
| 255 |
|
---|
| 256 | CREDITS
|
---|
| 257 | -------
|
---|
| 258 |
|
---|
| 259 | Thanks to the following people for their software and generous
|
---|
| 260 | donations of source code:
|
---|
| 261 |
|
---|
| 262 | Philippe Mougin, for F-Script
|
---|
[153] | 263 | Jonathan 'Wolf' Rentsch, for mach_inject
|
---|
| 264 | Jon Gotow, for SCPatch and lots of advice
|
---|
[7] | 265 | Mike Ferris, for TextExtras
|
---|
| 266 | Apple, for Darwin
|
---|
[153] | 267 | Frank Vercruesse, for ASM
|
---|