Showing results for 
Search instead for 
Did you mean: 
Reply

How to Start EXE-File from SUD Dialog

Solved!
Go to 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!

0 Kudos
Reply
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.

0 Kudos
Reply
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?

 

 

0 Kudos
Reply
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?

0 Kudos
Reply
0 Kudos
Solution
Accepted by topic author sascha.zimmer@bomag.com
‎08-27-2015 06:09 PM

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

0 Kudos
Reply
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

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

0 Kudos
Reply
0 Kudos