Jump to content

Ping not responding correct.


Ghost21
 Share

Recommended Posts

When I'm trying to ping a device in my script I keep getting a error code #4 from ping. Even though in dos it pings fine..

What would make the ping in the script stop working.. If I start a tottally new script it works fine..

Func _RA2011_UpdatedRecords()
_dbOpen()
$Recordset.Open("Needtoupdate", $Connection)
With $Recordset
  While Not .EOF
   $device = .Fields("Device").Value
   $var = Ping($device, 1500)
   If $var Then; also possible:  If @error = 0 Then ...
    MsgBox(0, "Status", "Online, roundtrip was:" & $var)
   Else
    MsgBox(0, "Status", "An error occured with number: " & @error)
   EndIf
   MsgBox(0, "info", "Device: " & $device & " IP: " & $IP & " Ping: " & $var)
   _update_devices($Founddomain, $device, $Ping)
   If WinActive("RA2012  'Remotely Assited'", "") Then
    GUICtrlSetData($Edit, "Activity found on pc. Stopping update." & @CRLF, 1)
    ExitLoop
   EndIf
   .MoveNext
  WEnd
EndWith
EndFunc   ;==>_RA2011_UpdatedRecords

This is so freaking simple what in Autoit would cause it to stop. If I use the $device that comes back from a query it returns the device name perfect and sets it as $device which works. But if I use

that in the PING line it doesn't... If I don't use the $device at all or any other variable in there and just type it in like "pc001" then ping works again ???? WTF?

HELP PLEASE!!!

Link to comment
Share on other sites

I’ll bet it’s a nonprintable character related problem. Try to strip some basic nonprintable characters from the $device variable using the following code

$device=StringStripWS($device,15)

[s][font="Impact"]░▒▓▓►DrKovra◄▓▓▒░[/font][/s]The only thing I [sup]know [/sup]is that I don't know [sub]nothing[/sub]--------------- __________------------------------------ __________---------------

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