代码之家  ›  专栏  ›  技术社区  ›  Pradeep

解析Applescript中的一组行

  •  1
  • Pradeep  · 技术社区  · 17 年前

    我试图解析从Applescript中的文件读取的一组行。

    这就是我的代码的外观:

    my status_dialog(indexData)
    set AppleScript's text item delimiters to return
    set indexFreq to (text items 1 thru 1 of indexData)
    

    行分隔符不起作用。indexFreq再次返回整个行集,而不是第一行。

    我是这里的新手,在线资源在这方面帮不了我。

    非常感谢!

    1 回复  |  直到 17 年前
        1
  •  1
  •   James Eichele Bernard Igiri    17 年前

    你的代码 应该 按预期工作。问题可能是 return

    回来 :

    tell me to set the text item delimiters to (ASCII character 10) --// LF
    tell me to set the text item delimiters to (ASCII character 13) --// CR
    

    另外,为了确保代码的其余部分

    set test_string to "thisQisQaQtest"
    set the text item delimiters to "Q"
    return text items of test_string
    

    这将生成以下内容(在AppleScript控制台中):