Well, that opens a can of worms. It’s not a simple goal, but the goal is simplicity.
As Pacal and other have famously said, please forgive the length of this note, I don’t really have time to make it shorter.
I am not trying to “learn how to program” nor am I trying to learn how to write Mac apps to sell or even give away on the App Store. I’m building a tool to help me manage how I work on my Mac. If it develops into something I can share with other people, great, but my first goal is my own use.
As for my programming background, I have a degree in Information Science and I’m “officially” a UNIX Guru because I wrote my own Troff macro set, way back when, that even included macros that redefined other macros. If you know anything about Troff, you probably know that it does not have parentheses or brackets or anything that nests the way we’re used to in modern languages. I was able to write macros that defined a scope and that could end, not with a separate macro for each ending as was the common practice (e.g. a Pull Quote format starts with .PQ and ends with .QP) but rather I could end a macro’s influence with a standard “end of scope” macro that would close out that context because that macro was redefined every time a scope macro was invoked. Essentially I wrote a “context switcher” in Troff. It worked well. I had a half dozen people in my publications team using that macro set on a daily basis for a couple of years.
When I worked at Adobe where we were required to “eat our own dogfood” and do all documentation review using PDFs, I wrote my own tools to tag other people’s PDF comments in the markups with my working status for their comments: To Do, Working, Completed, Postpone, Rejected, Questions to Research, Questions to Delegate. All written in JavaScript for Acrobat. I showed it to Engineering and they incorporated some of my idea into Acrobat, but they had an overly simplified, canned list of statuses rather than letting the user define their own.
I have some experience with programming projects.
But that JavaScript and a little bit of Ruby for SketchUp is basically the limit of my Object Oriented programming. I’m still learning when and how to use a Class is even though I took a course in Lambda Calculus in college.
Just like those two historical examples, what I’m working on now is building a tool to smooth my own workflow to do things that I’ve been unable to find out there.
In this case, I use Mission Control a LOT. Instead of the presumed max of 16 MC Desktop Spaces, where using more than about 5 or 6 becomes awkward, I currently have 45 Desktops, about 22 of which are in daily use.
To manage that, I want to be able to assign text names to those Spaces and be able to change Spaces by menu or hotkey. The hotkey side of things I expect to be able to accomplish with Keyboard Maestro.
For the assigning names and listing them in a menu, I have a very simple app which, when given a text list, will make small windows, titlebar only, stacked in the lower left corner of the screen, with each title being a line from the given list. I can manually move those windows, one at a time, to various MC Desktop Spaces where they become my name for that Desktop Space. With that app active, its Window menu gives me a dropdown menu of all the named Spaces, the current one is checked, and when I pick another, I move over to that particular space. So I can pop from Desktop to Desktop by menu with text names of arbitrary length.
But I want to be able to make the windows not by a hardcoded list but via AppleScript (or maybe the command line), which I will probably invoke with Keyboard Maestro, so that instead of having to make the window titles on startup and having to manually move them to the appropriate Desktop, I can automatically change Desktops and then automatically make the window title for the current Desktop on that Desktop. That not only lets me automate setting up the system, I expect it will let me make tools that I can use to change things on the fly, rename a Desktop Space or add a name to an unnamed one, etc. By having the name of the Desktop Space be determined by an app window, I can rearrange the order of the Desktops and the names move along with the reordering, something the MC Desktop 1, Desktop 2, etc. naming system does not handle.
So I’m trying to learn how to add AppleScript to my existing extremely simple app, or add a command line interface to it, to be able to invoke my little Window-Title-Making function.
I’ve been trying to work my way through Sarah’s old tutorial on “Scriptable Tasks”. But it feels like jumping into the deep end of a pool that’s covered with lily pads.
I just want to add AppleScript commands to my extremely simple window-making app. But every page of documentation and every tutorial that I have found is either too simplistic or else it presumes too much and I can’t follow it enough to sort out the errors.
I was hoping this book might help me that gap.