Jump to content
Sign in to follow this  
anixon

Send Function

Recommended Posts

anixon

I guess this is pretty basic but I have just not been able to get my mind around it so help would be appreciated

Is this how to send 1432 as a number keystrokes in sequence

Run("notepad.exe")

WinWaitActive("Untitled - Notepad")

$var1 = 1423

$n1 = StringLeft($var1, 1)

$n2 = StringMid($var1, 2, 1)

$n3 = StringMid($var1, 3, 1)

$n4 = StringMid($var1, 4, 1)

send("{numpad0}" & $n1)

send("{numpad0}" & $n2)

send("{numpad0}" & $n3)

send("{numpad0}" & $n4)

The result is

01040203

and not 1423 as required. Can anyone tell me the magic? ;) Ant

Share this post


Link to post
Share on other sites
anixon

$nums = 1423

$array = StringSplit($nums, '')

For $i = 1 To UBound($array) - 1
    Send('{numpad' & $array[$i] & '}')
Next
Wow I like your version much better than mine and it works like a charm. That is something new I have learnt today. Thank you very much for your help. ;) Ant

Share this post


Link to post
Share on other sites
anixon

You're welcome, but, I guess you can't just do...

$var = 1423
Send($var)
?
That works to and it meets the requirement of less code required to the same. Two lines what more can I say you are a legend...... ;) Ant

Share this post


Link to post
Share on other sites
anixon

That works to and it meets the requirement of less code required to the same. Two lines what more can I say you are a legend...... :lmao: Ant

Flowers and a bottle of good Aussie wine does it for me....... ;) Ant

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.