Jump to content

Newbie Question about Send command


GianniD
 Share

Recommended Posts

Hey everyone. I am trying to write a command to enter a formula into excel and have it contain a variable within it. Now since i'm new to AutoIt i may be doing this a very drawn out way but nonetheless it sort of works.

This is my code:

$var1=9

Sleep(5000)

While $var1 < 10

Send("{ENTER}")

Send("{F2}")

Send("=6371.1*((2*ASIN(SQRT((SIN((RADIANS(Data!C"$var1")-RADIANS(Data!F2))/2)^2)+COS(RADIANS(Data!C"$var1"))*COS(RADIANS(Data!F2))*(SIN((RADIANS(Data!B"$var1")-RADIANS(Data!G2))/2)^2)))))*1000)")

$var1=$var1+1

WEnd

The part where $var1 is is where i want to enter the variable but i keep getting an error. Could someone help me with the syntax?

Thanks

Link to comment
Share on other sites

It should be:

Send("=6371.1*((2*ASIN(SQRT((SIN((RADIANS(Data!C" & $var1 & ")-RADIANS(Data!F2))/2)^2)+COS(RADIANS(Data!C" & $var1 & "))*COS(RADIANS(Data!F2))*(SIN((RADIANS(Data!B" & $var1 & ")-RADIANS(Data!G2))/2)^2)))))*1000)")

If you need those double quotes to be part of the formula, it would be:

Send('=6371.1*((2*ASIN(SQRT((SIN((RADIANS(Data!C"' & $var1 & '")-RADIANS(Data!F2))/2)^2)+COS(RADIANS(Data!C"' & $var1 & '"))*COS(RADIANS(Data!F2))*(SIN((RADIANS(Data!B"' & $var1 & '")-RADIANS(Data!G2))/2)^2)))))*1000)')
Edited by omikron48
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...