anixon Posted December 6, 2006 Posted December 6, 2006 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
xcal Posted December 6, 2006 Posted December 6, 2006 $nums = 1423 $array = StringSplit($nums, '') For $i = 1 To UBound($array) - 1 Send('{numpad' & $array[$i] & '}') Next How To Ask Questions The Smart Way
anixon Posted December 6, 2006 Author Posted December 6, 2006 $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
xcal Posted December 6, 2006 Posted December 6, 2006 (edited) You're welcome, but, I guess you can't just do... $var = 1423 Send($var)? Edited December 6, 2006 by xcal How To Ask Questions The Smart Way
anixon Posted December 6, 2006 Author Posted December 6, 2006 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
xcal Posted December 6, 2006 Posted December 6, 2006 ...what more can I say you are a legend...... AntNow if only I could convince my wife... How To Ask Questions The Smart Way
anixon Posted December 6, 2006 Author Posted December 6, 2006 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...... AntFlowers and a bottle of good Aussie wine does it for me....... Ant
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now