TypeText on Mac VNC-Server put wrong Special characters

Hello together, i need your knowledge.

I use on my mac the VNC-Server on a second user as SUT.
When I try to typing text in a edit field with normal characters it works. But when the string I want to typing with TypeText() contains some special characters like “” or “$” the typing text in the edit field ist not correct.


put "myDELabel" into strLang
put "\\Client\C$\Users\testuser\Downloads\Testdata.xlsx" into strValue
Click{text:strLang, searchRectangle:[[35,280], [160,295]], HotSpot:[200,0]}
TypeText strValue
-- in the edit field is written 77Client7C£7Users7testuser7Downloads7Testdata.xlsx

When I type manual by keyboard in the connection window:

  • a “” it types a “/”
  • a “$” it types a “$”
  • a “{” it types a “{”

When I use

typeText shiftDown, OptionKey, "7"
-- eggplant types in the connection window correct a "\"

Where is here the problem ?
Why does eggplant’s TypeText() interpret the string “\Client\C$…” as “77Client7C£…” ?


The backslash character is used to denote a special character is coming such as \n for newline or \t for tab, etc… To get an actual backslash, you would normally use two backslashes, “\”. So you might try:
The pound symbol in place of the dollar sign is likely due to a keyboard language mapping. Google should be able to help you with that.


I would recommend using TypeText keywords instead of trying to escape your characters. For me, at least, it is easier to keep track of. Here is how I would modify the code:
put backslash&backslash&"Client"&backslash&"C"&dollarSign&backslash&"Users"&backslash&"testuser"&backslash&"Downloads"&backslash&"Testdata.xlsx" into strValue

More on keywords can be found here:http://docs.eggplantsoftware.com/ePF/using/epf-typetext-keywords.htm
More on special characters can be found here:http://docs.eggplantsoftware.com/ePF/SenseTalk/stk-values.htm

Thanks DaveHester, but this is no option. I got the string from a data excel. Is not hard coded ;-)…

Thanks mark.b but when I try it on a windows system with vnc it works as expected without any double \ or some other special hacks.

Here are some other things that you could try:
Log strValue – determine that the variable is not being populated differently based on VNC
split strValue by backslash
set myNewValue to backslash&backslash
repeat with each item of strValue
put IT&backslash after myNewValue
end repeat
log myNewValue
HTH, Dave

thanks DaveHester

I made a workaround in similar way you suggested. But with the normal replace. And I’m also mindful of the operating system.
But it is not the way I want to have to go. It has to work without workaround.

to replaceSpecialChars specialCharString 
	   if platform() = "MacOS"
		   replace backslash by backslash&backslash in specialCharString
	   end if
	   return specialCharString
end replaceSpecialChars