动力通讯工作组

动力通信工作组致力于网络通信的开发工作,进行tcpip网络编程,采用unix平台socket系列函数, windows平台 vc++6.0 MFC ,采用ASyncSocket对象。目前有telnet,irc,msn, SocketProxy 等产品程序。

  IT博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  14 随笔 :: 14 文章 :: 111 评论 :: 0 Trackbacks

第2章、屏幕(screen)文本、绘图、声音


1、文本显示

screen.text at point {10} {30} string {myvar1 = [~myvar1~]} 
在屏幕的坐标点(10,30)处显示字符串“myvar1 = [~myvar1~]”,在语句解释执行时,会进行变量值的替换,“~myvar1~”表示需替换变量myvar1的值,最终显示的内容为“myvar1 = [test1]”

screen.set font {仿宋} size {16}
设置文本显示的字体和大小

screen.set color red {255} green {128} blue {127}
设置屏幕绘图、文本的颜色,RGB三色,每个颜色值的范围为0-255

2、绘图


screen.line from point {10} {30} to point {110} {90}
屏幕绘制直线,从坐标点(10,30)到从坐标点(110,90)

screen.set mode {fill}
设置屏幕为填充模式
screen.rect from point {10} {30} to point {110} {90}
屏幕绘制实心矩形,从坐标点(10,30)到从坐标点(110,90)
screen.arc at point {10} {30} radius {10} from {90} to {270}
屏幕绘制实心扇形,圆心为坐标点(10,30),半径10,角度从90度到270度

screen.set mode {stroke}
设置屏幕为划线模式
screen.rect from point {10} {30} to point {110} {90}
屏幕绘制矩形框,从坐标点(10,30)到从坐标点(110,90)
screen.arc at point {10} {30} radius {10} from {90} to {270}
屏幕绘制圆弧,圆心为坐标点(10,30),半径10,角度从90度到270度

screen.image url {C:\snml2019\tmp\snml_1.png} from point {0} {0} to point {213} {358}
在屏幕的矩形区域内显示图片,矩形区域为从坐标点(0,0)到(213,358)

screen.save to file {C:\snml2019\tmp\snml_1.png} from point {0} {0} to point {640} {480}
保存屏幕的矩形区域到图片(png格式),矩形区域为从坐标点(0,0)到(640,480)

3、声音


screen.play midi {1234567cdefgabCDEFGAB}
播放midi音乐“1234567cdefgabCDEFGAB”

screen.speak {tts语言播放演示,myvar1 = ~myvar1~}
播放语音“tts语言播放演示,myvar1 = test1”


4、示例脚本[C:\snml2019\screen\screen_nms1.txt]

