chad.stout Posted August 23, 2006 Posted August 23, 2006 Hey there, I've written a script I use at work all day long to do a bunch of data entry - which works great. However I am now just basically sitting at my desk waiting for the script to finish each time I run it, and would prefer to be able to do other work on my PC. The problem is of course the window must have focus in order for the send to work. Is there a way to send keys without having to keep the focus on the window itself? Also a small peice of relevant information is the window I am sending all this data to is a DOS program, but I don't know if that helps at all. Cheers! -Chad Stout
BigDod Posted August 23, 2006 Posted August 23, 2006 You could try using StdInWrite, may work. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
Paulie Posted August 23, 2006 Posted August 23, 2006 BigDod said: You could try using StdInWrite, may work.what about ControlSend?
Xenobiologist Posted August 23, 2006 Posted August 23, 2006 BigDod said: You could try using StdInWrite, may work.Hi, ormaybe ControlSend() if you know the title of the window. I guess, getting ControlId could be a bit specific.So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
BigDod Posted August 23, 2006 Posted August 23, 2006 th.meger said: Hi, ormaybe ControlSend() if you know the title of the window. I guess, getting ControlId could be a bit specific.So long,MegaI do not think that a dos window has a ControlId to send anything to. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
Xenobiologist Posted August 23, 2006 Posted August 23, 2006 BigDod said: I do not think that a dos window has a ControlId to send anything to. Hi, I know as I mentioned above, but this should to the trick. ControlSend("C:\WINNT\System32\cmd.exe", "", "", "Hello") So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
herewasplato Posted August 23, 2006 Posted August 23, 2006 (edited) chad.stout said: ......is a DOS program...May not be a DOS window.Edit: I use ControlSend with several DOS programs... Edited August 23, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
chad.stout Posted August 23, 2006 Author Posted August 23, 2006 th.meger said: Hi, ormaybe ControlSend() if you know the title of the window. I guess, getting ControlId could be a bit specific.So long,MegaThe problem with ControlSend() is simpley that there is no control! It is a DOS prompt (more specifically - an emulated prompt seeing as it's an XP machine).I'm not familar with StdInWrite... I'll have to look into that one.Thanks!-ChadBTW... wow - I'm impressed how fast this thing got responded to!
Paulie Posted August 23, 2006 Posted August 23, 2006 herewasplato said: May not be a DOS window. Edit: I use ControlSend with several DOS programs...can't you use run to run commands from a dos window? Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE)
herewasplato Posted August 23, 2006 Posted August 23, 2006 (edited) th.meger said: Hi, I know as I mentioned above, but this should to the trick. ControlSend("C:\WINNT\System32\cmd.exe", "", "", "Hello") oÝ÷ Ù*%¢xz¿ªê-xíz·¬¶)àêÞÆÙ¨ç(uëh¦º/{*.®"Ö®¶se'VâgV÷C´3¢b3#µtäDõu2b3#·77FVÓ3"b3#¶6ÖBæWRgV÷C²¥våvBgV÷C´3¢b3#µtäDõu2b3#·77FVÓ3"b3#¶6ÖBæWRgV÷C²¥'VâgV÷C¶æ÷FWBgV÷C²¥våvBgV÷CµVçFFÆVBÒæ÷FWBgV÷C²¥vä7FfFRgV÷CµVçFFÆVBÒæ÷FWBgV÷C²¥våvD7FfRgV÷CµVçFFÆVBÒæ÷FWBgV÷C²¤6öçG&öÅ6VæBgV÷C´3¢b3#µtäDõu2b3#·77FVÓ3"b3#¶6ÖBæWRgV÷C²ÂgV÷C²gV÷C²ÂgV÷C²gV÷C²ÂgV÷C´VÆÆògV÷C²Edit: It does indeed send to a window not in focus. Edited August 23, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
chad.stout Posted August 23, 2006 Author Posted August 23, 2006 (edited) Paulie said: can't you use run to run commands from a dos window? Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE) It's not a command line program, it's a command prompt - slight difference there EDIT: Also I tried the ControlSend("blahblah/cmd.exe","","","text") It works, but only when it has focus. Edited August 23, 2006 by chad.stout
Paulie Posted August 23, 2006 Posted August 23, 2006 chad.stout said: It's not a command line program, it's a command prompt - slight difference there Ahhh... Sorry :">
herewasplato Posted August 23, 2006 Posted August 23, 2006 (edited) chad.stout said: It's not a command line program, it's a command prompt - slight difference there So it is in a DOS window and not just a DOS program... then try the code that I posted via th.meger's suggestion.Edit1: ...but the STD IN/OUT is the way to go - if it works for the app in question.Edit2: as you can see from this posthttp://www.autoitscript.com/forum/index.ph...mp;#entry173643some apps are just too wierd to work with the STD IN/OUT method. Edited August 23, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
chad.stout Posted August 23, 2006 Author Posted August 23, 2006 herewasplato said: So it is in a DOS window and not just a DOS program... then try the code that I posted via th.meger's suggestion.Edit1: ...but the STD IN/OUT is the way to go - if it works for the app in question.Edit2: as you can see from this posthttp://www.autoitscript.com/forum/index.ph...mp;#entry173643some apps are just too wierd to work with the STD IN/OUT method.I'm guessing STD In/Out isn't going to work for my problem, as it's a secured connection started by running an ActiveX control from a website to launch the DOS application - there really is no way for me to manually open the program and bypass the website.Thanks for the help anyways!-Chad
vim Posted August 23, 2006 Posted August 23, 2006 chad.stout said: I'm guessing STD In/Out isn't going to work for my problem, as it's a secured connection started by running an ActiveX control from a website to launch the DOS application - there really is no way for me to manually open the program and bypass the website.Thanks for the help anyways!-ChadSince its a website your talking about, you might want to look at some IE.au3 functions to see if that can solve your problem. Also, can you supply some code so we can see how this all gets started?ViM
chad.stout Posted August 23, 2006 Author Posted August 23, 2006 (edited) vim said: Since its a website your talking about, you might want to look at some IE.au3 functions to see if that can solve your problem. Also, can you supply some code so we can see how this all gets started?ViMAt the moment I manually start everything, but I'll check into the IE.au3 (I assume it must be used in conjunction with the latests Beta release?)Anyways, here's my current script (I've been hacking this thing together over the last couple of weeks, so it's not all that pretty )Discover_Re.au3 Edited August 23, 2006 by chad.stout
MHz Posted August 23, 2006 Posted August 23, 2006 Wow, alot of Sends that you do. Some tips are in the helpfile for optimizing Sends. For example, your method Send('{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}')
bluebearr Posted August 23, 2006 Posted August 23, 2006 Yeah, I know you didn't ask about this, but I would probably replace statements like this:Case $formattedState = "al" Or $formattedState = "az" Or $formattedState = "ca" Or _ $formattedState = "co" Or $formattedState = "ct" Or $formattedState = "de" Or _ $formattedState = "fl" Or $formattedState = "ia" Or $formattedState = "ks" Or _ $formattedState = "la" Or $formattedState = "mi" Or $formattedState = "mo" Or _ $formattedState = "nj" Or $formattedState = "nm" Or $formattedState = "nd" Or _ $formattedState = "oh" Or $formattedState = "or" Or $formattedState = "sd" Or _ $formattedState = "tx" Or $formattedState = "ut" Or $formattedState = "wa" Or _ $formattedState = "wa"oÝ÷ ÛØb±«¢+Ù ÍMÑÉ¥¹%¹MÑÈ ÅÕ½Ðí°±è±±¼±Ð±±°±¥±Ì±±±µ¤±µ¼±¹¨±µ¸±¹±½ ±½È±Í±Ñà±ÕбÝÅÕ½Ðì°ÀÌØí½ÉµÑÑMÑÑwhich works if you are sure that you will never get a comma in $formattedState.I like the way your columns line up for a lot of stuff, though. BlueBearrOddly enough, this is what I do for fun.
chad.stout Posted August 23, 2006 Author Posted August 23, 2006 Thanks for those tips - I do need to optimize this script (which really is just 2000 lines of sends ) I am learning AutoIt as I build this project, so yea.. some of it is not going to be very elegant Thanks, -Chad
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