lod3n Posted August 25, 2006 Share Posted August 25, 2006 Oh, but you can. In fact, it's insanely simple. First, write and compile your stdouttest.au3: consolewrite("Hello from AutoIt!")oÝ÷ Ø×±¶f¤y©b¶Ù^m«ø¥zV®È^ú+Ê«±Êâ¦Ûa¢è!)¶¬r^r¬¥ç? Ë]¢ëmzË^ÅçâßÕßø¥«¬{÷(uê+ü¨»§¶Ú,yëaz¦ë[yú+{*.r©W£ºË]¢+eG+¡×¢k)yÏÂß¹óOv>º ©W¬Óݺڷ}=Ù·kOvjëhÝÞÅíø²×hºÛ^²Ö®Ýø§wõwã~)jëýÊyhZ·l§áz·zYpéò¢êî*.Ê&¦)^tL^¢°.¶Ýì^o,ÊÝ¢æåyÉbrH§Ú«·~)^Êë¬xwhÃl ·µãë¡Ç¬³brÞr'7¬ëh"ÝÞÅæ§u©òr©Wëh"Úk¢ Ú«ih§v,B¦bq«b¢Ûz÷§ü¨¹Ú'ßÛn±ëaxe~éܶ*'²Ê"µ§-÷¥ÉجrçyËl~º&¶L3M·jëì°,(ºWr¢ìÛh¸zÚ-ç(Ê%z'í+"²}ýµ ÎIªi®(!´Â§Ê«º{(ëax0Ømà¨f§tízºkz׫rg^Åèv¬mz0rì¢W¦bq«b¢{®°whÂÆ©¦XjبÇë¢g!É Ú¿&§v¬uç_y«në0'!Ê'½éâz{eËøº¹è}ôå~ò¢àn¶»§)àÜ"¶&uì^É÷öק¢è!jÆ¥*.ßÚÞv§+%zÛbay$Ã9D쵬+ÞI0ÎQ;-Ygyçl²¶§Ú¢Ø^Âä¡ö¶æ¥+h¸x"¶¶ayÊ'²^jwm«wöÌ!z· ÐÿV«¨¶«¨µÊ&zȧZ¶¬Â+ëºÇv¬yÈhm§$j|)àr¢§¶H4=ý±$à Ûaj×hzÉèµÊ'µ¨§ªê-ªê-Â)yû¥(¬z÷«ÊØbxky©eÊ+-«^jÌ~ÞÁêÞ²§rX§yÛa{'(ºW`zШÊ%yjâµé²Æ zÆÚrGë¢g!WZºÚ"µì^²»§¶¬Á¬ºÚ"µÍÚ[ÛYH ÐÛÛÝ[Ë]LÉÝÂÌÍÙÛÈH[ÛÛTÜXÈ [È ÌÎNÈØÈÝÝ]Ý^H[Õ ][ÝÉ][ÝÉÌÎNËØÜÕ×ÒQK ÌÍÔÕÕUÐÒS BÌÍÛÝ]]H ][ÝÉ][ÝÂÚ[HB ÌÍÛÝ]] [ÏHÝÝ]XY ÌÍÙÛÊBYÜ[^]ÛÜÙ[ÙØÞ ][ÝÑÛÝÈÛHÚ[ULÈ^I][ÝË ÌÍÛÝ]] [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Valik Posted August 25, 2006 Share Posted August 25, 2006 If you read it wasn't possible, you didn't fully read what you read. See here. Link to comment Share on other sites More sharing options...
lod3n Posted August 25, 2006 Author Share Posted August 25, 2006 (edited) Actually, I did see that, but I decided to just address and take advantage of what's actually happening instead of muck about in the binaries of my programs. My way seems a little safer and easier, and it took me about 2 minutes to develop a working model. However, your way is much more interesting! Kudos on that work! Edit: Oops! I see now that it wasn't you that wrote the one that messes with the binary, you wrote Stub.exe, which is pretty awesome. Still, I like my method a lot because I can do it in pure AutoIt, and with ConsoleRead on the child process, I can even have two way communication, again in pure AutoIt. Edited August 25, 2006 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
theguy0000 Posted August 25, 2006 Share Posted August 25, 2006 is there some way to use @pause without it saying "press any key to continue"? The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
vim Posted August 26, 2006 Share Posted August 26, 2006 (edited) If you read it wasn't possible, you didn't fully read what you read. See here.That's some very interesting reading. I was suprised that someone went to all that trouble to hack AutoIt or knew where to do the hack. I could foresee all kinds of problems if his hack code was used extenstively and the support or lack thereof. That "stub coding" of your was very impressive.ViM Edited August 26, 2006 by vim Link to comment Share on other sites More sharing options...
Valik Posted August 26, 2006 Share Posted August 26, 2006 You're talking about two different things. Inter-process communication using std handles, ironically enough, was suggested by me to DaveF. That is a different concept than communicating with a console window. It also does not require reflecting the stream data through the command interpreter at all since both processes have read or write handles to the communication stream.To communicate with a console, you're not going to be "pure AutoIt" unless you hack the binary. You're just using a feature of the command interpreter and find.exe to direct the stdout stream of a GUI-subsystem application to the console. The stub I wrote reflects all 3 std streams so that the GUI-subsystem application looks and behaves just like a console application. Your solution is very limited in what it can do. My solution is only limited if you try to access the framebuffer of the console directly, which isn't supported.I would argue that stub.exe is a better choice because:It eliminates a lot of overhead involved with piping the data into find.exe.It eliminates the overhead of find.exe searching the data for an empty string.It redirects all streams, not just the output stream. Link to comment Share on other sites More sharing options...
theguy0000 Posted August 26, 2006 Share Posted August 26, 2006 (edited) based on your method (well actually it is exactly your method but automated) Func _consolewrite($text) $file1 = FileOpen ("C:\console.au3", 2) FileWrite ($file1, 'consolewrite("'&$text&'")') FileClose ($file1) $file2 = FileOpen ("C:\console.bat", 2) FileWrite ($file2, '@ %comspec% /C "C:\Program Files\AutoIt3\autoit3.exe" C:\console.au3 | find /V ""'&@CRLF) FileWrite ($file2, "@ pause > nul") FileClose ($file2) Run ("C:\console.bat") EndFunc Edited November 7, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Valik Posted August 26, 2006 Share Posted August 26, 2006 (edited) Your solution is very limited in what it can do. My solution is only limited if you try to access the framebuffer of the console directly, which isn't supported.I stand corrected. I've just done some experimenting and with a single line of code (that is not requried in a true console application), all the Console functions defined by the Windows API become available for a GUI application to use on Stub.exe's console window. Simply using DllCall() to call "AttachConsoel(-1)" will associated the AutoIt script with Stub.exe's console window. Then all calls to WriteOutput or any other console related Windows API function will work correctly. I've just successfully written red text to a console window reflected by Stub.exe from a non-compiled AutoIt script.I also found a bug in Stub.exe. Maybe someday if I'm bored and remember, I'll fix Stub.exe, put together a couple examples and upload it all to it's own thread. The moral of the story is Stub.exe is more powerful than I ever imagined and is the perfect tool for reflecting std stream data from a console to/from a GUI-subsystem application.Edit: Just a small hint. After calling AttachConsole(), the AutoIt script has to open the screen buffer by calling CreateFile() directly (via DllCall()). You need the actual handle returned by CreateFile() and not the pseudo-handle AutoIt returns. Edited August 26, 2006 by Valik Link to comment Share on other sites More sharing options...
lod3n Posted August 29, 2006 Author Share Posted August 29, 2006 I've been playing around with stub.exe and it is indeed pretty heavy duty. I look forward to any forthcoming versions... [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
bluesxman Posted September 23, 2006 Share Posted September 23, 2006 is there some way to use @pause without it saying "press any key to continue"?Yeah, like this: @pause > nul ~bxm Link to comment Share on other sites More sharing options...
archjonesy Posted November 6, 2006 Share Posted November 6, 2006 Is it possible to use stub.exe to allow autoit to interface with console applications? If so how? I'd like to use autoit to interface with different console apps, but the only thing I can come up with is blind writing to the console and hope it doesn't take longer than the sleep I put in... there HAS to be a better way. Thanks! Link to comment Share on other sites More sharing options...
M4M Posted November 7, 2006 Share Posted November 7, 2006 Yeah, like this: @pause > nul ~bxm when you do that, doesnt it create a file called "nul" with the text "press any key to continue" in it? a simple fix for then would be to just add: del nul Link to comment Share on other sites More sharing options...
Valik Posted November 7, 2006 Share Posted November 7, 2006 "NUL" is the Windows equivalent of /dev/null. It just discards whatever you pipe into it. Link to comment Share on other sites More sharing options...
orip Posted April 13, 2008 Share Posted April 13, 2008 Thanks, that's very helpful!!I made the following generic batch file wrapper 'autoit_console.bat':@echo off rem workaround to make AutoIt executables "consoleable" rem From http://www.autoitscript.com/forum/index.php?showtopic=31607 %COMSPEC% /c %* | find /V ""I use it like this:autoit_console.bat ...\my_compiled_autoit_script.exe [params] Link to comment Share on other sites More sharing options...
Developers Jos Posted April 13, 2008 Developers Share Posted April 13, 2008 You could also use the new option available in the aut2exe or AutoIt3Wrapper: #AutoIt3Wrapper_Change2CUI=y SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
JRSmile Posted April 13, 2008 Share Posted April 13, 2008 Just use this: CLICK HERE $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) 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