NI Home > Community > NI Discussion Forums

DIAdem

Showing results for 
Search instead for 
Do you mean 
Reply
Member
sascha.zimmer@bomag.com
Posts: 9
0 Kudos
Accepted Solution

How to Start EXE-File from SUD Dialog

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!

Active Participant
AndreasK
Posts: 257
0 Kudos

Re: How to Start EXE-File from SUD Dialog

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.

Member
sascha.zimmer@bomag.com
Posts: 9
0 Kudos

Re: How to Start EXE-File from SUD Dialog

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?

 

 

Member
sascha.zimmer@bomag.com
Posts: 9
0 Kudos

Re: How to Start EXE-File from SUD Dialog

For my understanding: Can I check my "command" by typing it into the command line window in windows?

Active Participant
AndreasK
Posts: 257
0 Kudos

Re: How to Start EXE-File from SUD Dialog

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 ".

Trusted Enthusiast
Brad_Turpin
Posts: 2,878
0 Kudos

Re: How to Start EXE-File from SUD Dialog

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

Member
sascha.zimmer@bomag.com
Posts: 9
0 Kudos

Re: How to Start EXE-File from SUD Dialog

Hello!

 

Thanks for your reply AndreasK, you solved my problem!

 

I will try the "ExtProgram" variant in future.

 

Regards