Winedt10 添加自定义宏


Winedt10 添加自定义功能,并在toolbar上添加快捷命令

功能描述:
用宏实现latex+bib参考文献的一键编译。

Remark: The toolbar is the most visible and commonly used interface to many actions (especially by new users). However, a toolbar button is just an interface to invoke the associated menu item. The functionality and properties of such a button are provided through the corresponding menu item definition. This being explained, you should realize that a report "LaTeX button does not work" doesn't make sense. Buttons are there to look pretty and provide an easy interface to commonly used menu items.

此段来自Winedt10的帮助文档,总结起来就是说,toolbar上的button项目是Main Menu中的快捷方式罢了,toolbar上所有的的项目的定义均来自Main Menu。所以想定义新的功能键,就必须先在Main Menu中实现该功能。

IMPORTANT: After you make changes to any particular script you must use the Load Current Script command (the first button in the Options Interface toolbar or the context popup menu) to make the changes effective immediately. It is not necessary, nor is it enough to merely restart WinEdt. In fact, no scripts are loaded at startup: the compiled raw data is stored in WinEdt.dnt (Do Not Touch). This significantly reduces the startup time and reduces the likelihood of error messages during startup.

此段是说,在修改了任何一个配置文件后,都要手动加载修改过后的配置文件。方法是:Load Current Script in the Options Interface toolbar(Option interface的左上角的一个很小的按钮)

进入main Menu配置文件 MainMenu.ini

实现功能代码放在文件OneClickBuild.edt中,内容如下:

Exe('%b\Exec\TeX\LaTeX.edt');
Exe('%b\Exec\TeX\BibTeX.edt');
Exe('%b\Exec\TeX\LaTeX.edt');
Exe('%b\Exec\TeX\LaTeX.edt');
Exe('%b\Exec\TeX\dvi2pdf.edt');

Winedt调用该功能代码如下:

ITEM="OneClickBuild"
CAPTION="&OneClickBuild"
IMAGE="Play1"
MACRO="Exe('%b\Config\OneClickBuild.edt');" 

然后,再进入到Toolbar.ini配置文件,添加一个快捷命令(Button),代码
如下:

  BUTTON="OneClickBuild"

至此就完成了新功能的添加。
最后别忘了 右击MainMenu.ini选load script使得宏生效。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM