Jump to content
Sign in to follow this  
rossnixon

SEND keystrokes using a variable

Recommended Posts

rossnixon

I am trying to use a variable in my SEND function.

Help example says:

$n = 4

Send("+{TAB " & $n & "}")

My code:

$location=7 ;I assigned this value using StringInStr()

;First I do a Find of certain text in Notepad, then I try the following.

Send('{ESC}{RIGHT}{SHIFTDOWN}{RIGHT " & $location & "}{SHIFTUP}')

It is only selecting one character instead of seven, when it runs.

What else should I try?

(Using AutoIt 3.2.10.0 on XP Home)

Share this post


Link to post
Share on other sites
LongBowNZ

Try this:

$location=7;I assigned this value using StringInStr()
;First I do a Find of certain text in Notepad, then I try the following.
Send("{ESC}{RIGHT}{SHIFTDOWN}{RIGHT " & $location & "}{SHIFTUP}")

Share this post


Link to post
Share on other sites
rossnixon

Try this:

Send("{ESC}{RIGHT}{SHIFTDOWN}{RIGHT " & $location & "}{SHIFTUP}")
Thanks, working now.

I was using Send(' for some simple stuff, and it works. Seems double quotes are required for more complex stuff then.

Share this post


Link to post
Share on other sites
LongBowNZ

I think the problem was you weren't using the same quotes at the start, middle and end.

You used ' " " '

I used " " " "

I could have also used ' ' ' ' ;)

Edited by LongBowNZ

Share this post


Link to post
Share on other sites
rossnixon

I think the problem was you weren't using the same quotes at the start, middle and end.

You used ' " " '

I used " " " "

I could have also used ' ' ' ' ;)

Ahh... now the 'fog' has cleared. I couldn't remember what the & was doing; string concatenation!

Thanks again.

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  

×