07-01-2008 03:36 AM
07-01-2008 05:23 AM
Please try to use the function "ExtProgram". As you will see from the online help, it allows to starts an executable and it also supports running a batch file.
Andreas
07-01-2008 06:39 AM
Perfect! I haven't had the chance yet to try it out with the right file but it seems to be working the way I want.
Thank you!
/Malin
08-12-2008 03:25 AM
08-12-2008 03:45 PM
Hi Malin,
Try adding explicit " characters around your DOS path, the same way you would in a DOS window. If the file path has spaces in it, this is the only way to get it to work:
Call ExtProgram("""C:\My Folder\My Batch File.bat""")
Brad Turpin
DIAdem Product Support Engineer
National Instruments
08-13-2008 02:59 AM
Hi again!
Thank you for your help but I've just discovered that my problem probably doesn't have to do with the way that I call for the batch file. It's more like this:
The batch file is run but it only does its job some of the times... The batch contains one name of a converter application (Convert.exe) and the names of some databases and files. I've been told that the conversion should work if Convert.exe is located in the same folder as the files. Which it also does, if I run the batch from "Run..." but not from my code.
I had it working for a while when I had fiddled (as I said, I'm a beginner at this) with setting some drives, such as userDrv and changing some paths in the script settings. Since I didn't really know what I was doing though, I didn't save these settings when closing down DIAdem and now it's not working again. When it worked, it only worked for the file where my .VBS was saved. The point of the program is to convert files in different folders so that wasn't enough.
Just for clearity: I can't write the name as "C:\My Folder..." because the batch file name and the folder it is situated in is different each time so I have variables for the path and the batch, but that part seems to work. (Call ExtProgram(batFilename_) where batFilename_ includes the path).
So I guess what I need to understand is how the different drives work or maybe I need to somehow change my path settings?
08-13-2008 10:08 AM
Hi Malankoal...,
Just for completeness, you can still add the extra " characters even if your file path is stored in a variable:
Call ExtProgram("""" & batFilename_ & """")
But I'll move on from there because you said the batch file is being called OK every time. I'm no DOS or batch file expert, but if you say that your batch file needs to be in the same directory as the data files it's supposed to process, then if it were me I would copy the batch file into the data file directory with FileCopy(), run the batch file in the data file directory with ExtProgram(), then delete the batch file from that directory with FileDelete().
Brad Turpin
DIAdem Product Support Engineer
National Instruments
08-14-2008 03:04 AM
I tried keeping all the files and programs in the same folder already, though, and it still doesn't work. But maybe it's a DOS problem more than a DIAdem one... Thank you guys for taking time to help me!
I'll try and define my problem better if I ask again.
/Malin
08-14-2008 03:33 PM
Hello Malin!
The DOS concept of a working directory might be the source of your problem. Have a look on this article to get an idea how to solve it.
Matthias
Matthias Alleweldt Project Engineer / Projektingenieur | Twigeater? |