Jump to content

Return From A Cmd-line To Autoit?


Dev
 Share

Recommended Posts

Okay, lets say I need a line to get amount of MS returned from this Batchline:

Ping 127.0.0.1

Anyone knows how the AutoIt-code would look like? (or someone who can tip me if it exists in the helpfile). :whistle:

Thanks.

oops! Next to forgot -> :iamstupid:

Ps. Maybe its time to start the "Dev's n00by Questions"-topic? hehe Ds.

Edited by Dev
Link to comment
Share on other sites

  • Developers

have a look at this one to start your script... http://www.hiddensoft.com/forum/index.php?...ic=1482&hl=ping

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

Okay... but if i need to check if i have an established (right spelled?) connection with Netstat -n, and i dont want it to return more than the adress.

If we say, that I make a function, CheckAddresViaPort($port), and if $port is 456, the function should return the ip adress connected to port 456, not the rest you get if you type "netstat -n | find "456" in CMDwin. Grr... I hate to be a n00b :postal:

:iamstupid:

EDIT:

Woho! At least the board says im not a Newbie anymore *points under his picture* :whistle:

Edited by Dev
Link to comment
Share on other sites

  • Developers

Don't worry ... we have all been there at some point in time... :whistle:

what about something like this?

RunWait(@comspec & " /c netstat -n >" & @tempdir &"\netstats.tmp","",@sw_hide)
$file = FileOpen(@tempdir &"\netstat.tmp", 0)
; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    if StringInstr($line,":456") > 0 then msgbox(0,'found port 456' , $line)
Wend
FileClose($file)
Edited by JdeB

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

Okay, Ill try it out, thanks for help :whistle:

EDIT: Tested

I dont get it to work, it allways generates the error "Cannot open file.", I dont know why (Ive changed port to a port I know a program is using).

Hope i dont need this soon --> :iamstupid:

Edited by Dev
Link to comment
Share on other sites

  • Developers

well thats because i made a typo..... :whistle:

First line says : \netstats.tmp

and fileopen: \netstat.tmp

Change the first line to:

RunWait(@comspec & " /c netstat -n >" & @tempdir &"\netstat.tmp","",@sw_hide)

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

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