cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rne
Visitor
Visitor
845 Views
Registered: ‎06-12-2019

How to detect if GUI is open from TCL

Jump to solution

I have a script that can be launched directly, from another script, or from gui. There is a small part of the script that I want to be executed only if the script is launched in non-gui mode. When launching from another script or gui, the project is already open. I didn't find anyway to do this other than duplicating the code or closing and reopening the project when launching from another script.

Is there a way to detect whether the script was launched from inside the GUI?

Some commands like "update_compile_order" will not run when launched from within GUI. So the built-in commands can detect whether or not they are launched from within the GUI but I can't find anyway for the end-user to do the same.

0 Kudos
1 Solution

Accepted Solutions
rne
Visitor
Visitor
841 Views
Registered: ‎06-12-2019

Nevermind, I can pass variables from first script to second script or commandline arguments by following this: https://www.xilinx.com/support/answers/62015.html. Then I use a variable when calling script from another script to detect whether or not GUI was opened. For the direct script launch, I detect it from the current_project command.

View solution in original post

0 Kudos
4 Replies
rne
Visitor
Visitor
842 Views
Registered: ‎06-12-2019

Nevermind, I can pass variables from first script to second script or commandline arguments by following this: https://www.xilinx.com/support/answers/62015.html. Then I use a variable when calling script from another script to detect whether or not GUI was opened. For the direct script launch, I detect it from the current_project command.

View solution in original post

0 Kudos
nhenri
Visitor
Visitor
236 Views
Registered: ‎03-29-2021

You're saying you can detect the GUI mode with the current_project ? How ?

I have the same issue as you, I want to do if { GUI } { ... }

0 Kudos
amaccre
Moderator
Moderator
171 Views
Registered: ‎04-24-2013

HI @nhenri 

$rdi::mode should return one of following depending on how Vivado was started.

gui
batch
tcl

You can also include it in a custom proc to make it more readable:

proc launch_mode {} {
puts $rdi::mode
}

Best Regards
Aidan

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------
nhenri
Visitor
Visitor
156 Views
Registered: ‎03-29-2021

Wow amazing!

Thank you

0 Kudos