So, I’m about one year into using AppleScriptObjC and it’s really great. In fact it is mind blowing!
However, as I use it wherever it’s possible (for me, with my current knowledge) in order to learn about it as fast as I can, I seem to forget how to do even basic stuff in vanilla AppleScript. That’s not a problem per se, but it is definitely a problem when I need to use AppleScript and AppleScriptObjC in one script. It seems I can’t handle those two things together in a good way - always thinking far too long what to use … That also wouldn’t be a problem if I knew both or at least one language very well, but that’s not the case.
So I’m wondering how others make use of AppleScript and AppleScriptObjC. Do you have a strategy when to use what? Do you think about what to use or is it something that simply happens?
It’s something for which you have to develop your own feel. It also depends to a large extent on what you’re most comfortable using.
My own approach is that if a task or part thereof is relatively simple and AppleScript can do it, I use AppleScript, which is likely to be more efficient in such cases. If it’s something which requires, or is more easily or efficiently performed by, system Objective-C methods, then I use ASObjC. The conversion of data between AppleScript and Objective-C classes takes a certain amount of time, so I try not to flip about between data types more often than is necessary.
I’m relatively new to ASObjC but thought I would respond FWIW.
Early on when writing a script, I try to determine whether a particular task should be done with basic AppleScript or ASObjC, and the criteria I employ in making this decision are reliability and speed. Initially I was bothered when using both basic AppleScript and ASObjC in a script, but I’ve now accepted that I should use whichever works best. Just by way of example, I recently revised a script, and I used a list throughout to perform one task and an array throughout to perform a second task. Afterwards, I ran a timing test and the revised script was indeed faster.
The problem with my approach is that it takes time, because I may have to write a code segment twice to see which is faster. Fortunately, my scripts tend to be simple and I have ample time.
As regards forgetting stuff, that happens no matter what I do, and my solution is a well-organized notebook supplemented with Script Debugger clippings.