首页/文章/ 详情

HyperWork 2024 -二次开发-插件集成_Filemenu XML(5/5)

3天前浏览39

摘自帮助文档


自定义filemenu.xml文件的格式。

XML Overview

使用filemenu.xml通过包含的*.xml文件加载其他插件特性。它通过相对路径引用所有必需的资源。

Example


Tags

root

工具栏的基础容器。

  • Attributes

  • none

  • Children

  • button

button

每个单独的按钮由名称/值对指定。

  • Attributes

  • text, tag, tooltip, image, command

  • Children

  • item

item

每个单独的项由名称/值对指定。

  • Attributes

  • text, tag, hint, command

  • Children

  • none

Example XML

<root>
 <button tag="Ext_Filemenu_HV1"
          text="Custom Entry 1"
          tooltip="Custom file menu entry 1"
          image="fileHelpStrip-24.png">
   <item tag="Ext_Filemenu_HV1_A"
          text="Custom Option A"
          hint="Custom file menu sub-entry A"
          command="tcl: tk_messageBox -title &quot;Option A&quot;
 -message &quot;Option A is working.&quot;"/>
 <item tag="Ext_Filemenu_HV1_B"
           text="Custom Option B"
           hint="Custom file menu sub-entry B"
           command="tcl: tk_messageBox -title &quot;Option B&quot;
  -message &quot;Option B is working.&quot;"/>
  </button>
  <button        tag="Ext_Filemenu_HV2"
                 text="Custom Entry 2"
                 tooltip="Custom file menu entry 2"
                 image="fileOpenStrip-24.png"
                 command="tcl: tk_messageBox -title &quot;
 Custom Entry 2&quot; -message &quot;
 Placeholder for a custom
 open procedure.&quot;">
  </button>
</root>



来源:TodayCAEer
二次开发
著作权归作者所有,欢迎分享,未经许可,不得转载
首次发布时间:2024-09-15
最近编辑:3天前
TodayCAEer
本科 签名征集中
获赞 16粉丝 11文章 170课程 0
点赞
收藏
作者推荐

HyperWork 2024 -二次开发-正则表达式案例(13/13)

在本系列的前12篇文章中,已经覆盖了常用Tcl语言的基础内容,从变量声明到流程控制,再到函数和命名空间的使用。然而,发了notepad++和ue的正则表达式文章后,就有有小伙伴私信说,对想了解tcl的正则表达式。为了满足这位小伙伴的需求,决定额外增加一篇关于正则表达式的文章,作为本系列的第13篇,也是最后一篇。1.匹配邮箱地址setemail&quot;example@example.com&quot;if{[regexp{^[\w\.-]+@[\w\.-]+\.\w+$}$email]}{puts&quot;有效的邮箱地址&quot;}else{puts&quot;无效的邮箱地址&quot;}2.匹配电话号码setphone&quot;(123)456-7890&quot;if{[regexp{^\(\d{3}\)\d{3}-\d{4}$}$phone]}{puts&quot;有效的电话号码&quot;}else{puts&quot;无效的电话号码&quot;}3.匹配网址seturl&quot;https://www.example.com&quot;if{[regexp{^https?://[\w\.-]+\.\w+(/[\w\.-]*)*$}$url]}{puts&quot;有效的网址&quot;}else{puts&quot;无效的网址&quot;}4.匹配日期(格式:YYYY-MM-DD)setdate&quot;2024-08-05&quot;if{[regexp{^\d{4}-\d{2}-\d{2}$}$date]}{puts&quot;有效的日期格式&quot;}else{puts&quot;无效的日期格式&quot;}5.匹配特定单词(如“苹果”或“香蕉”)settext&quot;我喜欢苹果和香蕉&quot;if{[regexp{苹果|香蕉}$text]}{puts&quot;文本中含有苹果或香蕉&quot;}else{puts&quot;文本中不含苹果或香蕉&quot;}6.行首和行尾添加字符setline&quot;Hello,World!&quot;setmodifiedLine[regsub{^(.*)$}$line{123\1123}]puts$modifiedLine7.匹配空行setlines{&quot;&quot;&quot;Thisisaline.&quot;&quot;&quot;}foreachline[split$lines\n]{if{[regexp{^\s*$}$line]}{puts&quot;找到空行&quot;}else{puts&quot;找到非空行:$line&quot;}}8.匹配IP地址setip&quot;192.168.1.1&quot;if{[regexp{^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$}$ip]}{puts&quot;有效的IP地址&quot;}else{puts&quot;无效的IP地址&quot;}9.匹配只包含字母和数字的字符串setstr&quot;Hello123&quot;if{[regexp{^[a-zA-Z0-9]+$}$str]}{puts&quot;有效的字母数字字符串&quot;}else{puts&quot;无效的字母数字字符串&quot;}10.替换字符串中的所有空格为下划线settext&quot;HelloWorldThisisTCL&quot;setmodifiedText[regsub{}$text_]puts$modifiedText;#输出:Hello_World_This_is_TCL11.匹配并提取文件扩展名setfilename&quot;document.pdf&quot;if{[regexp{^(.+)\.(\w+)$}$filenamematchnameext]}{puts&quot;文件名:$name&quot;puts&quot;扩展名:$ext&quot;}else{puts&quot;无效的文件名&quot;}12.匹配引号内的内容settext&quot;她说:\&quot;你好,世界!\&quot;&quot;if{[regexp{&quot;(.*)&quot;}$textmatchcontent]}{puts&quot;引号内的内容:$content&quot;}else{puts&quot;没有找到引号内的内容&quot;}13.提取姓名、年龄和城市setstr&quot;姓名:张三,年龄:30,城市:北京&quot;if{[regexp{姓名:\s*(.+?),\s*年龄:\s*(\d+),\s*城市:\s*(.+)}$strmatchnameagecity]}{puts&quot;姓名:$name&quot;puts&quot;年龄:$age&quot;puts&quot;城市:$city&quot;}else{puts&quot;无法提取信息&quot;}来源:TodayCAEer

未登录
还没有评论
课程
培训
服务
行家
VIP会员 学习 福利任务 兑换礼品
下载APP
联系我们
帮助与反馈