cappy2112 Posted December 30, 2005 Share Posted December 30, 2005 (edited) I'm using ControlCommand to get the Highlighted text from an Edit box, that appears when a windows (Common Dialogue) File Browser is displayed. My Call looks like this >>ControlCommand ( Bank File, "File &name:", "Edit1", "GetSelected", "" ) Correction my call really looks like this $WindowTitle="Bank File" ControlCommand ( $WindowTitle, "File &name:", "Edit1", "GetSelected", "" ) and an example of the Highlighted text in the edit box is "PerfBank1" however, when I display the return value from ControCommand in a MSgBox, only a 1 is displayed. What am I doing wrong? IS there a better way yo get the highlighted text in the edit box? ControlGetText() only returns an empty string Edited December 31, 2005 by cappy2112 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 30, 2005 Moderators Share Posted December 30, 2005 For browser automation, take a look at Dales IE.au3. You can find it here: http://www.autoitscript.com/forum/index.php?showtopic=13398Hope that helps a bit... Good Luck. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
seandisanti Posted December 30, 2005 Share Posted December 30, 2005 I'm using ControlCommand to get the Highlighted text from an Edit box, that appears when a windows (Common Dialogue) File Browser is displayed. My Call looks like this ControlCommand ( Bank File, "File &name:", "Edit1", "GetSelected", "" ) and an example of the Highlighted text in the edit box is "PerfBank1" however, when I display the return value from ControCommand in a MSgBox, only a 1 is displayed. What am I doing wrong? IS there a better way yo get the highlighted text in the edit box? ControlGetText() only returns an empty string first, i'd put "Bank File" in quotes, if that doesn't work you could try: ControlSend("Bank File","","Edit1","^c") $yourvaule = ClipGet() Link to comment Share on other sites More sharing options...
cappy2112 Posted December 30, 2005 Author Share Posted December 30, 2005 For browser automation, take a look at Dales IE.au3. You can find it here: http://www.autoitscript.com/forum/index.php?showtopic=13398Hope that helps a bit... Good Luck.I didn't say anything about internet explorer. Link to comment Share on other sites More sharing options...
cappy2112 Posted December 30, 2005 Author Share Posted December 30, 2005 first, i'd put "Bank File" in quotes, if that doesn't work you could try: ControlSend("Bank File","","Edit1","^c") $yourvaule = ClipGet() Looks like a good idea. I'll try it. But I'd like to know why my ControlCommand() call doesn't work. I"m new to AutoIt, and there are a lot of API's to learn. The tutorials are woefully inadequit, and the helpfile is very misleading. Link to comment Share on other sites More sharing options...
herewasplato Posted December 30, 2005 Share Posted December 30, 2005 The tutorials are woefully inadequit, and the helpfile is very misleading.Feel free to write your own tutorials after you use AutoIt for a while... for now, compare the "production" version of the help file with the beta one on any function and offer suggested changes.Are you sure that your "(Common Dialogue) File Browser" uses "standard Microsoft controls" or are you just experimenting in the hopes that they will work?From the help file under the topic "Controls":Note: AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation. Experiment! [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
seandisanti Posted December 30, 2005 Share Posted December 30, 2005 I didn't say anything about internet explorer.you'll have to forgive smoke, i think he must've had too much fun last night based on his posts this morning... but he really knows his stuff, i swear.Looks like a good idea. I'll try it.But I'd like to know why my ControlCommand() call doesn't work. I"m new to AutoIt, and there are a lot of API's to learn.The tutorials are woefully inadequit, and the helpfile is very misleading.there are a few small projects in the works to offer additional learning materials, but the helpfile really is awesome on it's own if you already know what you're trying to do. as far as why control command isn't working, the MOST likely cause is that you don't have quotes around the win title, after that, i'd go with plato on the possibility that they're not MS controls. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 30, 2005 Moderators Share Posted December 30, 2005 i think he must've had too much fun last nightMan only 3 - 22oz'ers ... I saw the word browser and missed the word 'file'. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
seandisanti Posted December 30, 2005 Share Posted December 30, 2005 Man only 3 - 22oz'ers you're a cheap date / lightweight eh? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 30, 2005 Moderators Share Posted December 30, 2005 lol@lightweight, well I really slowed down my drinking to once every 3 or 4 months now, from an 18 pack a night after work. So yeh, a $15 a night ritual, to a $6 take me home and take advantage of me date (god, they were never that cheap!!) ... not too bad Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
seandisanti Posted December 30, 2005 Share Posted December 30, 2005 lol@lightweight, well I really slowed down my drinking to once every 3 or 4 months now, from an 18 pack a night after work. So yeh, a $15 a night ritual, to a $6 take me home and take advantage of me date (god, they were never that cheap!!) ... not too bad way to put a silver lining on getting old! Link to comment Share on other sites More sharing options...
cappy2112 Posted December 31, 2005 Author Share Posted December 31, 2005 Are you sure that your "(Common Dialogue) File Browser" uses "standard Microsoft controls" or are you just experimenting in the hopes that they will work?From the help file under the topic "Controls":I have no idea if they are standard or not. It's not like applications come with this sort of information.I don't know if I'm doing something wrong, or if the controls are not standard. Link to comment Share on other sites More sharing options...
cappy2112 Posted December 31, 2005 Author Share Posted December 31, 2005 (edited) you'll have to forgive smoke, i think he must've had too much fun last night based on his posts this morning... but he really knows his stuff, i swear.there are a few small projects in the works to offer additional learning materials, but the helpfile really is awesome on it's own if you already know what you're trying to do. as far as why control command isn't working, the MOST likely cause is that you don't have quotes around the win title, after that, i'd go with plato on the possibility that they're not MS controls.In the example I posted, I accidentally put the window title Bank FIle, instead of the variable I used forthe Window title. What I posted is not the way my code looked when I posted the question :-)I was up until 2AM working on this :-) Edited December 31, 2005 by cappy2112 Link to comment Share on other sites More sharing options...
LxP Posted December 31, 2005 Share Posted December 31, 2005 These both work for me: Local $AllText = ControlGetText('Open', '', 'Edit1') Local $SelText = ControlCommand('Open', '', 'Edit1', 'GetSelected') MsgBox(0, '', $AllText & @LF & $SelText) Link to comment Share on other sites More sharing options...
cappy2112 Posted December 31, 2005 Author Share Posted December 31, 2005 first, i'd put "Bank File" in quotes, if that doesn't work you could try: ControlSend("Bank File","","Edit1","^c") $yourvaule = ClipGet() I think I had a race condition going on. I added a WinWiatActive() just before the SendCommand(), and now it works If Not WinActive($WindowTitleText,"") Then WinActivate($WindowTitleText,"") WinWaitActive($WindowTitleText,"") $SelectedPatchBankName = ControlCommand ( $WindowTitleText, '', 'Edit1', 'GetSelected' ) Your ClipGet() solution now also works. Before the WinWaitActive(), nothing worked. These are the kinds of things that drive me crazy- not knowing if I'm doing something wrong, not knowing if the problem is becuase the conrols are not Standard, or not knowing if I'm doing the right thing, but need a delay. Link to comment Share on other sites More sharing options...
LxP Posted December 31, 2005 Share Posted December 31, 2005 These are the kinds of things that drive me crazy- not knowing if I'm doing something wrong, not knowing if the problem is becuase the conrols are not Standard, or not knowing if I'm doing the right thing, but need a delay.The safest approach is to always assume that some form of delay is needed and use WinWait() etc.; this type of problem is then prevented. In my opinion it's also a good idea to assume that focus may not automatically be passed to a newly-created window, which is why I never use WinWaitActive() unless it immediately follows a WinActivate(). Programming in this way gives the advantage that you can set the WinWaitDelay to 0 and therefore increase the execution speed of your scripts. Also, this code: If Not WinActive($WindowTitleText,"") Then WinActivate($WindowTitleText,"") can be simplified to: WinActivate($WindowTitleText) since there is no harm in calling WinActivate() on an already-activated window. Link to comment Share on other sites More sharing options...
herewasplato Posted December 31, 2005 Share Posted December 31, 2005 Well I feel dumb - not asking "what code comes before". Silly me - I assumed that you were testing with a small test script like: manually bring up the window of interest run your one line of code and one msgbox........ glad that you got it workin' [size="1"][font="Arial"].[u].[/u][/font][/size] 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