Contextual menu items and ideas
What truly 'context' dependent items can we add to this menu?
Items could operate on the current word, paragraph, function, etc.
See these web sites for some MacOS contextual menu modules to generate some ideas of things that could be implemented in Alpha using Tcl:
In this sites you'll find 50 different variations of how to change the 'type' and 'creator' of various files, another 20 that display the contents of surrounding folders, and a few that enable the automatic typing of commonly used text strings. Any of that sound familiar? (Think about File --> Get Info -- option-titlebar -- electric completions ... and this doesn't even start to get into all of the mode specific command-double-click help/info providers.)
In many ways, Alpha has been providing methods for context-specific information/utilities for a very long time. Some of these functions have already been ported to the CM -- we have window paths, open windows, related files, recent files, recent folders, MacOS window/system, vcs menu, window marks, www dictionaries, www searching, new document options ... Trying to figure out what Alpha does not do already is rather challenging!
Sections below include:
(??) I like the idea of a "Speak Text" contextual menu item --- can this be done by sending an appropriate apple-event?
(bd) There is indeed a way to interact with the Speech Synthesis Manager using AppleEvents.
There is a small script called speak.tcl on my web page at
which defines three simple procs:
The AppleEvent is basically like this:
AEBuild -r 'MACS' syso ttos ---- [tclAE::build::TEXT $txt] \ VOIC [tclAE::build::TEXT $voice]
Try for instance from Tcl shell (very funny, I love this one) :
AEBuild -r 'MACS' syso ttos ---- [tclAE::build::TEXT "To be or not to be that is the question"] VOIC [tclAE::build::TEXT "Bad News"]
(??) Hmm - this doesn't seem to work in Alphatk's Tcl shell: I get "Couldn't print AEDesc: OSErr -1704"
(bd) I get the same error from AlphaX BUT the following works instead
AEBuild -s syso ttos ---- [tclAE::build::TEXT "To be or not to be that is the question"] VOIC [tclAE::build::TEXT "Bad News"]
It means sending the AE to Alpha itself since syso/ttos is a scripting addition and TclAE now loads the OSAXen into Alpha on startup.
(bd 03/04/01) Alternatively one can use Mats Bengtsson's Tclspeech. It is included in the BI Distribution of Tcl/Tk for OSX; here is also a build (to put in the "Extensions:Tool Command language" subfolder of the System folder) for Alpha8 under OS9:
The example above becomes:
package require TclSpeech speech::speak "To be or not to be that is the question" -voice "Bad News"
(cbu 21 April 03) Thanks, Bernard, for pointing out the TclSpeech package, and for porting it to MacOS9. I've created an AlphaTcl interface to this in a new AlphaTcl feature named Speak Text. It creates a contextual menu module to speak the current text, as well as to define the default voice, pitch, and speaking rate. While text is being spoken, a floating Speech Console menu is created, which includes buttons to continue/resume/stop speaking. You can find version 1.1.4 here:
This does require the TclSpeech package described above, as well as the MacOS, and has been tested in Alpha8 and AlphaX. This package creates a few speaking procs that can also be called by any other code in AlphaTcl, see the notes in the source file for more information.
N.B. There appear to be some issues with Alphatk (OSX) and the floating Speach Console menu, but I think that this is a core problem that needs to be addressed in bugzilla. Bug# 765 [http://www.maths.mq.edu.au/~steffen/Alpha/bugzilla/show_bug.cgi?id=765] is one of these bugs, re 'black' floating menus with the current Tk-Aqua build. Another is how float deals with menus that are already floating, Bug# 902 [http://www.maths.mq.edu.au/~steffen/Alpha/bugzilla/show_bug.cgi?id=902]. If Bug# 765 was fixed so that we could actually see the menu, there might be other issues to deal with as well, but at the moment we can't see them!
File / Window Compression
(cbu 21 April 03) I would like some items to stuff/zip/tar the current window, using the DropStuff etc. applications. I've updated the fileUtils.tcl file to include this, you can find it (version 1.3.1) here:
It creates a new CM menu named "Compression", with items to compress the current window, the current window's folder, or all open windows, using any of DropStuff/Zip/Tar. It is not necessary to activate the File Utils package to have these items available in the CM.
N.B. This is a major update of this package. In particular, all of the 'Window lines' utilities have been modified to return their results in a new window, rather than modifying the current selection.
Create Hyperlinks / Color Text
(cbu 22 April 03) The Colors Menu was updated a while back to make it much more useful for 'normal' users to use this package to create colors/hyperlinks within their text documents. A CM module to create hyperlinks for the surrounding text (i.e. hyperlinks to e-mail addresses, urls, local files, etc.) using some of the items in the Colors Menu --> Hyperlink Text submenu would be handy.
I've update the colorsMenu.tcl file to add this. It is really a minor change, creating a preinit argument to the package's menu declaration. You can find version 1.2 here:
This also creates a Color Style Text CM module. Both of these are turned off by default, but are available even if the Colors Menu has not been globally activated.
More ideas ??
If you have a request, place it here!