Sign in to follow this  
Followers 0
jcaspar

adresse ip

12 posts in this topic

: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

Share this post


Link to post
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.

 

Share this post


Link to post
Share on other sites

MsgBox(0, "@IPAddress1", @IPAddress1)


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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

: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

[center]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.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by herewasplato

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

Share this post


Link to post
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.

 

Share this post


Link to post
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)

[center]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.[/center]

Share this post


Link to post
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.

 

Share this post


Link to post
Share on other sites

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:

[center]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.[/center]

Share this post


Link to post
Share on other sites

#10 ·  Posted (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 by herewasplato

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

Share this post


Link to post
Share on other sites

#11 ·  Posted (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 :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

[center]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.[/center]

Share this post


Link to post
Share on other sites

...Why was I pointed out specficially :lmao: ...

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]

Share this post


Link to post
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
Sign in to follow this  
Followers 0