Scripting in OSX and Windows 10

There are 3 replies in this Thread which has previously been viewed 1,980 times. The latest Post () was by Rice.

  • This is a followup to the discussion started in "In Need of a New Apple Computer."


    Ben asked if Windows 10 scripting features had improved, because he likes what the Mac offers. I don't do scripting myself, but I do believe that this articleexplains the current state of Windows 10's abilities - and they're identical to Apple's, because it's the same Unix utility, called Bash.


    Ben, if you care to comment?


    Edit: Re-reading the article, I guess it's not a direct import from Apple, but from Linux. Still, it may do what you need, if the Mac Unix scripting is compatible with Linux.

    • Official Post

    If I am not mistaken, Apple's Terminal is unix based.

    I did dip a fingernail into Linux while I was at the university, but it was just to try out Ubuntu. It was too hard even to do the simplest things, but I can see where the fun is if you are into coding and have time to spare.

  • Sorry just seeing this now!

    The Mac’s scripting tools arise not from the fact that it’s built on top of Unix. It is, but that isn’t the point - in fact, AppleScript existed before the NextStep transplant that made the macOS’s guts Unix-y.


    What Apple has done is implement a system-wide architecture called Apple events, which apps can respond to. Every app that works with these events comes with a scripting dictionary that indicates what kind of actions you can trigger in that app. And there are standard suites of actions/events that come “for free”. It used to be that the only language that you could use to script these events was AppleScript, an interesting creature shall we say. But now JavaScript can be used as well.


    Because this system caught on, customers have come to expect that serious Mac apps come with a decent scripting dictionary.


    Microsoft Office on the Mac comes with a comprehensive scripting dictionary. Google Chrome for the Mac has one too - in fact, one of the scripts I use several times a day takes data from the clipboard in text format, uses a bunch of regex patterns to coax out all the info I need and put it into a JavaScript object, and then makes an email message prepopulated with that data, properly formatted. The script then rolls it into a JSON object, fires up a new tab with Google Chrome, and puts that JSON object into a parameter in a custom URL that calls a Google Apps Script, which in turn takes that JSON object and files my data away in a Google Sheet which I use as my database.


    Because the program which my data is coming from is a Windows app (which I’m running in Parallels Desktop), I can't automate the process 100% - first I need to select the text, and copy it to the clipboard. Once I’ve done that, though, I press one keyboard shortcut and the whole thing is just done. Seamlessly. Takes the info off the clipboard, and within 3 seconds it’s filed away in my Google Sheets spreadsheet, and I have a email ready to look over and send.


    I know of no way of doing anything remotely similar in Windows. (If anyone knows a way, please let me know). And the Mac comes with a whole bunch of automation goodies like that. Once you’ve learned some basics, you can do some very powerful things.


    But again - the bash shell has nothing to do with any of this.

    I do airline tickets, car rental, hotels, cruises, insurance, and all-inclusive packages.

    If you want great service and low prices, look no further.
    I also sell local SIM cards for several countries.
    ben@kanfeinesharim.com