10-26-2005 04:51 AM
10-26-2005 06:13 AM
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
10-26-2005 07:01 AM
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
10-26-2005 09:13 AM
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
10-26-2005 10:41 AM
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
10-26-2005 11:02 AM
10-30-2005 04:22 PM - edited 10-30-2005 04:22 PM
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.
If someone is interested in this topic simply look for "OLE" in the index of the DIAdem help system for more information.
Message Edited by ThomAC on 10-30-2005 11:26 PM