Before encrypting a macro, you first create and debug the macro as usual. When you create an encrypted macro, you are responsible for keeping the original source file. You cannot recreate the source file from an encrypted macro. You then add an /ENCRYPT command as the first line and last of the macro. The /ENCRYPT command for the first line of the macro has the following syntax:
/ENCRYPT,Encryption_key,File_name,File_ext,Directory_Path/
Where
Encryption_key is an eight-character
password.
File_name is the name of the encrypted
macro filename.
File_ext is an optional file extension
for the encrypted macro file. If you want users to execute the macro as an
"unknown" command, you should use the .mac
extension.
Directory_Path/ is the optional directory
path that can contain up to 60 characters; you only need this argument if
you do not want to write the encrypted macro file to your "home" directory.
Note the placement of the /ENCRYPT commands at the top and bottom of the listing in the following example:
/encrypt,mypasswd,myenfile,mac,macros/ /nopr /prep7 /view,,-1,-2,-3 block,,arg1,,arg2,,arg3 sphere,arg4 vsbv,1,2 /gopr finish /encrypt
The /ENCRYPT command at the top of the macro instructs Mechanical APDL to encrypt the file and use the string "mypasswd" as the encryption key. It will create an encrypted macro file called myenfile.mac and place it in the /macros subdirectory of the home directory. The /ENCRYPT command at the bottom instructs Mechanical APDL to stop the encryption process and write the encrypted macro to the specified file.
Note: The encrypted macro uses a /NOPR command as its second line to turn off echoing of Mechanical APDL commands to the session log file. This is important if you wish to prevent users from reading the contents of the macro from the session log. It's a good practice to reactivate the session log by issuing the /GOPR command as the last command in the macro before the ending /ENCRYPT command.