DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Start EXE-File from SUD Dialog

Solved!
Go to solution

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!

0 Kudos
Message 1 of 7
(4,591 Views)
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.

0 Kudos
Message 2 of 7
(4,580 Views)

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?

 

 

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

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

0 Kudos
Message 4 of 7
(4,572 Views)
Solution
Accepted by topic author sascha.zimmer@bomag.com
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 ".

0 Kudos
Message 5 of 7
(4,565 Views)

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

Message 6 of 7
(4,560 Views)

Hello!

 

Thanks for your reply AndreasK, you solved my problem!

 

I will try the "ExtProgram" variant in future.

 

Regards

0 Kudos
Message 7 of 7
(4,544 Views)