Execute code via comand prompt

Execute code via comand prompt raises those errors below:

I tried to run the code that is in the link below.
http://nxjournaling.com/content/using-message-boxes
It is normaly working by running in NX Journal editor window.

The error text that I got when I run this on command prompt:

The MSVCDir environment variable is not defined
This variable is necessary only when using uflink or starting up Studio
from this window. You must modify the ufvars.bat file to define this.

C:\Program Files\Siemens\NX 8.0\UGII>"%UGII_ROOT_DIR%\run_journal.exe" "D:\journ
als\jr3.vb"
Line 16: Type 'UI' is not defined.
Line 37: 'NXMessageBox' is not declared. It may be inaccessible due to its prote
ction level.
Line 46: 'NXMessageBox' is not declared. It may be inaccessible due to its prote
ction level.
Line 48: 'NXMessageBox' is not declared. It may be inaccessible due to its prote
ction level.
Line 50: 'NXMessageBox' is not declared. It may be inaccessible due to its prote
ction level.
Line 54: 'NXMessageBox' is not declared. It may be inaccessible due to its prote
ction level.
Compilation failed

C:\Program Files\Siemens\NX 8.0\UGII>

I could not realise why this happen
Thanks

When you use "run_journal", NX executes in "batch" mode - i.e. there is no visible interface available to the user. Any attempts by the code to call the UI (user interface) commands (such as showing an NX message box) will fail. The journal code will need to be modified so as to not make use of any UI commands.

If I remember correctly, any calls to the "listingWindow.Write" commands will be OK as they will be written to the log file instead of the information window.