mvdl Posted August 29, 2007 Share Posted August 29, 2007 I'm looking for the solution to the following problem.I have a complex script to test an application. It has the folowing piece of code to close a part of the application: (closing trough menu: File -> Close)Send("!f") Send("c")Impresive huh The problem: at a certain point in the script Send("!f") won't do a thing under vista (business 32bit), no dropdown list appears. The same script works perfectly under XP (sp2), its encapsulated in a function which is in an include file, and it works fine in other parts of the script.The code I execute 'just' before it doesnt seem to be relevant. It must be but adding/removing them didnt help me locate the source of my problem.I added winactivates and some mouseclicks to make sure the correct window and such were selected without resultI tried to manualy reproduce the ALT-f 'bug' without success. Even if I add an exit just before the Send("!f") and then do it manualy it works fine... but when AutoIt does it, it doesnt.I cant figure out why this happens only under Vista and not under XP.Has anyone encountered this before in vista? any sugestions? Link to comment Share on other sites More sharing options...
herewasplato Posted August 29, 2007 Share Posted August 29, 2007 (edited) Welcome to the forum.AutoIt seems to "see" more info in XP than it does in Vista:See this post/thread:http://www.autoitscript.com/forum/index.ph...st&p=394006Perhaps the WinActivate or other Win... functions prior to your "alt-f" code is not working as expected. Maybe if you posted a few lines before the "alt-f" line we could help sort this out.Or you might want to read up on the WinMenuSelectItem function.Enjoy AutoIt... Edited August 29, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
mvdl Posted August 29, 2007 Author Share Posted August 29, 2007 Or you might want to read up on the WinMenuSelectItem function. Enjoy AutoIt... I tried that and same result: Func closeProject($win, $confirmation, $lastWindow) dbg(1," Close Project: "&$win); log function (to GUI, logfile, SciTE) If wwa($win,$wwaDelay) == False Then Return False; wrapper around winwaitactive with logging and error reporting ; Using this methode to avoid Vista wierdness. If WinMenuSelectItem($win,"","&File","&Close") == 0 Then dbg(1,"! Could not select File->Close of window: "&$win) EndIf ;dbg(7, " Sending ALT-F c") ;Send("!f") ;Send("c") If $confirmation == True Then If wwa("FlexMail", $wwaDelay) == False Then Return False Send("n") EndIf if $lastWindow == True Then $Projects += 1; Closed a project, a new will be generated with number +1 EndIf Return True EndFunc; closeProject I replaced my Send("!f") as you sugested but nothing happens. WinMenuSelectItem returns 0, even though it is called with the correct window and that window is active. (made sure of that with a winactivate and a mousclick on the center of the app prior to calling closeProject) Is there a way to get more error info about why WinMenuSelectItem returned 0? I think WinMenuSelectItem wont work because it may be a toolbar pretending to be a menu, not a real menu. Will investigate more tomorrow. Link to comment Share on other sites More sharing options...
herewasplato Posted August 29, 2007 Share Posted August 29, 2007 Maybe WinClose will work... [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
mvdl Posted August 31, 2007 Author Share Posted August 31, 2007 Maybe WinClose will work...Thanks, that works. It still not solves the problem but atleast it avoids it, which is good enough for now 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