Jump to content

Recommended Posts

Posted

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

Posted

$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
Posted

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
Posted

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

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
  • Recently Browsing   0 members

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