Found Mouseclick function. Is there a better way to open and run AB 5.296 with AutoIt rather than the following example? Plus, does anyone know a way to get WinWaitActive to work on the left 9 characters of "AmiBroker - [RUT-I - Russell 2000 Composite Index Daily]" which is "AmiBroker" as I am thinking that this would be better than sleep of 20 seconds.
; Run (open) AmiBroker Run("C:\AmiBroker\broker.exe") ; Wait for AmiBroker to become active - it has "AmiBroker" in upper left window ;WinWaitActive("AmiBroker") ;WinWaitActive("AmiBroker - [RUT-I - Russell 2000 Composite Index Daily]") ; Sleep for 20 seconds to let be sure open Sleep(20000) $x = 500 ; x position $y = 500 ; y position MouseClick("left",$x,$y) Sleep(2000) ; Change to TC2000 database - File menu -> Open, T, Enter Send("!f") Sleep(2000) Send("D") Sleep(2000) Send("T") Sleep(2000) Send("{ENTER}") Sleep(20000) ; Save AmiBroker Send("!f") ; ALT f Sleep(3000) Send("S") ; S for Save ; Exit AmiBroker Sleep(2000) Send("!f") ; ALT f Sleep(2000) Send("X") ; X for Exit ; Done --- In amibroker@yahoogroups.com, "bistrader" <bistra...@...> wrote: > > I have been using AB 5.2 and recently installed 5.296. Twice to make sure as > I was having the following problems. > > I can not AB 5.296 to respond to key strokes!! > > AB 5.296 is NOT response to key strokes and this causes the problem. Here is > what I do. > 1. Click on the AB icon to open AB and it opens. > 2. Hold down the function key and hit F for File or anything else and AB does > not respond. Notice that most upper left corner of screen with "AmiBroker - > [RUT-I - Russell 2000 Composite Index Daily]" in it is light Blue. > 3. Click on center of screen and notice that upper left corner of screen with > "AmiBroker - [RUT-I - Russell 2000 Composite Index Daily]" in it turns to > Dark Blue. Now, AB responds to key strokes like Function Key with F for File. > > I need to figure out how to work around this problem as I use AutoIt a lot to > run AB. None of my AutoIt programs key strokes will work in AB 5.296 (they > did in 5.20, my last version on my PC) just like they do not work as > explained above. Here is a simple example of an AutoIt. > > I can not get AutoIt to work with AB 5.296 give that AB 5.296 will NOT > respond to key strokes UNTIL one clicks on the center of the screen after AB > opens. > > Run("C:\AmiBroker\broker.exe") > > ; NEXT LINE DOES NOT WORK ANYMORE > ;WinWaitActive("AmiBroker") > ; NEITHER DOES NEXT LINE > ;WinWaitActive("AmiBroker - [RUT-I - Russell 2000 Composite Index Daily]") > > ; Sleep for 20 seconds to let be sure open > Sleep(20000) > > ; Change to TC2000 database - File menu -> Open, T, Enter > Send("!f") > Sleep(2000) > Send("D") > Sleep(2000) > Send("T") > Sleep(2000) > Send("{ENTER}") > Sleep(30000) > > ; Save AmiBroker > Send("!f") ; ALT f > Sleep(3000) > Send("S") ; S for Save > > ; Exit AmiBroker > Sleep(2000) > Send("!f") ; ALT f > Sleep(2000) > Send("X") ; X for Exit > > ; DONE > > AmiBroker opens with the code above BUT AmiBroker does NOT respond to ANY of > the key strokes. Help appreciated. > > ... >