UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor
Contributor
573 Views
Registered: ‎11-23-2014

Run Tcl script on Vivado exti or on project close

Jump to solution

Hi all,

 

quick question, I wasn't able to find the answer anywhere so I hope someone help me here... My question is.. is there any way how to set a TCL script call when Vivado is about to exit (I hit the cross) or at least the project is closing? Something like the Vivado_init.tcl which needs to be placed in the certain Vivado folder but for closing?

 

Thanks a lot guys

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Visitor xromka
Visitor
392 Views
Registered: ‎07-26-2017

Re: Run Tcl script on Vivado exti or on project close

Jump to solution

Hi,

You can hook any Vivado commands  using standard TCL technic. Simple add to Vivado_ini.tcl 

 

### Hook of "close_project" procedure
if {[llength [namespace which {close_project_}]]==0} {
  rename ::close_project close_project_
  proc ::close_project args {
    puts "Hook of close_project"
    do_something_before_closing_project ....
    ...
   uplevel 1 ::close_project_ $args
  }
}
...
proc do_something_before_closing_project {..} {...}

Good luck.

 

6 Replies
Xilinx Employee
Xilinx Employee
516 Views
Registered: ‎02-14-2014

Re: Run Tcl script on Vivado exti or on project close

Jump to solution

Hi @bartiko ,

There is no such feature as of now which can help to run script upon clicking 'exit' button or closing project.

I think closest workaround for you would be separately sourcing script just before close_project command (if you are using tcl script) or using tcl hook script (tcl.post) if you are using GUI flow. More about hook scripts -

https://www.xilinx.com/support/documentation/sw_manuals/xilinx2019_1/ug894-vivado-tcl-scripting.pdf (page #21)

Regards,
Ashish
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
Contributor
Contributor
504 Views
Registered: ‎11-23-2014

Re: Run Tcl script on Vivado exti or on project close

Jump to solution

Hi @ashishd 

Thanks for replay. This looks usefull. But Is there any STEPS.ClOSE_PROJECT, or something like that? cannot find anything like this so far...

 

thanks a lot

0 Kudos
Moderator
Moderator
498 Views
Registered: ‎11-04-2010

Re: Run Tcl script on Vivado exti or on project close

Jump to solution

Hi, @bartiko ,

Maybe you can try to customize your own commands with a new ICON and "exit" command is the last command.

Example tcl 

puts "tt"

exit

1. Tools -> Custom Commands -> Customize Commands...

2. Create your own command and point to your tcl script.

By clicking the new ICON in toolbar, you can run your own commands and then exit Vivado.

 

 

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
cus_com.png
Highlighted
Visitor xromka
Visitor
393 Views
Registered: ‎07-26-2017

Re: Run Tcl script on Vivado exti or on project close

Jump to solution

Hi,

You can hook any Vivado commands  using standard TCL technic. Simple add to Vivado_ini.tcl 

 

### Hook of "close_project" procedure
if {[llength [namespace which {close_project_}]]==0} {
  rename ::close_project close_project_
  proc ::close_project args {
    puts "Hook of close_project"
    do_something_before_closing_project ....
    ...
   uplevel 1 ::close_project_ $args
  }
}
...
proc do_something_before_closing_project {..} {...}

Good luck.

 

Contributor
Contributor
384 Views
Registered: ‎11-23-2014

Re: Run Tcl script on Vivado exti or on project close

Jump to solution

@hongh  and @xromka 

 

thanks a lot for suggestions. I'll try and let you with results :)

 

thanks alot once more

0 Kudos
Contributor
Contributor
293 Views
Registered: ‎11-23-2014

Re: Run Tcl script on Vivado exti or on project close

Jump to solution

@xromka Thanks for sugestion. This works the most elegantly :)

0 Kudos