Help sending file name to the SUT

I’m writing info to a word doc and then want to save the file. My code opens the save file dialog in word, clicks on the filename text box and then sends the file name to save to the SUT. My code is simple:

click wordSave
click filename
Put fileDescription(“c:\path o\my\file.doc”) into fileInfo
Typetext windowsFilePath(the long name of fileInfo)

In the log, I see:

30-Aug-2012 09:50:20 typetext c:\path o\my\file.doc

On the Sut I see:

C:pathtomyfile.doc

All of the backslashes are being interpreted as escape characters and are being stripped out.

I’ve tried a couple of different things, including
typetext <> and can’t seem to find the magic.

I am using ultraVNC

What am I missing here?

Thanks!
Jennifer

Hello Jennifer

The way that you are using WindowsFilePath() will not work in this scenario, because that function will return the path with single slashes, and they will be interpreted as escape characters, as you have noticed.

In your script, you have this code:

Put fileDescription(“c:\path	o\my\file.doc”) into fileInfo 
Typetext windowsFilePath(the long name of fileInfo) 

Instead, all you need is this:

TypeText "c:\\path\	o\\my\\file.doc"

The double backslashes should keep them from being interpreted as escape characters, and instead be sent as a single backslash to be typed.

If you would still like to use the WindowsFilePath() function, you could do something like this:

put the WindowsFilePath(the long name of fileInfo) into FilePathVar
replace "\" in FilePathVar with "\\"
TypeText FilePathVar

For instance, this code worked for me:

put FileDescription("/Documents/PracticeTest.suite/Scripts/Script.script") into fileInfo
Put windowsFilePath(the long name of fileInfo) into SomeVar
Replace "\" in SomeVar with "\\"
TypeText SomeVar

-Elizabeth