newLISP Fan Club
Forum => newLISP and the O.S. => Topic started by: Cyril on March 26, 2010, 07:28:58 AM
In the brave Unix world, anything with an 'x' bit set is an executable, and the interpreter is determined by #! notation. In Windows, you need a real .exe file sometimes. One particular case is Windows screensavers, which in fact are .exe files with .scr extensions.
Quote
BTW, screensavers are not only to save your screens! It is just a handy way to do something useful when your computer is idle.
Of course you can link the newlisp executable with your code, but then you lose one of the advantages of scripting languages: ability to modify your code and run it immediately. Linking is too similar to compilation. :-( My solution is to link the newlisp executable with this one-liner:
(load (replace {.[^\.]*$} (main-args 0) ".lsp" 0))
, then rename the resulting executable to, say, ushaper.scr. Then copy it into your c:windowssystem32 folder, set it as your screen saver, and, on run, it will just load ushaper.lsp from the same directory. The only disadvantage is that you must maintain two files instead of one, but in fact the first one don't need any "maintenance".
BTW, "ushaper" is not just a random name, it is my small script to shape uTorrent client bandwith: give it more when you are away, get it back when you return to you computer. Source is here (//http). ;-)