时间: 2021-07-31 作者:daque
好吧,此刻让咱们来尝试一下这个宏。请在hottmetal中翻开一个文书档案并将视图切换到源步调视图。你不妨在progguide目次中采用个中一段。而且经过运用tools(东西)->customization(定制)封闭enable source layout按钮。接着将个中一条龙用介入空格往右移,再从东西菜单中挪用宏对话框。这时候会展示出设置在hotmetal.mcr文献的宏的列表。而后运转refresh macros宏来承载你方才编纂的新的宏。你将会看到format current document (方法暂时文书档案)宏。你不妨运转它而且提防谁人缩进的行回到它的原场所。接下来咱们尝试一下alert()本领。此刻将视图切换到tagson视图并再次运转宏,会弹出如图1的对话框: (图1)此刻假如你想方法化文书档案中所采用的局部。这个乞求的宏(称为format current selection)跟上头所述的宏(format current document)很一致。它们之间的各别不过在:format current document中 layout()本领是操纵activedocument 东西,而format current selection中 layout()本领是操纵selection东西:<macro name="format current selection" lang="jscript" id="53" desc="apply source layout to the current selection"><![cdata[if (activedocument.viewtype == viewsource) {selection.layout();} else{application.alert("applying source layout only works in source view.\nswitch to source view and try again.");}]]></macro>
实例教程(20-7)">