|
From: Kevin W. <kw...@co...> - 2009-08-17 14:20:56
|
Hi Philip, On 8/17/09 8:32 AM, Philip Aker wrote: > > I hope that's what you are using. For CVS HEAD, yes. I'm back to using Daniel Steffen's backport of Tk-Cocoa to 8.5, hosted at Github. For the Cocoa bits, it's identical to 8.6 for testing purposes. > > With the stock 8.6 version as I compiled it, I was able to run a few > standard AppleScript commands like "properties of every window" but not > "do script". So I have tried one method to get "do script" to work. It > does so but at the expense of foregoing the standard Cocoa behaviors. > I'm not sure if I can overcome this limitation but I have another option > I know about to try to have both the standard and custom areas working. > Failing that, I think another choice would be to implement the standard > application and window properties in the Tk code itself. This could be > good because with the stock behavior, the dictionary lies about Wish > having document elements (I couldn't find a single occurrence of > NSDocument doing a search in Xcode -- although it's a well known thing > that Xcode fails to find stuff on a regular basis). > > With the test method I implemented, I also was able to get the 'doit > with parameter…' command to work in C code directly, so at least it > seems it will good for other arbitrary commands as well. This would seem > to mean that if followed through, the standard Wish dictionary could > look very similar to the one I put in the Wishbone example and be > extensible. While that's not exactly plush, it would be an accurate > representation of what a basic Tk application can do, and I think (still > need to do some more testing) that it would enable a theoretical > 14,000,000+ of each of several varieties of custom commands and also > have a print settings record available. I did not have enough time to > test my namespaced proc handler style in AppMain.tcl but I'm reasonably > sure that it will work in 8.6. That's good that you've made progress with this. I've done some further testing myself and found that the "do script" command defined in tkMacOSXHLEvents.c appears to be broken in Tk-Cocoa. Opening the AppleScript dictionary for a standalone build of Wish from Tk-Cocoa yields what I guess is the standard Cocoa AppleScript dictionary, but not the "do script" command. I think one reason for this is that there is no .rsrc file in Tk-Cocoa with the aevt for "do script" contained therein. I don't know how to address this for Tk-Cocoa. I did a quick test of ::tk::mac::OpenDocument (the odoc event), and that works, so my guess is that the events mapped to hard-coded Tcl procedures should continue to work fine. It will be helpful to get the "do script" issue solved for Tk-Cocoa for another reason. The basic Apple events defined in tkMacOSXHLEvents.c duplicate some of what's available in the TclAE extension (Tcl Apple Events); TclAE also allows a much lower-level interface to Apple events. However, I'm not able to compile TclAE to run in 64-bit mode; my guess is that it hooks too deeply into Carbon to work in 64-bit mode as is. So unless TclAE is updated, it won't be a viable solution moving forward. I had one more question. When trying to run a very basic example of "do script" against an AppleScript-enabled version of Wish (Tk-Carbon-based) like so: tell app "Wish" do script "puts foo" end tell I get this cryptic error: Wish got an error: AEDoScriptHandler: invalid script type 'txtu', must be 'alis' or 'TEXT' Any idea what this means? I'm not familiar with the old-school Carbon type-and-creator codes. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com |