Sign in to follow this  
Followers 0
GianniD

Newbie Question about Send command

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

You keep forgetting the & - that's why you get the error.

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


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0