DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to register an exe dataplugin via a vbs script?

Solved!
Go to solution

What's the best way to check if a dataplugin is registered and if it's not load the data plugin via it's exe file.  

 

We can use matlab plugin as a specific example. To install it, I have to run the .exe file and follow the prompts.  So, how can I do this via Diadem?  I can run an external program, sure, but is there some way to do it without input from the user?  

 

Also, is using the plugin name the best way to see if it's installed?  MatLab is the plugin name, does that ever change?

 

For background, I have a startup script that users point to, and I would like to have the script check for plugins and install if not already installed.  

 

Thanks. 

0 Kudos
Message 1 of 15
(4,893 Views)

Hello,

 

I am not sure whether this will be possible. I have been doing some research today and there seemed to be nothing to find about it. I will do some further research and I'll let you know what I can find.

 

Regards,

Camilo V.
National Instruments
0 Kudos
Message 2 of 15
(4,852 Views)

Ok thank you for looking into it.  

0 Kudos
Message 3 of 15
(4,816 Views)

Actually, Brad mentioned that Andreas might have an idea.  Should I submit a support ticket? 

0 Kudos
Message 4 of 15
(4,777 Views)

Hello Russell,

 

I have actually been discussing this with Brad and he already provided some guidelines, but I still have a couple things to clarify.

 

You can sumbit a support ticket if you prefer, but I should have something for you soon.

 

Regards,

Camilo V.
National Instruments
0 Kudos
Message 5 of 15
(4,756 Views)

I'll wait for your reply here. 

 

Thanks!

0 Kudos
Message 6 of 15
(4,750 Views)
Solution
Accepted by topic author RussellSenior

Hi Guys,

 

Here’s a VBScript function that checks if a DataPlugin is registered.  For VBScript (*.uri) DataPlugins, it will also try to download and install the DataPlugin from the web site.  The IF THEN statement will run the contents of the “DosCommand” variable synchronously, meaning it will wait to return until the DOS command is done.  The standard DOS extension for msi installers will cause the DataPlugin installer to install invisibly.  I see in my notes that “/o” and “/u” and “/v” have been used at different times, but I don’t recall if any of these are the invisible/silent mode.  That should be Google-able, since it's an MSI attribute, not an NI thing.

 

IF NOT InstallUpdateDataPlugin("DEWESoft7") THEN
  Set WSH = CreateObject("WScript.Shell")
  Call WSH.Run("""" & DosCommand & """", 0, TRUE)
END IF
 
 
Function InstallUpdateDataPlugin(DataPluginName)
  Dim UpdateSource
  Set UpdateSource = Navigator.Settings.CreateUpdateSource()
  IF Navigator.Settings.RegisteredDataPlugins.Exists(DataPluginName) THEN
    IF UpdateSource.CompareVersion(DataPluginName) = eCompLowerVersion THEN
On Error Resume Next       Call UpdateSource.Install(DataPluginName)
On Error Goto 0     END IF   ELSE     On Error Resume Next     Call UpdateSource.Install(DataPluginName)     On Error Goto 0   END IF InstallUpdateDataPlugin = Navigator.Settings.RegisteredDataPlugins.Exists(DataPluginName) End Function ' InstallUpdateDataPlugin()

 

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

 

Message 7 of 15
(4,736 Views)

Hello Russell,

 

Just wondering if you were able to test Brad's Suggestion. Were you able to get the script working?

 

Regards,

Camilo V.
National Instruments
0 Kudos
Message 8 of 15
(4,564 Views)

Hi, thanks for following up. No I have not tried it yet.  I hope to soon, maybe this weekend.  

 

I will be sure to post back my results, but Brad wrote it, so I'm confident it works. 🙂

 

Thanks. 

0 Kudos
Message 9 of 15
(4,557 Views)

Hello Camilo/Brad:  I have tried the installer, and it works well. 

 

The only thing to note so far,

 

If I use 0 as the [intWindowStyle] parameter (second parameter) in the wsh.run command, the installations do no happen synchronously if I am calling Brads function whilst looping through a list of plugins, they occur all at the same time.  So, maybe just for future reference, 1 seems to be the better choice.  (User interaction is required for exe installs, anyway).  Also, for future reference: https://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.84).aspx

 

I will provide more comments if I find anything else.

 

Thanks again!

 

-Russ

0 Kudos
Message 10 of 15
(4,542 Views)