有时候,编程人员想要阻止其他用户访问脚本的源代码。在2600系列[1]数据源表中,可以使用二进制发行示例脚本(可以从www.keithley.com网站获得)使得脚本源代码读取困难。不过,在 2600A系列[2]数字源码中,可以删除脚本源代码,但仍然保持运行脚本的能力。为了删除脚本源代码,可以将脚本属性设置为零。然后,读取源代码只返回该代码的二进制编码版本。下面就是如何删除myScript源代码的实例。其中包括试图找回脚本源代码的结果。
Occasionally, programmers want to discourage other users from accessing the source code of a script. In the Series 2600instruments, the Binary Distribution example script (available onwww.keithley.com) could be used to make it difficult to read thescript source code. In the Series 2600A instruments, however,the source code of a script can be deleted and still maintain theability to run the script. To delete the script source code, set thesource attribute of a script to nil. Afterward, reading the scriptsource code returns only the binary-encoded version of the code.The following is an example of how to delete the source codeof the myScript. The results of attempts to retrieve the scriptsource code are included.
myScript.source = nil
print(myScript.source)