Jump to content

adresse ip


jcaspar
 Share

Recommended Posts

:ph34r: 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 :lmao:

Jean Marc

Link to comment
Share on other sites

:ph34r: 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 :lmao:

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.

 

Link to comment
Share on other sites

  • Moderators

:ph34r: 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 :lmao:

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 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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

  • Moderators

did you mean above? it works on 3.2.1.8

I 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 :lmao:

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.

Link to comment
Share on other sites

@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 by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

  • Moderators

@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 :lmao: , I just went of Gary's example (kind of rubbing it in his face on how much efficient it was :ph34r: ), @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 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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...