02-23-2012 09:13 AM
Hello!
My Problem is: I'm trying to start an exe-file by clicking a button within a SUD-Dialog. Does anybody know how to realize that?
For example: Run("C:\Windows\Notepad.exe") ?!
Thanks!
Solved! Go to Solution.
02-24-2012 02:03 AM
dim command : command = "notepad.exe" dim shell : Set shell = CreateObject("WScript.Shell") dim status : status = shell.Run(command, 1, true) If 0 <> status Then Err.Raise 6, "", "Command returned error!" End If
should do the job.
02-24-2012 05:08 AM
Thanks for you reply!
Your code worked so far to start Notepad.exe but what I'm trying to do is to start a file, located one folder above my script folder.
I tried the following...
dim command : command = "Script Assistent\TSM Script Assistent.NET.exe"
dim shell : Set shell = CreateObject("WScript.Shell")
dim status : status = shell.Run(command, 1, true)
If
0 <> status ThenErr.Raise6, "", "Command returned error!"
End If
...but then I receive an error message 😕
The script and the sud-file is located in:
G:\Script\Scriptfile.vbs + Dialogfile.sud
The exe I'm trying to start is here:
G:\Script\Script Assistent\TSM Script Assistent.NET.exe
What's wrong with that?
02-24-2012 05:26 AM
For my understanding: Can I check my "command" by typing it into the command line window in windows?
02-24-2012 06:47 AM
dim command : command = """" & Dialog.FilePath & "Script Assistent\TSM Script Assistent.NET.exe" & """" dim shell : Set shell = CreateObject("WScript.Shell") dim status : status = shell.Run(command, 1, true) If 0 <> status Then Err.Raise 6, "", "Command returned error!" End If
Dialog.FilePath conatins the path of the sud file.
Because the command contains spaces it is important to put it into ".
02-24-2012 09:34 AM
Hi Guys,
Another option is to use the DIAdem command "ExtProgram", though in all cases you'll need double-quote characters in the command if your file path has spaces-- that's a Windows requirement.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-27-2012 06:36 AM
Hello!
Thanks for your reply AndreasK, you solved my problem!
I will try the "ExtProgram" variant in future.
Regards