08-02-2013 09:56 AM
Hi everyone,
I have some problem with a script I load, that runs a subroutine every time I move the cursor, in VIEW, on a graph. The first time I run the script, it works perfectly. Then I close everything and remove it from the list of the user commands. Then I start the script again. It keeps on failing and I get the "Type mismatch (SubName)" error every time I move the cursor. I have managed to figure the problem out manually, by refreshing the script in the user command menu then click Close. I would like to know how to do it programmatically as I have not found such a command anywhere in the help nor on the Internet.
Could somebody please help me out ?
I would really appreciate that.
Thank you.
08-03-2013 09:12 AM
Hi Near,
ScriptCmdAdd() will add the *.VBS file to the UserCommand list (and run any code that's not in a Function or Sub).
ScriptCmdReset() will remove all *.VBS files from the UserCommand list.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
08-05-2013 02:07 AM
Dear Brad:
thanks for the help but I am well aware of those two commands, they sadly do not solve my problem. Is there no way to refresh it ? By clicking the Refresh button, some instructions are done and they must be mentionned somewhere in the help or something.
08-27-2013 05:44 PM
Hi Near,
I'm sorry, I checked with R&D and there is no VBScript command that does the same thing as that Reset button. You might try calling ScriptCmdRemove(VbsFile) and ScriptCmdAdd(VbsFile) one after the other-- I haven't looked into that, but it might do what you want.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
08-28-2015 07:48 AM
Hi,
I also have problems with refreshing the user commands I use. It seems to me that neither ScriptCmdReset() nor ScriptCmdRemove() does what they are supposed to do. I add a lot of user commands via the scriptCmdAdd(). If I then run the ScriptCmdRemove() for a certain file, it does not remove this user command from the list of user commands, nothing happens as far as I can tell.
If I run the ScriptCmdReset(), which according to the help should refresh all globals and user commands, I not sure if something happens or not or if it sometimes works and other times don't. My experience is at least that a few times per day I need to close Diadem and restart it completely for the changes I have done to take effect. Which is annoying. I could of course remove the commands from the list of user command manually but when I have a lot och them it's quicker to just restart Diadem.
Do you recognize this behaviour? I basically just want all user commands to refresh every time I run my main-script.
Best regards
Erik