正在恢复必要的文字分隔符的项目? [英] Is restoring text item delimiters necessary?

查看:100
本文介绍了正在恢复必要的文字分隔符的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用文字分隔符项常用推荐的方法是这样的:

 集工贸署的AppleScript的文本项分隔符
设置的AppleScript的文本项分隔符为X
集合L到文本aaxbb的项目
设置的AppleScript的文本项分隔符TID

我平时做这样的事情,虽然:

 设置文本项分隔符为X
aaxbb的文本项

http://macscripter.net/viewtopic.php?id=24725


  

要注意的消息是很重要的:始终将他们带回。 AppleScript的记住它的分隔符设置。即使你打开脚本编辑器一个新的第二个脚本,你在第一个设定的分隔符将应用在第二位。


我还没有能够重现,虽然它。确实在某些版本的OS X的行为改变?

<一个href=\"http://books.gigatux.nl/mirror/applescriptdefinitiveguide/applescpttdg2-CHP-13-SECT-7.html#applescpttdg2-CHP-13-SECT-7\"相对=nofollow>的AppleScript权威指南:


  

文本项目分隔符的值,只要坚持为一体的AppleScript的脚本组件执行此实例。因为你可能会遇到这个脚本组件,其中任何一个可以设置文本项目分隔符的presence多个脚本,这是明智的任何假设文本项目分隔符的值。


这仍然是这样,或者你可以给任何例子,文本项目定界符属性会影响其他脚本?


解决方案

我记得读一些关于这个变化,你在说什么,这是不再需要重新设置,但是我无法找到任何关于它之后谷歌搜索。因此我做了一个快速测试。我做了这两个脚本,并在编辑器中的AppleScript他们跑了。首先这一个...

 设置文本项分隔符东西
返回文本项分隔符

然后这一个...

 返回文本项分隔符

第二个脚本返回{}。如此看来第一个脚本不影响第二。我在这两个10.6和10.8具有相同的结果测试这一点。

下面是AppleScript的发行说明。我无法找到发行说明10.7或10.8。搜索他们变成了在这个问题上没有任何...

<$p$p><$c$c>http://developer.apple.com/library/mac/#releasenotes/AppleScript/RN-AppleScript/RN-10_3/RN-10_3.html#//apple_ref/doc/uid/TP40000982-CH103-SW1

因此​​,我对你没有明确的答案。大家都说重置他们,但我简单的测试表明,它不是必需的。

另外你说得对,你并不需要的AppleScript的告诉块之外。

The commonly recommended way to use text item delimiters is like this:

set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "x"
set l to text items of "aaxbb"
set AppleScript's text item delimiters to tid
l

I usually do something like this though:

set text item delimiters to "x"
text items of "aaxbb"

http://macscripter.net/viewtopic.php?id=24725:

It is important to pay attention to the message: "ALWAYS SET THEM BACK". AppleScript remembers its delimiters setting. Even if you open a new second script in the Script Editor, the delimiters you set in the first will apply in the second.

I haven't been able to reproduce it though. Did the behavior change in some version of OS X?

AppleScript: The Definitive Guide:

The value of the text item delimiters persists as long as this instance of the AppleScript scripting component does. Because you might run more than one script in the presence of this scripting component, any of which might set the text item delimiters, it is wise to make no assumptions as to the value of the text item delimiters.

Is this still the case, or can you give any examples where the text item delimiters property affects other scripts?

解决方案

I remember reading something about this change that you're talking about, that it was no longer necessary to reset them, however I couldn't find anything about it after a Google search. As such I did a quick test. I made these 2 scripts and ran them in AppleScript Editor. First this one...

set text item delimiters to "something"
return text item delimiters

And then this one...

return text item delimiters

The second script returns {""}. So it seems the first script is not affecting the second. I tested this in both 10.6 and 10.8 with the same results.

Here's applescript release notes. I can't find release notes for 10.7 or 10.8. Searching them turns up nothing on this subject either...

http://developer.apple.com/library/mac/#releasenotes/AppleScript/RN-AppleScript/RN-10_3/RN-10_3.html#//apple_ref/doc/uid/TP40000982-CH103-SW1

Therefore I have no definitive answer for you. Everyone says to reset them but my simple test shows that it's not required.

Also you're right, you don't need "Applescript's" outside of tell blocks.

这篇关于正在恢复必要的文字分隔符的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