ThinkC MacDock dev progress -- Like today's macOS Dock but for System 7

Relating to ThinkC Development

retr01

Senior Tinkerer
Jun 6, 2022
2,469
1
778
113
Utah, USA
retr01.com
I'm unsure if there is a database file of Apple Events Registry circa 1990-1993 for System 7. It looks like the earliest version of that File Maker database file covers MacOS 8 and on, not before.


There has to be an AE registry somewhere for System 7.
 

Crutch

Tinkerer
Jul 10, 2022
292
226
43
Chicago
Applications that support AEs via AppleScript are supposed to be self-documenting.

Open the AppleScript “Script Editor” application. Go to File/“Open Dictionary…”. Go to your System Folder and open the Finder. You’ll then be able to see everything supported by the Finder via AppleEvents from AppleScript, including this:
1683928664099.png
 

MacOfAllTrades

Tinkerer
Oct 5, 2022
158
163
43
Applications that support AEs via AppleScript are supposed to be self-documenting.

Open the AppleScript “Script Editor” application. Go to File/“Open Dictionary…”. Go to your System Folder and open the Finder. You’ll then be able to see everything supported by the Finder via AppleEvents from AppleScript, including this: View attachment 12267
Yes - thanks. I sew this but I don't know enough to be able to turn that into a proper setup for an AppleEvent call. For example what keywords to use.. do I have to add a parameter to specify the file location etc. etc. etc.

Is it possible to determine all of those nuances of setting up an Apple Event by way of the dictionary?
 

Crutch

Tinkerer
Jul 10, 2022
292
226
43
Chicago
Yes - thanks. I sew this but I don't know enough to be able to turn that into a proper setup for an AppleEvent call. For example what keywords to use.. do I have to add a parameter to specify the file location etc. etc. etc.

Is it possible to determine all of those nuances of setting up an Apple Event by way of the dictionary?
Yes, check out the ‘aete’ resource in the Finder (or any application) for the details. The presence of these resources is what tells Mac OS an application is scriptable and what sort of AppleEvents it responds to, as well as telling the Script Editor how to display its dictionary. For example, in Finder 7.5.5 as seen through Resourcerer:

(For details on aete resources and what all this means, check out IM:Interapplication Communication, chapter 8, I believe.)
1683952765420.png
 

MacOfAllTrades

Tinkerer
Oct 5, 2022
158
163
43
Ah yes -- Resourcerer!! Link included because took me a minute to find it and then a second to find it for 68k.

I'll work on this.

A decent book. Ultimate Mac Programming (1994) had IMHO a better quick intro to apple events than Inside Macintosh's interprocess comm. chapters. I'm noting it here in case others want an alternate resource in the future. In fact - it also suggests Resorcerer to view aete resources.

Thanks!
 
  • Like
  • Love
Reactions: eric and retr01

Crutch

Tinkerer
Jul 10, 2022
292
226
43
Chicago
A decent book. Ultimate Mac Programming (1994) had IMHO a better quick intro to apple events than Inside Macintosh's interprocess comm. chapters. I'm noting it here in case others want an alternate resource in the future.
That’s a great book, it has the best published (that I have seen) material on how to write trap-patching INITs outside of MacTutor. I have a physical copy in my bedroom closet!
 

retr01

Senior Tinkerer
Jun 6, 2022
2,469
1
778
113
Utah, USA
retr01.com
Ah yes -- Resourcerer!! Link included because took me a minute to find it and then a second to find it for 68k.

Aha. I'll explore. Macintosh Garden, here I come! :)


A decent book. Ultimate Mac Programming (1994) had IMHO a better quick intro to apple events than Inside Macintosh's interprocess comm. chapters. I'm noting it here in case others want an alternate resource in the future. In fact - it also suggests Resorcerer to view aete resources.

Cool! I came across The Tao of AppleScript by Derrick Schneider (1993), an interesting take on AppleScript. The Berkeley Macintosh Users Group (BMUG) had several editions of another book, Zen and the Art of Resource Editing The BMUG Guide to ResEdit, by Derrick Schneider, Hans Hansen, and Noah Potkin.
 

MacOfAllTrades

Tinkerer
Oct 5, 2022
158
163
43
Hey all -- Life's kept me busy with unrelated projects but I spent some time on this this week.

I'm trying to work my way up to a few new features that involve MacDock getting the finder to do a few things:
  1. Show the application in the finder (e.g. command click on the dock item and this should make the Finder open the parent directory containing the app)
  2. Open a file/app/folder (long-term this will lead to supporting what is like the right-hand-side of modern macOS Dock -- that is where you can add files or dirs from your desktop onto it so later you click it and it opens that file or dir)

To work my way up towards #2 above I figured first, I'd try making the finder just open some arbitrary file. Since I have FSSpec records for each of the MacDock items I figured I'd just use one of those for testing purposes.
In short - the following code doesn't work. The AE does make it to the finder but Finder just gives me an error message saying
1686271681836.png


The Alias Handle I make seems to check out as I can use the GetAliasInfo(..) function to properly get details about the alias I've made.

