⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scripting_6_8__messages_to_the_user.html

📁 语音信号处理软件praat教程:这是一部入门教程
💻 HTML
字号:
<html><head><meta name="robots" content="index,follow">
<title>脚本 6.8. 向用户发送消息</title></head><body bgcolor="#FFFFFF">

<table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b>
脚本 6.8. 向用户发送消息
</b></font></table></table>
<p>
如果用户犯错误了(比如在表单窗口中填写了冲突的设置内容),可以通过<b>exit</b>命令(<a href="Scripting_5_8__Quitting.html">脚本 5.8. 退出</a>)结束脚本的执行,并提示出错消息:</p>
<code>
form My analysis<br></code>
<code>&nbsp;&nbsp;&nbsp;
real Starting_time_(s) 0.0<br></code>
<code>&nbsp;&nbsp;&nbsp;
real Finishing_time_(s) 1.0<br></code>
<code>
endform<br></code>
<code>
if finishing_time &lt;= starting_time<br></code>
<code>&nbsp;&nbsp;&nbsp;
<b>exit</b> The finishing time should exceed 'starting_time' seconds.<br></code>
<code>
endif<br></code>
<code>
# Proceed with the analysis...<br></code>
<p>
对于不允许出错的情况,可以使用<b>assert</b>命令监控:</p>
<code>
power = Get power<br></code>
<code>
assert power &gt; 0<br></code>
<p>
这样做等效于:</p>
<code>
if (power &gt; 0) = undefined<br></code>
<code>&nbsp;&nbsp;&nbsp;
exit Assertion failed in line xx (undefined): power &gt; 0<br></code>
<code>
elsif not (power &gt; 0)<br></code>
<code>&nbsp;&nbsp;&nbsp;
exit Assertion failed in line xx (false): power &gt; 0<br></code>
<code>
endif<br></code>
<p>
可以禁止Praat发出警告消息:</p>
<code>
nowarn Write to WAV file... hello.wav<br></code>
<p>
这样就能避免由限幅样本之类导致的警告消息。</p>
<p>
还可以禁止Praat显示进度窗口:</p>
<code>
noprogress To Pitch... 0 75 500<br></code>
<p>
这样就能避免执行长时间操作时弹出进度窗口。仅当需要防止用户中止脚本执行时才会用到。</p>
<p>
最后,还可以让Praat忽略出错消息:</p>
<code>
nocheck Remove<br></code>
<p>
这样一来,即便并无对象可以移除,脚本也能继续执行下去。</p>
<h3>指向本页的链接</h3>
<ul>
<li><a href="Scripting.html">脚本</a>
<li><a href="Scripting_6__Communication_outside_the_script.html">脚本 6. 脚本外通信</a>
</ul>
<hr>
<address>
	<p>&copy; ppgb, October 27, 2004</p>
	<p>&copy; 翻译:徐清白,2005年06月10日</p>
</address>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -