Forum Discussion
Altera_Forum
Honored Contributor
10 years agoRunning a console executable from a tcl script
Hi there
I am attempting to call a console executable file from a tcl script that should run before every compile. Here are a few iterations that I have tried, but nothing seems to make the tcl script run the executable: exec ConsoleApp.exe qexec ConsoleApp.exe exec BatchToRunConsoleApp.bat qexec BatchToRunConsoleApp.bat I am pretty desperate. I made the mistake of assuming that it would not be difficult to run an application from a tcl script and now I cannot seem to do it. Please help. Regards, Stu845 Replies
- Altera_Forum
Honored Contributor
Hi,
this works here:
also:qexec ipconfig qexec quartusset cmd "qmegawiz -silent OPTIONAL_FILES=NONE ${file_name}" post_message "cmd: ${cmd}" if { } { post_message -type error "couldn't run $cmd" } else { post_message -type info } - Altera_Forum
Honored Contributor
"qexec" is the command you should be using, and it works fine. You will need to supply more information about what doesn't work. Do you need to specify the path to the executable, or make sure your PATH includes a .dll it depends on? - Altera_Forum
Honored Contributor
--- Quote Start --- Hi, this works here:
also:qexec ipconfig qexec quartus
--- Quote End --- Hi there DUESTERBERG I tried your code snippets, and much like mine, they appear to do absolutely nothing. It says in themessage window that the tcl script executed successfully, but no windows consoles execute or appear. Is it poosible that there is something else that I am missing? Thank you for your help.set cmd "qmegawiz -silent OPTIONAL_FILES=NONE ${file_name}" post_message "cmd: ${cmd}" if { } { post_message -type error "couldn't run $cmd" } else { post_message -type info } - Altera_Forum
Honored Contributor
You'll get the results you describe if your executable doesn't produce any output to STDOUT.
Your script snippet works fine here. Changing your cmd variable to instead use Windows cmd.exe to run the "set" command, you get your environment dumped into Quartus messages.
If something basic as this doesn't work for you, not sure what next? Reinstall? If this works, then there's a problem with your .exe, or there is a problem executing your .exe from a script like this.set cmd "cmd /c set" post_message "cmd: ${cmd}" if { } { post_message -type error "couldn't run $cmd" } else { post_message -type info "Command \"$cmd\" successful." post_message -type info } - Altera_Forum
Honored Contributor
--- Quote Start --- You'll get the results you describe if your executable doesn't produce any output to STDOUT. Your script snippet works fine here. Changing your cmd variable to instead use Windows cmd.exe to run the "set" command, you get your environment dumped into Quartus messages.
If something basic as this doesn't work for you, not sure what next? Reinstall? If this works, then there's a problem with your .exe, or there is a problem executing your .exe from a script like this. --- Quote End --- Thanks ted. I appreciate all the help everyone. After playing around some more, I found my problem: The tcl file runs in the project root directory and therefore saves the files there. When I run my app independently, the files are saved in the same directory as the app, hence the reason for my confusion. The code that uses "open" as described above does work, I still seem to be having some issues with qexec and exec, but this does not hinder my progress. Thanks again.set cmd "cmd /c set" post_message "cmd: ${cmd}" if { } { post_message -type error "couldn't run $cmd" } else { post_message -type info "Command \"$cmd\" successful." post_message -type info }