darknuke Posted June 13, 2004 Share Posted June 13, 2004 (edited) I am trying to automatically sign onto AIM, and set an away. I've accomplished this using mouse clicks, but occasionally someone will IM me right away, or the something else causes it to go wrong. So I tried using WinMenuSelectItem(). The problem is that it will not work with menus within the main menu.I tried it again in a different scenario; creating a new folder.WinMenuSelectItem("bin", "", "&File", "Ne&w", "&Folder")Menu:Help? Edited June 13, 2004 by darknuke Link to comment Share on other sites More sharing options...
Valik Posted June 13, 2004 Share Posted June 13, 2004 WinMenuSelectItem() only works on real menu's. Explorer doesn't use real menu's, it uses other controls masquerading as real menu's. In the real world, very few applications actually do use a real menu. Link to comment Share on other sites More sharing options...
darknuke Posted June 14, 2004 Author Share Posted June 14, 2004 What about AIM? I have been able to use the menu items on the first level there, but not the second like I outlined here. Link to comment Share on other sites More sharing options...
pekster Posted June 14, 2004 Share Posted June 14, 2004 Why not use a ControlSend? I use this method to open menus and select items in it all the time, including to minimized or hidden windows. You might also be interested in checking out my ControlSendPlus funtion, which properly uses the shift, control, and alt keystrokes. The standard ControlSend function won't always work, and there's nothing that we can do to change that. (For more information on this issue, see the NOTE 1 in my readme included with my function.) [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
Valik Posted June 14, 2004 Share Posted June 14, 2004 If it works with the first level, are you positive that you are using the correct name on the second level? Make sure you use & for the accelerator, even if it isn't always visible, it still might be there. Link to comment Share on other sites More sharing options...
darknuke Posted June 14, 2004 Author Share Posted June 14, 2004 (edited) I'm positive, I was pressing Alt + Letter to figure which it is because the underscores aren't below the letters.WinMenuSelectItem("dkennedy15's Buddy List Window", "", "&My AIM", "&Away Message", "&New Message...")The underscore under N isn't shown in the image, and I even removed the & from &New to see if that was the problem, but to no avail. Edited June 14, 2004 by darknuke Link to comment Share on other sites More sharing options...
emmanuel Posted June 14, 2004 Share Posted June 14, 2004 so, just use controlsend with the keystrokes that you manually tested out? "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
darknuke Posted June 14, 2004 Author Share Posted June 14, 2004 (edited) Found the name of the control using WindowSpy, but I'm not really sure how to use ControlSend. I'll just have to use ol' unreliable keypresses. Edited June 14, 2004 by darknuke Link to comment Share on other sites More sharing options...
tutor2000 Posted June 14, 2004 Share Posted June 14, 2004 Found the name of the control using WindowSpy, but I'm not really sure how to use ControlSend. I'll just have to use ol' unreliable keypresses. I assume youi checked the help file it's usually, well helpfulRick Link to comment Share on other sites More sharing options...
emmanuel Posted June 14, 2004 Share Posted June 14, 2004 I assume youi checked the help file it's usually, well helpfulRickand by 'helpful' we mean "it will tell you exactly how to do this" "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
tutor2000 Posted June 14, 2004 Share Posted June 14, 2004 and by 'helpful' we mean "it will tell you exactly how to do this"Took 30 seconds for look this up hope it helps ControlSend -------------------------------------------------------------------------------- Sends a string of characters to a control. ControlSend ( "title", "text", "classnameNN", "string" [, flag] ) Parameters title The title of the window to access. text The text of the window to access. classnameNN The classname and instance of the required control or the exact title/text of the control with any underlined character denoted with a preceding &. string String of characters to send to the control. flag [optional] Changes how "keys" is processed: flag = 0 (default), Text contains special characters like + to indicate SHIFT and {LEFT} to indicate left arrow. flag = 1, keys are sent raw. Return Value Success: Returns 1. Failure: Returns 0 if window/control is not found. Remarks ControlSend can be quite useful to send capital letters without messing up the state of "Shift." When using a control name in the Control functions, you need to add a number to the end of the name to indicate which control. For example, if there two controls listed called "MDIClient", you would refer to these as "MDIClient1" and "MDIClient2". Note, this function cannot send all the characters that the usual Send function can (notably ALT keys) but it can send most of them--even to non-active or hidden windows! Related ControlCommand, Send Example ControlSend("Untitled", "", "Edit1", "This is a line of text in the notepad window") Link to comment Share on other sites More sharing options...
darknuke Posted June 14, 2004 Author Share Posted June 14, 2004 (edited) Yes, I've been scouring through the help file and particularly the CommandSend() & WinMenuSelectItem() topics. (That topic is actually open at the time I'm posting this ) I meant I didn't know how to use CommandSend() on menus, as the example in the help file is just the text box in notepad. I did try using CommandSend() with no success.@EmmanuelIt's one line of code, I'm not asking you guys to write me a whole script. Edited June 14, 2004 by darknuke Link to comment Share on other sites More sharing options...
pekster Posted June 14, 2004 Share Posted June 14, 2004 (edited) Yes, I've been scouring through the help file and particularly the CommandSend() & WinMenuSelectItem() topics. (That topic is actually open at the time I'm posting this ) I meant I didn't know how to use CommandSend() on menus, as the example in the help file is just the text box in notepad. It's the same thing as a Send... the string does the exact same thing, but only sends it to a control. So: Send("!fwf") becomes: ControlSend($title , "", $control, "!fwf") Please note that since it is only sending to a control, some applications will not work with this method because they will ignore the local control shift, alt, and/or control keystrokes. To do that, use my UDF. Typo corrected Edited June 14, 2004 by pekster [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
darknuke Posted June 14, 2004 Author Share Posted June 14, 2004 Thanks for trying to help, but I can't even find the control name for the menu. The control name I found earlier must have been below the menu. Link to comment Share on other sites More sharing options...
pekster Posted June 14, 2004 Share Posted June 14, 2004 I can't even find the control name for the menu. The control name I found earlier must have been below the menu.Use it instead. As long as the keystroke is sent to a control that's in the main window (and not a text control itself) it should open the menu. Have a look at the following example: Opt("WinTitleMatchMode", 4) Run("explorer.exe") $exists = WinWaitActive("classname=ExploreWClass", "", 10) If NOT $exists Then MsgBox(0, "Error", "Explorer window not becomming active") Exit EndIf $title = "classname=ExploreWClass" $control = "ToolbarWindow323" ControlSend($title , "", $control, "!fwf", 0) [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
darknuke Posted June 14, 2004 Author Share Posted June 14, 2004 (edited) For some reason it doesn't work correctly unless the window with the control on it is in focus. ControlSend("dkennedys15's Buddy List Window", "", "_Oscar_Tree1", "!a{DOWN}{ENTER}") Edited June 14, 2004 by darknuke Link to comment Share on other sites More sharing options...
pekster Posted June 14, 2004 Share Posted June 14, 2004 As I did mention in some above post, sometimes Controls won't accept the local alt, control, or shift keystrokes. Did you try my UDF? With flag 2 or 4 it might work, since those two modes use the global alt keystroke. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. 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