Sign in to follow this  
Followers 0
13lack13lade

ControlSend different keys to different windows simultaneously

4 posts in this topic

Hi All,

I have a problem at work where i am wanting to read of one excel spreadsheet, and have the same script starting at different points, sending to two separate windows (two separate netterm.exe clients)

The problem I seem to be having  is sending DIFFERENT keystrokes simultaneously via ControlSend to two separately named windows 'cal1' 'cal2' which each script specifically refers to however the controlsends seem to interact with each other..

Is there a way to get around this?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

That is how i am doing it, but they seem to be interfering with each other... This is the script, and i simply created another one with the window name being different for the otherscript $wt = 'cal2'

Can you controlsend different keystrokes to different windows simultaneously ? e.g send key a to window a and key b to window b at the same time?

#include <Excel.au3>

    ; open a page
    $oExcel = _Excel_Open()
    $wkbk = _Excel_BookOpen($oExcel,"servereditedout\OMNI FIX 011116.xlsx")

    sleep(5000)

For $i = 2 To 3 ;Loop
    $a = _Excel_RangeRead($wkbk, default,"a"&$i, 1)
    $b = _Excel_RangeRead($wkbk, default,"b"&$i,1)
    $c = _Excel_RangeRead($wkbk, default,"c"&$i,1) ;need to update
    $d = _Excel_RangeRead($wkbk, default,"d"&$i,1)
    $e = _Excel_RangeRead($wkbk, default,"e"&$i,1)
    $f = _Excel_RangeRead($wkbk, default,"f"&$i,1)
    $g = _Excel_RangeRead($wkbk, default,"g"&$i,1)
    $h = _Excel_RangeRead($wkbk, default,"H"&$i,1)
        $j = _Excel_RangeRead($wkbk, default,"j"&$i,1)
    $k = _Excel_RangeRead($wkbk, default,"k"&$i,1)
    $l = _Excel_RangeRead($wkbk, default,"l"&$i,1)
    $m = _Excel_RangeRead($wkbk, default,"m"&$i,1)
    $n = _Excel_RangeRead($wkbk, default,"n"&$i,1)
    $o = _Excel_RangeRead($wkbk, default,"o"&$i,1)
    $p = _Excel_RangeRead($wkbk, default,"p"&$i,1)
    $q = _Excel_RangeRead($wkbk, default,"q"&$i,1)
    $wt = "cal1"


sleep(5000)
controlsend($wt,"","",$a)
sleep(250)
controlsend($wt,"","","{F3}")
sleep(250)
controlsend($wt,"","",$c)
sleep(250)
controlsend($wt,"","",$d)
sleep(250)
controlsend($wt,"","","{TAB}")
sleep(250)
controlsend($wt,"","",$f)
sleep(250)
controlsend($wt,"","",$g)
sleep(250)
controlsend($wt,"","",$h)
sleep(250)
controlsend($wt,"","","{ENTER}")
sleep(2000)
controlsend($wt,"","",$j)
sleep(250)
controlsend($wt,"","",$k)
sleep(250)
controlsend($wt,"","","{TAB 3}")
sleep(250)
controlsend($wt,"","",$m)
sleep(250)
controlsend($wt,"","","{TAB}")
sleep(250)
controlsend($wt,"","",$o)
sleep(50)
controlsend($wt,"","","{F7}")
sleep(50)
controlsend($wt,"","","{F1}")
Next

 

Edited by 13lack13lade

Share this post


Link to post
Share on other sites

Its okay, i found a workaround solution... i simply spread the data across the spreadsheet rather than down. that way it will send the first data before the second, thus removing any conflict. Heres what i mean:

controlsend($wt,"","","{ENTER}")
controlsend($wt2,"","","{ENTER}")
controlsend($wt3,"","","{ENTER}")
controlsend($wt4,"","","{ENTER}")

 

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