I think your best bet is to start in the help manual under the Scripting and Scripting Reference sections. There are several examples in the manual as well as a library of scripts released by both GPSoft and other forum users in Script Buttons & Add-Ins forum which you can download and learn from.
As an example of how to get started quickly (you'll be better off if you've had prior scripting experience), I think what I did in my LinkedTab_AutoOpen_Handler script add-in could be easily adapted to do what you described in that other thread you linked to...
In that script, I associate two different folder paths, and implemented the script as an 'event handler' that gets called when Opus fires the OnAfterFolderChange. What this means is that when you enter a folder (dbl-clicking on a folder in the lister, using a button or hotkey that runs a 'Go' command to open a folder, typing it in the address bar, etc), Opus calls the script and passes it a bunch of info, including the path of the folder you just opened. With that information, my script compares the folder path opened to see if it is included in the list of folders that can be paired with one another by the user in the script options.
Rather than use a file in each folder, you can adapt a similar technique such that you can pair up a folder path with the layout you want the script to load when you open the folder path... You don't "have to" of course, but it prevents you from needing to leave extra files around all over the place just to trigger the script. I can post an example modification to my own script here for you to check out, use, learn from or ignore as you see fit...