DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Is Full Automation Possible In DIAdem V9.1?

Hi all
 
I wonder if i can fully automate my DIAdem V9.1 application.
 
Here's what i have at the moment:
 
From time to time a wIndows application writes a new datafile containing ASCII data to the PC's harddrive.
The files are named 00001-Date.daf, 00002-Date.daf, 00003-Date.daf...  and so on.
The .daf file is nothing exotic, it's simply an ASCCI file containig data for two channels. I use the extension .daf only
to get a unique file extension.
 
Then i doubleclick on the DIAdem icon.
I have modified the destination path of the icon in this way:
"C:\Programme\National Instruments\DIAdem 9.1\DIADEM.exe" "/CScriptStart('"E:\DIAdemWork\Manni01.vbs"')"
 
DIAdem starts, and runs the Manni01.vbs script.
The script will open a FileNameGet dialogue, and the user has to select one of the .daf files.
The selected .daf file will automatically be imported, displayed and analysed.
 
This works fine, but, as you see, the user has to select the file to be imported.
Since this has to be done inside DIAdem, it cannot be automated further.
 
It would be much nicer, if the name of the file to be processed could be transferred to DIAdem as
a program start parameter, similar to the name of the starting script. 
The other application could then start DIAdem with this filename as a parameter. DIAdem could
process the datafile and NO user interaction would be required to select the file.
As a nice side-effect, a simple double-click on a .daf file in windows explorer could also open
DIAdem and automatically process the data.
 
How can i transfer a filename to DIAdem at startup?
 
Note: The filename must be recognizable in the autostart script, and there must be a way
to examine IF a file was given as a parameter.

Manfred
 
0 Kudos
Message 1 of 7
(3,681 Views)

Hi Manfred,

Here are a couple of hacks you might be able to put together to get to where you are trying to get:  First it is possible to hack the registry to start the program you want to start when a file with a given extension is double clicked from the explorer.  Second it is possible to set a variable in DIAdem from the comand line.

Hacking the registry (You should only do this if you really know what you're doing.  Just playing around could really mess up your system.)

1.) Open regedit.

2.) Go to HKEY_CLASSES_ROOT and create a key called ".daf".  Set its value to anything you want -- I suggest "daffile"

3.) Also in HKEY_CLASSES_ROOT create a key called "daffile" (or whatever you chose in step 2 for the value).

4.) In the new daffile key create a key called "shell".

5.) In the new shell key create a key called "Open" (or whatever you want).  The name of this key will be used by explorer in the context menu item for files of this type.

6.) In the new Open key create a key called "command".

7.) Set the value of this key "command" to the startup command for DIAdem.  Using the start up string you suggested below, this would be "C:\Programme\National Instruments\DIAdem 9.1\DIADEM.exe" "/CScriptStart('"E:\DIAdemWork\Manni01.vbs"')"

In the command key, %1 can be used to represent the file that was clicked.  You could theoretically set a DIAdem variable to the file name using this fact.  The command line argument would probably look something like /CT1:=%1.  (in the old AUT autosequence syntax.)  Then you can access the variable that you set using this in your script.  I haven't tried the command line  out, so you'll probably have to tweak it a bit.  I'm pretty sure you can send two commands in the command line.

The drawback to this approach is that it will probably always start a new DIAdem and not open your file in a DIAdem which is already open.

Hope that helps,

Myrle

P.S.  Have you considered writing a VBS DataPlugin to read your file format?  Simple ASCII files are usually dead easy to write DataPlugins for.  Then you could use the file system inside of DIAdem to browse, and drag and drop from the Navigator into the Portal would automatically work.  The documentation for the DataPlugin API can be found here: http://www.ni.com/diadem/dataplugins.htm

******************
For tips and tricks on creating VBScript DataPlugins go to http://dataplugins.blogspot.com.
0 Kudos
Message 2 of 7
(3,664 Views)

Hi Myrle!

it all comes down how to set a variable in DIAdem from the command line.

I tried that differnet times, using command lines almost as you suggested, it did not work.

What i did not know was that the names of the command line variables are restricted to T1..T9, as i found out after trying your example.

Here is a working command line: 

"C:\Programme\National Instruments\DIAdem 9.1\DIADEM.exe" "/CT1:='"TestFilename"'" "/CScriptStart('"E:\DIAdemWork\Manni01.vbs"')":

Of course, '"TestFilename"' will be replaced by %1, once i use it from the explorer shell.

Thanks for the hint, Myrle!

Your steps 1..7 show how to configure windows using the registry. I use XP, and i think it is possible to configure everything

on Arbeitsplatz/Dateitypen (Sorry, i don't know the english names for it...). I will try that now.

Manfred

 

0 Kudos
Message 3 of 7
(3,656 Views)

Hi Manfred,

I have a different and much simpler suggestion for you.  Why don't you just put the file path you're interested in an ASCII file in a particular spot (such as the DIAdem directory "ProgramDrv" or the same directory as the VBScript "AutoActPath") with a particular file name, such as "ParFile.txt", and just read it and any other parameters out with file I/O in the VBScript that you ScriptStart()?

Hope that helps,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 4 of 7
(3,650 Views)

Brad !

I think your approach is not compatible with the shell integration of the windows explorer, a doubleclick

on the .daf file would not update the filename in the file.

Myrle !

Explorer integration works now! A doubleclick on the .daf file opens DIAdem and the script does

all the rest.

I first tried to use the windows panel to assign the new .daf file extension, but messed up.

After cleaning the registry i used the registry values you supplied. Works fine!

To ease handling for future changes, i exported the two new registry keys into a single .reg file, which can be

easily edited, and added to the registry by a simple doubleclick.

For anyone who is interested, here's the content of the "Command" registry key: 

    "C:\Programme\National Instruments\DIAdem 9.1\DIADEM.exe" /CT1:='"%1"' /CScriptStart('"E:\DIAdemWork\Manni01.vbs"')

Thanks for all the Help

Manfred


 

  

  

 

 

0 Kudos
Message 5 of 7
(3,643 Views)
Hi all
 
For anyone who is interested, here is the .reg file.
Note that special characters in strings are leaded by a \
This makes the reading somewhat more complicated...
 
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.daf]
@="DIAdem.daf"
[HKEY_CLASSES_ROOT\DIAdem.daf]
[HKEY_CLASSES_ROOT\DIAdem.daf\Shell]
[HKEY_CLASSES_ROOT\DIAdem.daf\Shell\Open]
[HKEY_CLASSES_ROOT\DIAdem.daf\Shell\Open\Command]
@="\"C:\\Programme\\National Instruments\\DIAdem 9.1\\DIADEM.exe\" /CT1:='\"%1\"' /CScriptStart('\"E:\\DIAdemWork\\Manni01.vbs\"')"

Manfred
0 Kudos
Message 6 of 7
(3,639 Views)

Hi all,

patching the registry solves both the task for starting a script when the end user double-clicks on a DAF file as well as performing this automatically from within the windows application which creates the data file.

I'd just like to add that controlling DIAdem remotely could also be solved by using the OLE interface of DIAdem. Using the OLE interface of DIAdem the other windows program could assign the file name to a DIAdem variable like T1 and afterwards force DIAdem to start the script for processing the file.

If someone is interested in this topic simply look for "OLE" in the index of the DIAdem help system for more information.

ThomAC
 

Message Edited by ThomAC on 10-30-2005 11:26 PM

0 Kudos
Message 7 of 7
(3,613 Views)