boomingranny Posted October 25, 2008 Share Posted October 25, 2008 Hi, I have spent the last 5 hours trying to make this script read the text from this Microsoft console app called "dhcploc.exe" (it searches for DHCP servers running on your network) My current conclusion is, that there are just some programs that, alhough they output to the console window you cannot send text/recieve text via StdinWrite/StdoutRead What dhcploc does, when your press d is it sends a dhcp request to your network, it then displays any dhcp servers running on your network... so in my code i am running it, trying to send d, then read the reply (please don't suggest i just use send(), that isn't an option here) The code i currently have is as follows: DirCreate ("tools");just incase FileInstall ("dhcploc.exe",@ScriptDir&"\tools\dhcploc.exe") ProcessClose ("dhcploc.exe") $dhcploc = Run(@ScriptDir&"\tools\dhcploc.exe "&@ComputerName ,"",@SW_SHOW,9) Sleep (500) $data = "" StdinWrite($dhcploc, "d"&@CRLF) StdinWrite ($dhcploc,"") While $dhcploc $tmp = StdoutRead($dhcploc) $data &= $tmp ConsoleWrite ($tmp) Sleep (25) WEnd Thanks for taking the time to help dhcploc.exe Link to comment Share on other sites More sharing options...
martin Posted October 25, 2008 Share Posted October 25, 2008 Hi, I have spent the last 5 hours trying to make this script read the text from this Microsoft console app called "dhcploc.exe" (it searches for DHCP servers running on your network) My current conclusion is, that there are just some programs that, alhough they output to the console window you cannot send text/recieve text via StdinWrite/StdoutRead What dhcploc does, when your press d is it sends a dhcp request to your network, it then displays any dhcp servers running on your network... so in my code i am running it, trying to send d, then read the reply (please don't suggest i just use send(), that isn't an option here) The code i currently have is as follows: DirCreate ("tools");just incase FileInstall ("dhcploc.exe",@ScriptDir&"\tools\dhcploc.exe") ProcessClose ("dhcploc.exe") $dhcploc = Run(@ScriptDir&"\tools\dhcploc.exe "&@ComputerName ,"",@SW_SHOW,9) Sleep (500) $data = "" StdinWrite($dhcploc, "d"&@CRLF) StdinWrite ($dhcploc,"") While $dhcploc $tmp = StdoutRead($dhcploc) $data &= $tmp ConsoleWrite ($tmp) Sleep (25) WEnd Thanks for taking the time to help Instead of StdinWrite ($dhcploc,"") try StdinWrite ($dhcploc) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
boomingranny Posted October 26, 2008 Author Share Posted October 26, 2008 (edited) Hi, With the code below i can recieving the responce (stdoutread) but i am having to manually send d and q, so the stdinwrite command isn't linking up for some reason DirCreate ("tools") FileInstall ("dhcploc.exe",@ScriptDir&"\tools\dhcploc.exe") ProcessClose ("dhcploc.exe") $dhcploc = Run(@ScriptDir&"\tools\dhcploc.exe "&@ComputerName ,"",@SW_SHOW,9) $data = "" StdinWrite($dhcploc, "d") StdinWrite($dhcploc, "q") StdinWrite($dhcploc) ;10 second timeout for $i = 1 to 10 if not ProcessExists ("dhcploc.exe") then ExitLoop Sleep (1000) next ProcessClose ("dhcploc.exe") While 1 $tmp = StdoutRead($dhcploc) if @error then ExitLoop $data &= $tmp ConsoleWrite ($tmp) Sleep (25) WEnd i have also tried control send but that didn't work either Edited October 26, 2008 by boomingranny Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 27, 2008 Share Posted October 27, 2008 With the code below i can recieving the responce (stdoutread) but i am having to manually send d and q, so the stdinwrite command isn't linking up for some reason StdinWrite($dhcploc, "d") StdinWrite($dhcploc, "q") StdinWrite($dhcploc) i have also tried control send but that didn't work either StdInWrite() will not input anything to a command line shell. You can't automate a "DOS Box" this way with AutoIt. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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