jcaspar Posted October 10, 2006 Posted October 10, 2006 Hello ! I'm trying to do a little script autoit that recover the ip adress from a computer Wininwait("cmd /c ipconfig > c:\afficheip.txt") but doesn't create the file ...do you have an idea to resolve my problem ? Thanks a lot for your advices and tricks Jean Marc
GaryFrost Posted October 10, 2006 Posted October 10, 2006 Hello !I'm trying to do a little script autoit that recover the ip adress from a computerWininwait("cmd /c ipconfig > c:\afficheip.txt")but doesn't create the file ...do you have an idea to resolve my problem ?Thanks a lot for your advices and tricks Jean Marc Try Run or RunWait SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
herewasplato Posted October 10, 2006 Posted October 10, 2006 MsgBox(0, "@IPAddress1", @IPAddress1) [size="1"][font="Arial"].[u].[/u][/font][/size]
Moderators SmOke_N Posted October 10, 2006 Moderators Posted October 10, 2006 (edited) Hello ! I'm trying to do a little script autoit that recover the ip adress from a computer Wininwait("cmd /c ipconfig > c:\afficheip.txt") but doesn't create the file ...do you have an idea to resolve my problem ? Thanks a lot for your advices and tricks Jean Marc$FileToWriteTo = @DesktopDir & "\afficheip.txt" Run(@ComSpec & ' /c ipconfig > "' & $FileToWriteTo & '"', '', @SW_HIDE)oÝ÷ ØGb´êí¢ÇêÞÁ«)«hßÛ,º²Ø¨©Ý¶¨ì¨»§µçZºÚ"µÍÌÍÑ[UÕÜ]UÈHÚÝÜ [È ][ÝÉÌLØYXÚZ ][ÝÂ[ØZ] ÛÛTÜXÈ [È ÌÎNÈØÈÛÛYÈ ÝÈ ][ÝÉÌÎNÈ [È ÌÍÑ[UÕÜ]UÈ [È ÌÎNÉ][ÝÉÌÎNË ÌÎNÉÌÎNËÕ×ÒQJB[UÜ]J ÌÍÑ[UÕÜ]UËÔ [ÈÔ [ÈTYÜÌH [ÈÔ [ÈTYÜÌ [ÈÔ [ÈTYÜÌÈ [ÈÔ [ÈTYÜÍ Edited October 10, 2006 by SmOke_N 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.
herewasplato Posted October 10, 2006 Posted October 10, 2006 (edited) or just:Run("cmd /c ipconfig > c:\temp\afficheip.txt")edit:...just showning gafrost's suggestion to the OP's original code. @jcaspar, more help than you ever wanted :-) Edited October 10, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
GaryFrost Posted October 10, 2006 Posted October 10, 2006 Or Skip the file #include <Constants.au3> $foo = Run(@ComSpec & " /c ipconfig", @SystemDir, @SW_HIDE, $STDOUT_CHILD) $lines = "" While 1 $line = StdoutRead($foo) If @error Then ExitLoop $lines &= $line Wend $lines = StringSplit($lines,@CRLF,1) For $x = 1 To $lines[0] If StringInStr($lines[$x], "IP Address") Then $lines = StringMid($lines[$x],StringInStr($lines[$x],":") + 2) ExitLoop EndIf Next MsgBox(0,"IP Address", $lines) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Moderators SmOke_N Posted October 10, 2006 Moderators Posted October 10, 2006 Or Skip the file #include <Constants.au3> $foo = Run(@ComSpec & " /c ipconfig", @SystemDir, @SW_HIDE, $STDOUT_CHILD) $lines = "" While 1 $line = StdoutRead($foo) If @error Then ExitLoop $lines &= $line Wend $lines = StringSplit($lines,@CRLF,1) For $x = 1 To $lines[0] If StringInStr($lines[$x], "IP Address") Then $lines = StringMid($lines[$x],StringInStr($lines[$x],":") + 2) ExitLoop EndIf Next MsgBox(0,"IP Address", $lines) 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.
GaryFrost Posted October 10, 2006 Posted October 10, 2006 Or with Beta 3.2.1.5 or below:#include <array.au3> $foo = Run(@ComSpec & " /c ipconfig", @SystemDir, @SW_HIDE, 6) $identifier = "IP Address. . . . . . . . . . . . : " $ip = StringRegExp(StdoutRead($foo), '(?i:' & $identifier & ')(.*?)(?i:\n)', 3) _ArrayDisplay($ip, "IP's") did you mean above? it works on 3.2.1.8 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Moderators SmOke_N Posted October 10, 2006 Moderators Posted October 10, 2006 did you mean above? it works on 3.2.1.8I wasn't sure if it would, I only have 3.2.1.5 because of the changes to StringRegExp() I wasn't sure if it would change the structure I know. And I don't feel like changing everything I'm working on at the moment (until I can at least finish 1 thing) to change all my SRE's to the correct syntax. But thanks, that means _SRE_Between() won't be broke 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.
herewasplato Posted October 10, 2006 Posted October 10, 2006 (edited) @SmOke_N,$identifier = "IP Address. . . . . . . . . . . . : "Guessing from c:\afficheip.txt and the name of "Jean Marc", the OS may not be of the English persuasion....just a thought...Edit: I know that the OP can change the text - I was just recalling where we went thru this in another thread. The feedback that we got was that the scripts that we posted would not work - then we were blessed with the knowledge that the OS was not in English. I could not locate the thread for reference - maybe I dreamed it. Edited October 10, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
Moderators SmOke_N Posted October 10, 2006 Moderators Posted October 10, 2006 (edited) @SmOke_N, $identifier = "IP Address. . . . . . . . . . . . : " Guessing from c:\afficheip.txt and the name of "Jean Marc", the OS may not be of the English persuasion. ...just a thought...Why was I pointed out specficially , I just went of Gary's example (kind of rubbing it in his face on how much efficient it was ), @IPAddress[n] was the better choice of all of them IMHO anyway. Edit: Replaced a word that I know he (Gary) would take out of context! Edited October 10, 2006 by SmOke_N 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.
herewasplato Posted October 10, 2006 Posted October 10, 2006 ...Why was I pointed out specficially ...See my edit - I think that you and I were in that old thread some time back... but again, maybe I'm just senile today. [size="1"][font="Arial"].[u].[/u][/font][/size]
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