Priya,
I think you are seeing this behavior because your code needs to be encapsulated in a function. Then later on, when you want to use the User Command, you can simply type the name of the function to invoke that script. For example, if I was to make your example code into a correctly formed user command, I would have the following:
Function MyUserCommand
if hicuser <> 3.14159 then
if filex(file path) then
Call scriptstart(file path)
end if
hicuser = 3.14159
end if
End Function
Then later in another script or view of DIAdem, I would type "MyUserCommand" (without the quotes) to invoke that function.
The reason that the code executes is because when DIAdem opens, it registers that user command with the system by loo
king for the function names that need to be recognized as user commands. When DIAdem opens, it starts to register the script that you have specified, but instead of finding a function to register, it finds code to execute. Then it executes the code and gets confused why it was executing code from a place that isn't intended to do that.
If you are intending to run code as DIAdem starts, there is an explanation of how to do this in the DIAdem help under the following topics:
- Starting DIAdem with Parameters
- Program Start with Parameters
I hope that helps you. Let us know if you have further questions.
Regards,
Shannon R.
Applications Engineer
National Instruments