So I just be messing up something else. Feel free to rip on how I'm creating the AE descriptors etc.. I'm very green at it. But In short I'm creating a Descriptor List to be the sole parameter sent in the AppleEvent. It is a list of aliases for the "sope" event to open -- in this case just a one-item list.

The code does the following:
  1. create the AppleEvent and the applSignature for Finder (MACS)
  2. create an alias
  3. create a descriptor list
  4. then I make the alias into a descriptor
  5. add it to the descriptor list
  6. put the descriptor list as a parameter in the AE
  7. send the AE
Anyway something is wrong and I'm sure it's. dumb mistake on my part but any light shed on this would be appreciated!! I'll save my questions about feature #1 later

/** Trial function to use AppleEvents to open a file ** Later will be modified to open the parent directory of an app (e.g.) **/ void OpenApp(){ OSErr err; AEDesc aeDesc = {typeNull, NULL}; long appSig, aliasKW; AppleEvent appleEvent, reply; AliasHandle myAlias; AEDescList myList, aliasDesc; Str63 aliasInfo; appSig = 'MACS'; err = AECreateDesc(typeApplSignature, (Ptr)(&appSig), (Size)sizeof(appSig), &aeDesc); if(err != noErr) {SysBeep(10); ExitToShell();} err = AECreateAppleEvent('FNDR', 'sope', &aeDesc, kAutoGenerateReturnID, 1L, &appleEvent); if(err != noErr) {SysBeep(10); ExitToShell();} err = NewAlias(nil,&(gFSSpec_arr[1]), &myAlias); if(err != noErr) {SysBeep(10); ExitToShell();} err = GetAliasInfo(myAlias, asiVolumeName, aliasInfo); err = GetAliasInfo(myAlias, asiParentName, aliasInfo); err = GetAliasInfo(myAlias, asiAliasName, aliasInfo); // NOTE the above 3 AliasInfo responses all check out good err = AECreateList(nil, 0, false, &myList); if(err != noErr) {SysBeep(10); ExitToShell();} err = AECreateDesc(typeAlias, (Ptr)(&myAlias), (Size)sizeof(myAlias), &aliasDesc); if(err != noErr) {SysBeep(10); ExitToShell();} err = AEPutDesc(&myList, 1, &aliasDesc); if(err != noErr) {SysBeep(10); ExitToShell();} err = AEPutParamDesc(&appleEvent,'fsel',(&myList)); if(err != noErr) {SysBeep(10); ExitToShell();} err = AESend( &appleEvent, &reply, kAENoReply+kAECanInteract+kAECanSwitchLayer, kAENormalPriority, kAEDefaultTimeout, nil, nil); if(err != noErr) {SysBeep(10); ExitToShell();} AEDisposeDesc(&aeDesc); AEDisposeDesc(&aliasDesc); }
 

MacOfAllTrades

Tinkerer
Oct 5, 2022
158
163
43
IMG_3564.jpeg

It says “Alias for folder containing the items”. Then it says further down “List of aliases for items in the folder”

does this mean the parameter to the apple event should be a list of aliases the finder should open or do i first give it an alias of the folder containing the items..?
 

Crutch

Tinkerer
Jul 10, 2022
292
226
43
Chicago
I don’t personally know as I’ve never used AEs for this - you might want to try asking over on 68kmla where there are a few more experienced 68k devs lurking around I think. (Hope that’s OK to suggest)
 
  • Like
Reactions: Patrick

MacOfAllTrades

Tinkerer
Oct 5, 2022
158
163
43
Quick update -
With the great help of folks over at 68kmla, based upon the suggestion from Crutch on here, the AppleEvents thing was figured out.

Link to thread here but for continuity here's the deal:

Only a portion of scriptable calls are in the Finder (at least in as late as 7.5.5). Additional ones (3 "Suites" worth actually beyond what's in the resource fork of Finder) are in the Finder Scripting Extension extension that is in the Extensions folder (but only appeared in like 7.5.2 I believe(?)).

There I found some better-suited events for what I was doing. Namely the Reveal event.
It takes in an FSSpec descriptor as a parameter (rather than a list of aliases as I was trying to make before for the Open apple event with eventID "sope").

Anywho after some awesome support and even example code thrown my way by member "cheestraws" at 68kmla I was able to make it work on my side.


So without further ado -- here it is. When you have the Command key pressed down and click on an item in MacDock it will pull up the location of that application in the Finder. Again - this is just like in modern macOS btw!

With this feature (in the update coming soon to MacDock) both the Cmd+click and Option+Click will work as they do in modern macOS. Note that the option+click came 'for free' based on how the Apple's provided / built-in "LaunchApplication(..)" function behaves which was neat.

Thank you all for the help. This has been on my back for a while and I've wanted to figure it out. I'm grateful for the opportunity to keep learning about these old system features.

As always - feel free to mention ideas for features etc. either here or as a comment or issue on the git repo.

Off top of my head the stuff I want to do next are:
1. Make the app backward compatible with System 6 as reasonably possible (i.e. skip apple events etc.)
2. Add support for COLOR icons!
3. Dynamic expansion of the macDock to support more items + wider screen resolutions
4. Support for non-apps (documents and folders etc.) at least for Sys 7 but looking into 6 if possible

Thanks TD!!!
VideoToGif_GIF.gif