Last updated on June 24th, 2013
Sometimes we get so used to how software works that we just miss if anything works differently. I am amazed to how many users I talk who have never noticed this feature in PrimalScript, even though it has been there since 2.0…
In case you don’t remember, that was in the year 2000. I hope you a appreciate that I had to look for the dates scribbled on backup CDs from 12 years ago to find out when that version was released.
If you feel nostalgic, here are some screenshots from PrimalScript 1.0 (1998) and 2.0 (2000)
And yes, these old versions still install and run on Windows 7. Amazing!
So what is this feature I am talking about?
Don Jones called it “Infinite Undo” one time or another, we usually refer to it as undo across sessions.
With most software, once your delete something, save and exit there is no way to just simply press Ctrl+Z and undo whatever you messed up the night before.
Not so in PrimalScript.
(NOTE: Don’t try this at home until you read to the end, ALWAYS make a backup of all your files)
We take some bigger script file for our demonstration, for example the spaceinvaders implementation in powershell, psinvaders.ps1
Now we do something really bad and delete a big chunk in the middle:
And save it.
Now we exit PrimalScript.
We open the file in notepad just to show how bad this would be…
You notice that there is no PrimalScript in the task bar.
Now start PrimalScript again, press Ctrl+Z and save. All good.
It’s not really a big secret how this is done. PrimalScript stores your undo information in an alternate file stream with your script. Well, if your file is on an NTFS partition, like most Windows machines have. If your files reside on a flash drive, NAS (with Linux) or any other drive that does not have NTFS this won’t work. But if you are your average Windows user, go and undo the stuff you dreamed up last night and that turned out to be not such a good idea. Beats scrambling for a backup file, if you have one.