Jump to content

Ping pausing script


Recommended Posts

Hi,

I am trying to implement a "network checker" into a script I have written, and I have the pinger set to be pretty much the first thing that happens, the problem is, if it doesn't get a reply, no matter if I have a timeout, the GUI will not initialize unless it gets a reply.

This is what I have:

$computername = EnvGet("computername")
$username = EnvGet("username")
$ipaddress = @IPAddress1
$var = Ping("google.com", 1200)
If $var Then
    $networkstatus = "Online!"
Else
    $networkstatus = "Network Error!"
EndIf

$Form1 = GUICreate("Thing", 323, 290, 229, 142)
$Pic1 = GUICtrlCreatePic("\\server\picture.jpg", 8, 8, 159, 74, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$computernamebox = GUICtrlCreateInput($computername, 96, 104, 217, 21)
$Label1 = GUICtrlCreateLabel("Computer Name:", 8, 104, 83, 17)
$Label2 = GUICtrlCreateLabel("User Name:", 32, 136, 60, 17)
$usernamebox = GUICtrlCreateInput($username, 96, 136, 217, 21)
$Label3 = GUICtrlCreateLabel("IP Address:", 32, 168, 58, 17)
$Input1 = GUICtrlCreateInput($ipaddress, 96, 168, 217, 21)
$Label4 = GUICtrlCreateLabel("Network Status:", 200, 32, 80, 17)
$Label5 = GUICtrlCreateLabel($networkstatus, 178, 48, 126, 31, $SS_CENTER)
Edited by heatsink
Link to comment
Share on other sites

Its simply AutoIt.

When you attempt to make a connection the timeout is VERY long regardless of what it is set to.

A bug in existence since forever.

Advice. Ping in another process and use comau3.au3 (copy-data inter-script communication) to emulate multi threading.

[center][/center][center]=][u][/u][/center][center][/center]

Link to comment
Share on other sites

Link to comment
Share on other sites

This thread has a solution to perform a threaded ping.

#766946

There is also a udf in my signature to allow repeated pings to various IPs in the background so your script is not slowed, with the option to have an icon for each address set according to the connected state. A user defined function can be called when the connected state of an IP changes.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...