Re: Notebook that auto-executes when opened?
- To: mathgroup at smc.vnet.net
- Subject: [mg97348] Re: Notebook that auto-executes when opened?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Wed, 11 Mar 2009 04:25:47 -0500 (EST)
On 3/10/09 at 5:33 AM, siegman at stanford.edu (AES) wrote: >AES wrote: >>Is it possible to set an option for a notebook such that it >>automatically begins executing when opened? -- that is, when the nb >>icon is dbl-clicked? >and Jens-Peer Kuska <kuska at informatik.uni-leipzig.de> replied: >>no, it would be the first Mathematica written virus >>My favorite command would be >>DeleteFile/@ FileNames["*.*", {"C:\\"}, 4] >And in any case, if you were malevolent in this fashion, could you >not fairly easily hide your favorite command within a closed but >still executable cell within some large and apparently benevolent >nb, which you might then make available to other people for them to >use in doing some apparently useful task? >Or perhaps bury it in a Mathematica package, or demonstration, or >??? that was then called and executed by this benevolent >program? (I'm not skilled enough in the complexities of >Mathematica to know >just what can and can't be included in structures other than >notebooks.) Yes, such a command can be constructed in a way that would make it difficult to find. Additionally, it could be written in a platform independent way. >Related thought: Should Mathematica perhaps have an option or >preference (which is normally set to ON by default) under which your >favorite command, and others like it, would always trigger an "_Are >you sure_ you want to do this?" dialog before executing? Seems to >me many of the other apps I use have some capability like this, for >protection against accident as much as malevolence. There is something built in to the last few versions of Mathematica to assist in preventing this type of problem. That is the concept of trusted/untrusted directories which the user can set. The idea being anything in an untrusted directory doesn't get executed without some warning to the user. But this isn't equivalent to a "Are you sure?" warning for deleting files. Nor is such a warning desirable for Mathematica. Mathematica is far more than the typical application that contains similar warning messages. Mathematica can be viewed as being a general purpose programming language. In this regard it is no more appropriate to put "Are you sure?" warnings in Mathematica than say a C/C++ compiler. As is the case with a C/C++ compiler, the assumption is the user knows what he is doing with commands such as DeleteFile.