C:\snml2019\screen\screen_nms1.txt
001screen.set font {华文行楷} size {40}
002screen.text at point {140} {60} string {简单网络管理语言}
003
004screen.set font {Arial} size {12}
005screen.text at point {180} {100} string { Simple Network Management Language }
006screen.line from point {10} {120} to point {630} {120}
007
008screen.play midi {CDEFGAB cdefgab 1234567 1 2 3 4 5 6 7}
009
010var {x} value { 10}
011var {y} value { 300}
012
013macro.call {draw_ladybird}
014
015screen.text at point {200} {350} string {版本:snml8.13(ladybird)}
016
017screen.text at point {200} {400} string {技术支持邮箱1:snml2019@protonmail.com}
018screen.text at point {200} {425} string {技术支持邮箱2:snml2019@hotmail.com}
019screen.text at point {10} {180} string {术语1:简单网络管理协议S N M P( Simple Network Management Protocol )}
020screen.text at point {10} {230} string {术语2:简单网络管理语言 S N M L ( Simple Network Management Language )}
021
022screen.line from point {50} {220} to point {630} {220}
023screen.line from point {50} {265} to point {630} {265}
024screen.line from point {30} {290} to point {630} {290}
025screen.line from point {130} {315} to point {630} {315}
026run.set loglevel {info}
027
028screen.speak {1、什么是简单网络管理协议S N M P( Simple Network Management Protocol )?}
029
030screen.text at point {50} {205} string {简单网络管理协议是可以管理不同厂家网络设备的简单通讯协议。}
031screen.text at point {50} {250} string {简单网络管理语言是一种类自然语言的脚本语言,它采用snmp、telnet、ping、dns、arp、ssh、}
032screen.text at point {30} {275} string {tcp、udp、web等协议与网络设备的互动,内置了smtp协议用于告警等邮件的发送,}
033screen.text at point {130} {300} string {支持excel、mysql、sqlite等3种方式进行管理信息数据的存取。}
034
035screen.save to file {C:\snml2019\tmp\snml_1.png} from point {0} {0} to point {640} {480}
036run.end
037
038macro.begin {draw_ladybird}
039  #var {x} value {0}
040  #var {y} value {0}
041  screen.set mode {stroke}
042  screen.set color red {0} green {0} blue {0}
043  #screen.rect from point {0} {0} to point {127} {127}
044  screen.set color red {255} green {0} blue {0}
045  screen.set mode {fill}
046  
047  var {x1} value number {~x~+60}
048  var {y1} value number {~y~+78}
049  screen.arc at point {~x1~} {~y1~} radius {50} from {0} to {360}
050  screen.set color red {0} green {0} blue {0}
051  
052  var {x1} value number {~x~+60}
053  var {y1} value number {~y~+33}
054  screen.arc at point {~x1~} {~y1~} radius {25} from {180} to {360}
055  
056  var {x1} value number {~x~+60}
057  var {y1} value number {~y~+28}
058  screen.set color red {0} green {0} blue {0}
059  screen.arc at point {~x1~} {~y1~} radius {100} from {85} to {95}
060  
061  var {x1} value number {~x~+60}
062  var {y1} value number {~y~+33}
063  var {x2} value number {~x~+80}
064  var {y2} value number {~y~+5}
065  
066  screen.line from point {~x1~} {~y1~} to point {~x2~} {~y2~}
067  var {x2} value number {~x~+40}
068  screen.line from point {~x1~} {~y1~} to point {~x2~} {~y2~}
069  
070  var {x1} value number {~x~+80}
071  var {y1} value number {~y~+5}
072  screen.arc at point {~x1~} {~y1~} radius {2} from {0} to {360}
073  var {x1} value number {~x~+40}
074  screen.arc at point {~x1~} {~y1~} radius {2} from {0} to {360}
075  
076  screen.set color red {255} green {255} blue {255}
077  
078  var {x1} value number {~x~+48}
079  var {y1} value number {~y~+20}
080  screen.arc at point {~x1~} {~y1~} radius {5} from {0} to {360}
081  var {x1} value number {~x~+72}
082  screen.arc at point {~x1~} {~y1~} radius {5} from {0} to {360}
083  
084  screen.set color red {0} green {0} blue {0}
085  
086  var {x1} value number {~x~+48}
087  var {y1} value number {~y~+19}
088  screen.arc at point {~x1~} {~y1~} radius {3} from {0} to {360}
089  
090  var {x1} value number {~x~+72}
091  screen.arc at point {~x1~} {~y1~} radius {3} from {0} to {360}
092  
093  var {x1} value number {~x~+60}
094  var {y1} value number {~y~+43}
095  screen.arc at point {~x1~} {~y1~} radius {10} from {0} to {360}
096  
097  var {x1} value number {~x~+90}
098  var {y1} value number {~y~+59}
099  screen.arc at point {~x1~} {~y1~} radius {8} from {0} to {360}
100  var {x1} value number {~x~+30}
101  screen.arc at point {~x1~} {~y1~} radius {8} from {0} to {360}
102  
103  var {x1} value number {~x~+75}
104  var {y1} value number {~y~+73}
105  screen.arc at point {~x1~} {~y1~} radius {8} from {0} to {360}
106  var {x1} value number {~x~+45}
107  screen.arc at point {~x1~} {~y1~} radius {8} from {0} to {360}
108  
109  var {x1} value number {~x~+90}
110  var {y1} value number {~y~+100}
111  screen.arc at point {~x1~} {~y1~} radius {8} from {0} to {360}
112  var {x1} value number {~x~+30}
113  screen.arc at point {~x1~} {~y1~} radius {8} from {0} to {360}
114macro.end
执行C:\snml2019\screen_nms1.bat,点击“Go”或“连续执行按钮”执行脚本,脚本执行结果如下:
posted on 2019-07-16 09:33 动力通讯工作组 阅读(64) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。