错误号-1708尽管拆分字符串 [英] error number -1708 While splitting a string
问题描述
我有以下函数,它字符串分割:
I have the following function that does string splitting:
on splitText(aString, delimiter)
set retVal to {}
set prevDelimiter to AppleScript's text item delimiters
set AppleScript's text item delimiters to {delimiter}
set retVal to every text item of aString
set AppleScript's text item delimiters to prevDelimiter
return retVal
end splitText
当单独使用,它的工作原理确定
When used by itself, it works ok
日志splitText(HTTP://google.com | /Users/pistacchio/Desktop/google.jpg,|)
log splitText("http://google.com|/Users/pistacchio/Desktop/google.jpg", "|")
但是,当我我需要的范围内使用它,我得到一个 -1708
错误
But when I use it within the context I need, I get a -1708
error
tell application "Safari"
activate
repeat with row in linesToPrint
log splitText("http://google.com|/Users/pistacchio/Desktop/google.jpg", "|")
end repeat
end tell
linesToPrint
是一个字符串数组
任何帮助吗?
推荐答案
在使用处理程序从应用程序中告诉语句,你需要使用的术语<一个href=\"https://developer.apple.com/library/mac/#documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_about_handlers.html#//apple_ref/doc/uid/TP40000983-CH206-SW1\">of我或<一个href=\"https://developer.apple.com/library/mac/#documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_about_handlers.html#//apple_ref/doc/uid/TP40000983-CH206-SW1\">my以表明期限从你的脚本,而不是应用程序需要做的。
When using a handler from inside an application tell statement, you need to use the terms of me or my to indicate that the term is from your script, and not something that the application needs to do.
这篇关于错误号-1708尽管拆分字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!