0

我很难从另一台机器上读取文本文件。我已经尝试像这样映射文件\10.212.9.20\Eggplant\Test\propertyfile.txt。但它不起作用。这是我的代码:

set the itemDelimiter to "="
    repeat with theParams = each line of file "\\10.212.9.20\Eggplant\Test\propertyfile.txt"
    insert item 2 of theParams after myList
end repeat

put item 6 of myList into ServerURL
put item 10 of myList into Username
put item 9 of myList into Password

谢谢您的帮助。

4

2 回答 2

0

"\10.212.9.20\Eggplant\Test\propertyfile.txt"

你在 Windows 上运行 eggPlant 吗?Windows 上的 eggPlant Functional 只能解析字母映射的驱动器,因此如果您使用字母(即 D:\、E:)将共享驱动器映射到您的 eggPlant 机器,那么您将能够与保存在另一台机器上的文件进行交互:

重复 theParams = 文件的每一行 "D:\Eggplant\Test\propertyfile.txt"

于 2016-03-04T23:35:56.587 回答
0

如果您尝试在您正在测试的系统上打开文件,您可以让 eggPlant 在文本编辑器中打开该文件,然后使用 ctrl+a ctrl+c 将其文本复制到剪贴板中。然后,您可以像解析文件一样解析此文本。

-- Assuming you have located the file and opened it in a text editor.
click(SomeLocationWithinTheTextEditor)
typeText ControlKey, "a" -- select all
typeText ControlKey, "c" -- copy to clipboard

set myTextFile = remoteClipboard(5) -- Wait up to 5 seconds to return the clipboard content

set the item delimiter to "="
repeat for each line of myTextFile
    insert item 2 of it after myList
end repeat

put item 6 of myList into ServerURL
put item 9 of myList into Password
put item 10 of myList into Username
于 2016-01-12T18:33:16.783 回答