pass variable value from applescript to eggplant function

Hi,

I want to pass the value from apple script to eggplant.

This is the query------

global Name , Desc

do AppleScript {{
tell application “Microsoft Excel”
open “Leopard:Users:rajan:Documents:Test1.xls”

set Name to (get value of range (“A2”))
set Desc to (get value of range (“B2”))

get value of the used Range of worksheet 1
close active workbook saving yes
end tell
}}

start using “called”
put functions.plural(Name,Desc) – i want to pass Name and Desc variable value to this function.

I dont know how to pass variable from applescript to suite and vice versa.

Please provide the details for both the things…

To return values from an AppleScript script and transfer them into SenseTalk variables, you can use a Return statement in AppleScript then use the Result function in SenseTalk to access the values that were returned, as described here: http://www.redstonesoftware.com/phpBB2/viewtopic.php?t=1160.

To pass values from Eggplant to AppleScript, use the SenseTalk merge function to insert the values as literals in the AppleScript. Merge will substitute values from SenseTalk into the text of the AppleScript code before it is executed. You should be careful to put any string values in quotes within the AppleScript code. Here’s a trivial example that sets the values of variables named a and b in AppleScript to the values of variables num and str from SenseTalk:

set num to 12
set str to "Hello"
do AppleScript merge of {{
set a to [[num1]]
set b to "[[str1]]"
-- the rest of your AppleScript code would go here
}}

Hi,

Thanks it works…

In my automation I want to search for the particular text from the 1000 record list.I have tried by clicking that down arrow but it is taking long time to search for the record.If it is search word starts with the S it has to wait till S string.

This is what I tried…

set name to “Superuser”
repeat until imagefound (Text:name,TextFont:“Lucida Grande”,TextSize:“10”)

DoubleClick "Btn_Repeat"

end repeat

It is taking long time to search superuser from the list.Please provide the solution for this.

Here are a few things to consider:

  1. The thing that slows Eggplant down the most is failing to find an image. This is because it searches the entire screen, then waits a bit and does it again… 6 more times, with the default settings. There are several things you can do to shorten this time:
  • reduce the imageSearchTime, or one of its component values, the imageSearchCount or the imageSearchDelay:
set the imageSearchCount to 2 -- only search twice
  • limit the searching to a smaller area of the screen, by setting the SearchRectangle to just the area where the image may appear:
set the searchRectangle to (imageLocation("topLeftImage"), imageLocation("bottomRightImage"))
  • give a maximum wait time in the call to the imageFound() function:
 repeat until imagefound (1.0, Text:name,TextFont:"Lucida Grande",TextSize:"10")

(you can even specify a time of 0 for a fast single search, but this can be problematic sometimes – see the documentation for details)

  1. Cheat. :wink: Depending on exactly what type of control you’re dealing with it may be possible to take a shortcut. For example, popup lists on some systems allow you to type a string to select that entry directly, or type the first letter to jump to the first entry beginning with that letter. So you may be able to do this:
typeText name

or:

typeText the first character of name

and then begin your image searching.

Good luck!