Basics on manipulating Win32 filesystem

When connecting to a Win 2K S.U.T. from my OS X server, what is the proper syntax to manipulate the Windows file system. For example, if I have the following path in Windows:

C:\Documents and Settings\user1\Desktop\logfile.txt

what is the proper way to refer to the file?

In the most basic sense, here is the type of script I’d use to see if the file is present:


put "C:\Documents and Settings\user1\Desktop\logfile.txt" into targFile
if there is a file targFile then answer "Exists" else answer "NOT exist"

Dear Doubting:

If I understand the question right, you are asking how to write SenseTalk code to interact with the remote file system. SenseTalk instructions do not pass across the VNC connection; only mouse and keyboard events are sent to the remote system. All that is returned to Eggplant is a picture of the current state of the remote system’s user interface. Eggplant scripts always interact with the remote system through the UI; they do not perform direct access/manipulation of the remote system. You could write code like your example to interact with the filesystem local to the Eggplant machine, but to do what you ask on the remote machine, there are at least two approaches:

  1. Create a script to navigate the file system via Windows Explorer and look for a previously captured image of the filename you are looking for. For example (quoted strings are image names):

DoubleClick "WindowsExplorerIcon"
DoubleClick "MyComputerFolder"
DoubleClick "DocsAndSettingsFolder"
DoubleClick "user1"
DoubleClick "Desktop"
if not ImageFound("logfileDocument") then
      put "File does not exist"
else
      put "File exists"
end if

or your script could access the Command Prompt and use TypeText commands to complete the task:


DoubleClick "CommandPromptIcon"
TypeText "cd C:\\Documents and Settings\\user1\\Desktop\\"
TypeText "DIR /A-D"
// At this point you could look for an image of the filename, 
// or you could select the output from the previous command 
// using the Drag command, copy it to the clipboard, pull that 
// information into Eggplant using the RemoteClipboard() function, 
// and parse the text for the filename.

Please note the use of the double backslashes in the directory path above. Eggplant’s TypeText command uses the backslash to indicate an escape sequence, so you’ll need two in a row to generate a single backslash from TypeText.

I hope this clarifies things for you. Please let us know if you have any other questions.

-Matt Hicks
Customer Support

Of course, if the remote filesystem is mounted on the local machine (using “Connect to Server…” from the Go menu in the Finder) then the remote files will be available to the script just like local files. In this case, all of the SenseTalk file access features should work just fine with the remote files.