yookee Posted December 5, 2008 Share Posted December 5, 2008 (edited) I have a script, but it can't work properly.; Script 1 WinActivate("Window A") ; Activate window ASend("!C") ; Press Alt+C to unfold submenu of mainmenu on window A, like "File|Calculation|Help"Send("L") ; Press L to select one menuitem(as Load(L)), then window B be shownWinActivate("Window B") ; Oh, window B not be activated, current active window is explorer running this scriptBut if these is only one line in script, and window B is shown already, deactivated.; Script 2WinActivate("Window B") ; No problem,window B is activatedIn help document of AutoIt, these is an example for WinList()$var = WinList()For $i = 1 to $var[0][0] If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then MsgBox(0, "Detail", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1]) EndIfNextFunc IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIfEndFuncI add these codes to scripts for enumerating all window existed.In second script, window B is listed out.But in first script, window B is shown and not listed at all.What and how does Send() enchant window B? Edited December 5, 2008 by yookee Link to comment Share on other sites More sharing options...
yookee Posted December 5, 2008 Author Share Posted December 5, 2008 I can't obtain anything about window B, how can I control it? It is there, it were not there. Link to comment Share on other sites More sharing options...
Skruge Posted December 5, 2008 Share Posted December 5, 2008 Welcome to the forums!It sounds like there's a slight delay between sending the keystrokes and the creation of "Window B".You can try pausing the script for a few milliseconds with Sleep() or wait for the window to be created.WinActivate("Window A") ; Activate window A Send("!C") ; Press Alt+C to unfold submenu of mainmenu on window A, like "File|Calculation|Help" Send("L") ; Press L to select one menuitem(as Load(L)), then window B be shown WinWait("Window B") ; Wait for the window to be created WinActivate("Window B")Also, I suggest that you look into the WinMenuSelectItem function...If the application uses standard menus, it will be much more reliable than Send and doesn't require Window A to be active or visible. [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
yookee Posted December 5, 2008 Author Share Posted December 5, 2008 Thanks a lot, Skruge Window B has been not created immediately, windows manager have to wait for a CREATED event. I'll look WinMenuSelectItem again, maybe menus of the program is not standard. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted December 5, 2008 Share Posted December 5, 2008 (edited) While 1 If Winexists(window B) then Winactivate(window B) exitloop Else Sleep(100) endif Wend Just read all of above, that makes more sence, Edited December 5, 2008 by youknowwho4eva Giggity Link to comment Share on other sites More sharing options...
yookee Posted December 6, 2008 Author Share Posted December 6, 2008 I see. I find things being done more quickly is not better, we should relax for enjoyment. In my case, many Send() be used, not only WinWait() and WinWaitActive() must be used, but also SendKeyDelay have to be adjusted. Opt("SendKeyDelay", 50) work finely, but delay=20ms is out of control. Link to comment Share on other sites More sharing options...
getmo96 Posted December 30, 2008 Share Posted December 30, 2008 While 1 If Winexists(window B) then Winactivate(window B) exitloop Else Sleep(100) endif Wend Just read all of above, that makes more sence,I am trying to automate a process with a SAP frontend daabase.... A lot of point and click, and there are just lists of projects I get from fellow peers at work. As you can see I am running the same porcess for everything in excel column. Anywayz I need am having trouble because the remote host where the app is running, has a heave traffic load which eats up processor time. I need to insert a if statment that identifies an error and the end user has to click a button to continue. I want the script to not stop and continue completeion of the list provided. Later I will get fance and add a logfile. I'll b workin it for now any advice will help. I am a Linux/Unix guy, but helping friends with a little VB. Dim $ProjectNum Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("Project Builder: Project EUSMB.MOC.000036","") If Not WinActive("Project Builder: Project EUSMB.MOC.000036","") Then WinActivate("Project Builder: Project EUSMB.MOC.000036","") WinWaitActive("Project Builder: Project EUSMB.MOC.000036","") For $ProjectNum = 0000037 To 000574 Step 1 Send("{CTRLDOWN}{F2}{CTRLUP}") Sleep(2500) Send ("{ALT}!e") Sleep(2500) Send ("{DOWN}{DOWN}{DOWN}{RIGHT}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{RIGHT}{ENTER}") Sleep(2500) Send ("{ALT}!p") Sleep(3000) Send("{DOWN}{DOWN}{ENTER}") WinWait("Open Project","") If Not WinActive("Open Project","") Then WinActivate("Open Project","") WinWaitActive("Open Project","") Sleep(3000) Send("EUSMB.MOC.") Send($ProjectNum) Send("{ENTER}") WinWait("Close the project and open another","") If Not WinActive("Close the project and open another","") Then WinActivate("Close the project and open another","") WinWaitActive("Close the project and open another","") Send("{ENTER}") Sleep(30000) Next Link to comment Share on other sites More sharing options...
TurionAltec Posted December 30, 2008 Share Posted December 30, 2008 (edited) Hi getmo96,You really should start a new thread with your problem rather than tack it on to someone elses.EDITTriple posted. Seehttp://www.autoitscript.com/forum/index.php?showtopic=86833 Edited December 30, 2008 by TurionAltec Link to comment Share on other sites More sharing options...
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