Sensetalk - Eggplant's scripting language, leaves a lot to be desired. I do not personally see why people feel the need to invent new languages all the time. The syntax is overly simplistic, and as such can turn anything that is not simple into a lisp-like mess of parentheses in order to be sure what it will do. Some basic language features such as default parameters are missing and need to be engineered into your scripts. Behaviour for uninitialised variables is utterly broken - Sensetalk will silently do what it thinks is best - UninitialisedVar is read as "UninitialisedVar", however A phrase that has not been escaped in quotes may or may not throw a syntax error depending on what out of that phrase has been initialised and what type it has been initialised to.

Any hints and tips on using Sensetalk effectively?

2 Answers 2


To avoid the strange undefined variable behavoirs, set the strictVariables and strictParameters globals to true. This will stop a lot of undefined variable stuff by throwing an exception in most cases; making it a lot easier to deal with them.


From my short time to date (about a month) using sensetalk I have come up with the following:

  1. This should be point 8 but I thought it was important enough to get boosted to the top of the list: Booleans are lazily evaluated from Right to Left (<-), not Left to Right (->) as in most common languages. This means that if you do if func1() and func0() then return True else return False then in the case that func0 returns False func1 will not be evaluated - this is the reverse of most languages where func1 would be evaluated first and you could short-circuit func0. Similarly for if func1() or func0() return True else return false func1 will only be evaluated if func0 returns False.

  2. If you want to use strings, make sure you use quotes around them - the behaviour whereby uninitialised variables are seen as strings is completely borked - avoid it.

  3. Write generic helper scripts - while there are some fairly complex things that Sensetalk/Eggplant will do without breaking a sweat, there are some fairly fundamental things that are missing from the language. Write them and keep them in a helper suite, you will find yourself using them all over the place.

  4. Sensetalk has no default parameters (AFAIK) write your own. I have the following helper function:

    to DefaultTo VariableNameIfYouUseDataLikeThisYouDeserveToGetBitten, Default
      if VariableNameIfYouUseDataLikeThisYouDeserveToGetBitten is empty or \
         VariableNameIfYouUseDataLikeThisYouDeserveToGetBitten = \
         then return Default
      return VariableNameIfYouUseDataLikeThisYouDeserveToGetBitten
    end DefaultTo  

    I use this everywhere in the form of:

    to Blah Var1, Var2, Var3
         set Var1 to DefaultTo(Var1, SensibleDefaultVar1)
         set Var2 to DefaultTo(Var2, SensibleDefaultVar2)
         set Var3 to DefaultTo(Var3, SensibleDefaultVar3)
    end Blah
  5. It is very easy to write automated steps that perform an action, however using these to test something is left as an exercise to you - not necessarily a bad thing but make sure that the person architecting the project knows their stuff.

  6. Sensetalk and Eggplant pose few restrictions on how you approach automated testing other than those integral to the way they work (image capture and recognition over VNC), however make sure that the person architecting the project knows their stuff or it is all too easy to end up with a complicated mess.

  7. Eggplant's performance can be unpredictable - some things are very slow, others are surprisingly fast - you should play about with a few implementations of what you want to do rather than making any assumptions about performance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.