krystian Posted March 12, 2006 Posted March 12, 2006 (edited) Hello, I have a need to send keys to a minimized window. How would I go about this? Send(..) sends keystrokes to active windows. I tried to: WinSetState($win_title, "", @SW_SHOWMINIMIZED) To "Activatate" the window (in a minimized state)... but that didn't get me anywhere. If AutoIt is not capable of this, what would be? I looked at KiXtart and it suffers from the same limitation. I guess there are technical limitations to this, which perhaps cannot be resolved or circumvented? Edited March 12, 2006 by krystian
cdkid Posted March 12, 2006 Posted March 12, 2006 Look a few pages back in V3 Support.. there's a topic of the same name by me, that has an answer. ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
death pax Posted March 12, 2006 Posted March 12, 2006 Perhaps you should tell us what you are trying to accomplish with this, sending keys to minimized windows isn't possible, but you can manipulate controls of minimized windows, look at Window management->Controls in the help file
cdkid Posted March 12, 2006 Posted March 12, 2006 (edited) http://www.autoitscript.com/forum/index.ph...topic=20925&hl= <---- Found the linkUses DllCall... someone posted in near the last post in UDF Form.~CDKID Edited March 12, 2006 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
krystian Posted March 12, 2006 Author Posted March 12, 2006 When I did a search through the forum before I posted, I searched "send keys minimized"... no wonder I didn't find anything useful. Should have done a "+send +keys +minimized" Sorry. But thanks!
herewasplato Posted March 12, 2006 Posted March 12, 2006 ...If AutoIt is not capable of this...Try running this sample:Run("notepad", "", @SW_MINIMIZE) WinWait("Untitled - Notepad") ControlSend("Untitled - Notepad", "", "Edit1", "Sending text to a minimized window.")It will "send" each letter one at a time. You can look up "Opt" in the help file to change the "send rate". You could also use ControlSetText which would be faster. An important note from the help file about "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! So... Experiment! Welcome to the forums [size="1"][font="Arial"].[u].[/u][/font][/size]
krystian Posted March 12, 2006 Author Posted March 12, 2006 (edited) Thanks for the post. Can you initiate the process required to update the Send Function page? I have the following suggestions: * The "Appendix" link doesn't work. (Take out the '\' right after the '..) * Also, a reference somewhere on the Send function page (probably in 'remarks') that to find information on sending keys to inactive windows or minimized windows, please look at ControlSend. -- I notice ControlSend is at the bottom of the page in the "Related" section, but a quick comment on where to go for inactive windows, etc somewhere in remarks may be useful. (As a user, I read the remarks part to get more information on the command) Edited March 12, 2006 by krystian
krystian Posted March 12, 2006 Author Posted March 12, 2006 (edited) Perhaps you should tell us what you are trying to accomplish with this, sending keys to minimized windows isn't possible, but you can manipulate controls of minimized windows, look at Window management->Controls in the help fileI'm sending the "F9" key to a minimized copy of outlook, to do a send and receive.Still tinkering around. They seem to use MS standard controls (I would think). Edited March 12, 2006 by krystian
Thatsgreat2345 Posted March 12, 2006 Posted March 12, 2006 Run("notepad", "", @SW_MINIMIZE) WinWait("Untitled - Notepad") ControlSend("Untitled - Notepad", "", "Edit1", "{f9}") something like that just change ur title of the window if u see u just add the {} to send a key and not just the keys i think it works
herewasplato Posted March 12, 2006 Posted March 12, 2006 (edited) ...They seem to use MS standard controls (I would think).yeah, one would think that they would be standard.... but you never know. The help file states for ControlSend:Success: Returns 1....so one line of code like thisMsgBox(0,"",ControlSend("Document1 - Microsoft Word", "", "_WwG1", "Sending text."))will let you see the success/failure of finding the control. Start a Word doc. Leave it in the background (not the active window, but not minimized) Run that one line of code. It writes the text. Remove the text from the doc Minimize the doc Run that one line of code. It does not write the text. ...but it found the control... There are so many other ways to try - take a look in the help file under index, controls. Edit: You can set outlook to send/receive every minute and you can send e-mail via AutoIt... why do you need to "F9" outlook via AutoIt? Edited March 12, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
krystian Posted March 12, 2006 Author Posted March 12, 2006 Look a few pages back in V3 Support.. there's a topic of the same name by me, that has an answer. ~cdkid Are you talking about this one in particular? http://www.autoitscript.com/forum/index.ph...ic=20925&st=15# I've poked around and tried sending F9 to multiple different controls in MS Outlook 2003. If anyone wants to participate: ControlSend($ol_title, "", 4704, "{F9}"); ControlSend($ol_title, "", "MsoCommandBar2", "{F9}"); ControlSend($ol_title, "", "Menu Bar", "{F9}"); ControlSend($ol_title, "", "SUPERGRID1", "{F9}");%TEA I've also did: WinMenuSelectItem($ol_title, "", "&Tools", "S&end/Receive", "&Send All") to no avail. Anyone done this in the past? I think I'll be fishing through DllCall land soon.
krystian Posted March 12, 2006 Author Posted March 12, 2006 Well, I couldn't figure a way to do sending commands to minimized outlook- but here's what I ended up with as a workaround, instead of fishing through DLL function calls. I set the outlook window to be transparent, then activate it, then send keys, then minimize, then make it opaque. WinSetTrans ($ol_title, "", 0) WinActivate($ol_title, "") Send("{F9}") WinSetState($ol_title, "", @SW_MINIMIZE);Hide it WinSetTrans ($ol_title, "", 255) I realize this is a thread hijack... can a mod move (or copy) this and some previous, relevant posts to a new thread?
krystian Posted March 13, 2006 Author Posted March 13, 2006 As I've recently found out, you can't send keys to locked computers. So the above only works if the computer is unlocked. At this moment, I am inexperianced with dlls in windows. How would I go about figuring out what function to call with the DllOpen command? On outlookcode.com people talk about constructing COM objects and macros which fulfill this task of doing send/receive. How would I be able to infer what function and dll file are used when this is done?
herewasplato Posted March 13, 2006 Posted March 13, 2006 (edited) ...you can't send keys to locked computers...Yes you can. I just did it. I used this one line of code.ControlSend("Untitled - Notepad", "", "Edit1", "Sending text." & @MIN & ":" & @SEC)Manually start Notepad. Minimize it if you wish. Create au3 file with that one line of code. Scheduled a (run once) task to run that script. Lock the computer. Twiddle thumbs for a minute plus. Unlock computer. Check results in Notepad window. You may not be able to use any Win...() functions in your script and a few other things - but it can be done. ...but you still have not answered why you cannot let OutLook send/rec on its own? ...why do you need AutoIt to schedule this task? Just wondering... Edited February 8, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
krystian Posted March 30, 2006 Author Posted March 30, 2006 (edited) Yes you can. I just did it. I used this one line of code.ControlSend("Untitled - Notepad", "", "Edit1", "Sending text." & @MIN & ":" & @SEC)Manually start Notepad. Minimize it if you wish. Create au3 file with that one line of code. Scheduled a (run once) task to run that script. Locked the computer. Twiddle thumbs for a minute plus. Unlock computer. Check results in Notepad window. You may not be able to use any Win...() functions in your script and a few other things - but it can be done. Hey, I just recently returned to this and I was able to get ControlSend to effect Send/Receive in Outlook! After sort of writing a COM object inspired by the link below, out of curiosity I came back to AutoIt3 to see if I could use the "Standard" commandBar (which I overlooked/didn't see before until now) http://www.outlookcode.com/threads.aspx?fo...messageid=16295 This idea was inspired by this line: Set oCB = _ oOutlookApplication.ActiveExplorer.CommandBars("Standard") So with some tweaking and experimentation, I found the following lines of code can emulate if you pushed F9 at the Outlook window: $ol_title = "- Microsoft Outlook" ControlSend($ol_title, "", "Standard", "{F9}") Thanks for your help! ...but you still have not answered why you cannot let OutLook send/rec on its own? ...why do you need AutoIt to schedule this task? Just wondering... I'm trying to see as a proof of concept whether I can externally send commands to Outlook widgets. Outlook can send/receive on it's own, I just want to dictate externally when to do so and have granularity to instruct outlook to do all sorts of things in the future starting from this. I don't want to switch between offline mode/online mode in Outlook (I don't use exchange), or permit outlook to do a send receive when I start outlook (because sometimes I want to load outlook and type up and send out emails before I get new ones). I also don't want outlook to check email every specified certain interval of time, unless I set it through the windows Scheduler. The reason being I can't configure within outlook to check email at say, 7 AM, 5 PM and 9 PM every day. Just an experiment I'm doing. It's tied in to looking at optimizing my use of my email client. Edited March 30, 2006 by krystian
herewasplato Posted March 30, 2006 Posted March 30, 2006 Thanks for the explanation... it helps. [size="1"][font="Arial"].[u].[/u][/font][/size]
krystian Posted March 30, 2006 Author Posted March 30, 2006 (edited) Thanks for the explanation... it helps. For anyone visiting, here's the final code that I settled with to do send and receive in outlook. ; Notes: ; 1. I couldn't send commands to Outlook when it was minimized, therefore, you'll see my transparency ; modification of the outlook window, so the user won't have to see Outlook load. ; 2. I use ControlSend(), because Send() doesn't work when the desktop is locked. ;Here's what this method does: ; If Outlook exists, do the following: ; - Set the transparency to 0, so that when I activate the window, nothing shows up ; - Activate outlook... nothing should show up ; - Send send/receive command. I used ControlSend, because I found this worked when the desktop was locked. ; - Hide the window, THEN do transparency modification, ; so that when you minimize, you don't see anything (the taskbar icon minimizing)... ; .. this way you adjust properties of outlook without having outlook flamboyantly open on your desktop. ; - Finally minimize outlook while it's hidden... therefore, no taskbar icon shows up minimizing outlook. WinWait($ol_title) WinSetTrans ($ol_title, "", 0) WinActivate($ol_title, "") ControlSend($ol_title, "", "Standard", "{F9}");Works when desktop is locked WinSetState($ol_title, "", @SW_HIDE);When you hide then minimize... you don't see the application minimize WinSetTrans ($ol_title, "", 255) WinSetState($ol_title, "", @SW_MINIMIZE) Edited March 30, 2006 by krystian
seandisanti Posted March 30, 2006 Posted March 30, 2006 I'm sending the "F9" key to a minimized copy of outlook, to do a send and receive.Still tinkering around. They seem to use MS standard controls (I would think).if you're using outlook, you can accomplish everythign you want with COM. i'll put somethign together real quick for you.
krystian Posted March 30, 2006 Author Posted March 30, 2006 if you're using outlook, you can accomplish everythign you want with COM. i'll put somethign together real quick for you.Thanks. =)I mainly built off the code offered at this site:http://www.outlookcode.com/threads.aspx?fo...messageid=16295I found a workaround to the problem of minimizing outlook. Though, thanks! I would love to review how you did the COM solution. I'm a novice to the VS.Net development platform so I figured out how to get started and found how to execute a button through the COM.But I wasn't able to figure out how to execute the "Send/Receive" button in outlook from another application alltogether. Jonatas 1
seandisanti Posted March 30, 2006 Posted March 30, 2006 Thanks. =)I mainly built off the code offered at this site:http://www.outlookcode.com/threads.aspx?fo...messageid=16295I found a workaround to the problem of minimizing outlook. Though, thanks! I would love to review how you did the COM solution. I'm a novice to the VS.Net development platform so I figured out how to get started and found how to execute a button through the COM.But I wasn't able to figure out how to execute the "Send/Receive" button in outlook from another application alltogether.sorry, today has kind of sucked for me and i never got around to writing the COM solution, still going to work on it before i take off for the day though
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