Page 2 of 2 <12
Topic Options
#155094 - 2006-01-12 08:22 AM Re: Loop ping ?
Pookie62 Offline
Fresh Scripter

Registered: 2003-10-09
Posts: 37
Loc: Netherlands
Jooel, still got a minor issue..
Checkboxes aren't checked when machine is on..
Any idea why not ?

Radimus: thanks for your script too !
Really appreciate the support and time you spend, both of you !!

Top
#155095 - 2006-01-12 03:55 PM Re: Loop ping ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
not checked?
the issue is around here:
Code:

If Ping($system.tag)
$system.Checked = "True"
Else
$system.Checked = "False"
EndIf



so, lets make debug code:
Code:

"Pinging: " $system.tag ?
If Ping($system.tag)
"Response" ?
$system.Checked = "True"
Else
"system is offline" ?
$system.Checked = "False"
EndIf



if the correct text is coming out, the issue is of kixforms nature.
if wrong response, there is something wrong either with the tagged name or the ping() udf.
_________________________
!

download KiXnet

Top
#155096 - 2006-01-12 09:53 PM Re: Loop ping ?
Pookie62 Offline
Fresh Scripter

Registered: 2003-10-09
Posts: 37
Loc: Netherlands
Hi Jooel,
Something in the loop or Foreach must be wrong..
It's only pinging ( and looping the ping) the last defined MakeKamer(...etc

Top
#155097 - 2006-01-12 10:28 PM Re: Loop ping ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
change the:
global $_pingers

to:
global $_pingers[]
_________________________
!

download KiXnet

Top
#155098 - 2006-01-12 10:31 PM Re: Loop ping ?
Pookie62 Offline
Fresh Scripter

Registered: 2003-10-09
Posts: 37
Loc: Netherlands
Sorry no difference.. I defined same comp twice for testing > only the last one is checked
Top
#155099 - 2006-01-12 10:37 PM Re: Loop ping ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja.
I went testing and found out the same.

me silly didn't test this before.
my redim line lacked the preserve keyword

redim preserve $_pingers[ubound($_pingers)+1]
_________________________
!

download KiXnet

Top
#155100 - 2006-01-12 10:46 PM Re: Loop ping ?
Pookie62 Offline
Fresh Scripter

Registered: 2003-10-09
Posts: 37
Loc: Netherlands
:-)
Still many many thanks !!! Working perfectly now !
Last question(promise..lol)
I created a button to quit the form, but when I hit before the pings start, it quitting rightaway, when the pinging has started, it takes half a minute before the forms closes.. Any specific reason why ?
code:
$ButtQuit = $Form.Controls.Button()
$ButtQuit.Anchor = 10
$ButtQuit.Default = "True"
$ButtQuit.FontSize = 8,25
$ButtQuit.Height = 23
$ButtQuit.Left = 210
$ButtQuit.Text = "Nokken"
$ButtQuit.Top = 240
$ButtQuit.Width = 75
$ButtQuit.OnClick = "quit"

Top
#155101 - 2006-01-13 05:59 AM Re: Loop ping ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
sure, you are pinging something like 10 machines.
if they all fail the ping, it takes some time...
oh...
and some new pings are already added to the queye.
add this line to the start of pingEmAll() UDF:
$Timer.onTimer = ''

and then to the end of it:
$Timer.onTimer = 'PingEmAll()'
_________________________
!

download KiXnet

Top
#155102 - 2006-01-13 09:11 AM Re: Loop ping ?
Pookie62 Offline
Fresh Scripter

Registered: 2003-10-09
Posts: 37
Loc: Netherlands
Thanks again Jooel !
Top
#155103 - 2006-01-15 02:57 PM Re: Loop ping ?
bofh71 Offline
Fresh Scripter

Registered: 2005-09-26
Posts: 11
Loc: Denmark
Pookie62
is there any chance that you will post the entire script with all the corrections made ??

Thanks
Jan V.

Top
#155104 - 2006-01-16 01:21 PM Re: Loop ping ?
Pookie62 Offline
Fresh Scripter

Registered: 2003-10-09
Posts: 37
Loc: Netherlands
Sure Jan, no prob

Code:
Break On
$Op=SetOption('NoVarsInStrings','On')
$System = CreateObject("Kixtart.System")

;KD START

$Form = $System.Form()
$Form.BackColor = 128,255,255
$Form.FontSize = 8,25
$Form.Height = 585
$Form.Left = 90
$Form.Text = "Kandidaten PC's"
$Form.Top = 12
$Form.Width = 354

global $_pingers
MakeKamer('NL-KDKF7PK',"Kamer 1 (203)",'SHELL "\\Path-to-wol.exe (Wake on Lan"')
MakeKamer('NL-TKDBYB1L',"Kamer 2 (204)",'SHELL "\\Path-to-wol.exe (Wake on Lan"')
MakeKamer('NL-TKDBYA7P',"Kamer 3 (205)",'SHELL "\\Path-to-wol.exe (Wake on Lan"')
MakeKamer('NL-TKDBYA8W',"Kamer 4 (206)",'SHELL "\\Path-to-wol.exe (Wake on Lan"')
MakeKamer('NL-KDKK0HY',"Kamer 5 (207)",'SHELL "\\Path-to-wol.exe (Wake on Lan"')
MakeKamer('NL-TKDBYB1K',"Kamer 6 (208)",'SHELL "\\Path-to-wol.exe (Wake on Lan"')
MakeKamer('NL-TKDBYA7W',"Kamer 7 (209)",'SHELL "\\Path-to-wol.exe (Wake on Lan"')
MakeKamer('NL-TKDBYB1X',"Kamer 8 (210)",'SHELL "\\Path-to-wol.exe (Wake on Lan"')
MakeKamer('NL-KGX150',"Kamer 9 (211)",'SHELL "\\Path-to-wol.exe (Wake on Lan"')

global $_vncers
MakeVNC('NL-KDKF7PK',"Kamer 1 (203)",'SHELL "C:\Program Files\RealVNC\vncviewer.exe NL-KDKF7PK"')
MakeVNC('NL-TKDBYB1L',"Kamer 2 (204)",'SHELL "C:\Program Files\RealVNC\vncviewer.exe NL-TKDBYB1L"')
MakeVNC('NL-TKDBYA7P',"Kamer 3 (205)",'SHELL "C:\Program Files\RealVNC\vncviewer.exe NL-TKDBYA7P"')
MakeVNC('NL-TKDBYA8W',"Kamer 4 (206)",'SHELL "C:\Program Files\RealVNC\vncviewer.exe NL-TKDBYA8W"')
MakeVNC('NL-KDKK0HY',"Kamer 5 (207)",'SHELL "C:\Program Files\RealVNC\vncviewer.exe NL-KDKK0HY"')
MakeVNC('NL-TKDBYB1K',"Kamer 6 (208)",'SHELL "C:\Program Files\RealVNC\vncviewer.exe NL-TKDBYB1K"')
MakeVNC('NL-TKDBYA7W',"Kamer 7 (209)",'SHELL "C:\Program Files\RealVNC\vncviewer.exe NL-TKDBYA7W"')
MakeVNC('NL-TKDBYB1X',"Kamer 8 (210)",'SHELL "C:\Program Files\RealVNC\vncviewer.exe NL-TKDBYB1X"')
MakeVNC('NL-KGX150',"Kamer 9 (211)",'SHELL "C:\Program Files\RealVNC\vncviewer.exe NL-KGX150"')


$Label1 = $Form.Controls.Label()
$Label1.BackColor = 128,255,255
$Label1.FontBold = "True"
$Label1.FontSize = 12,25
$Label1.Height = 36
$Label1.Left = 30
$Label1.Text = "Klik op knop om PC op te starten"
$Label1.Top = 15
$Label1.Width = 280

$Label2 = $Form.Controls.Label()
$Label2.BackColor = 128,255,255
$Label2.FlatStyle = 3
$Label2.FontBold = "True"
$Label2.FontSize = 8,25
$Label2.FontUnderline = "True"
$Label2.ForeColor = 0,0,255
$Label2.Height = 24
$Label2.Left = 15
$Label2.Text = "Aanzetten"
$Label2.Top = 75
$Label2.Width = 100

$Label4 = $Form.Controls.Label()
$Label4.BackColor = 128,255,255
$Label4.FlatStyle = 3
$Label4.FontBold = "True"
$Label4.FontSize = 8,25
$Label4.FontUnderline = "True"
$Label4.ForeColor = 0,0,255
$Label4.Height = 24
$Label4.Left = 165
$Label4.Text = "Overnemen"
$Label4.Top = 75
$Label4.Width = 105

$Timer = $Form.Timer(5000)
;$Timer.onTimer = 'PingEmAll()' ;Created button for pinging once instead of all the time (every 5 secs)
$Button3 = $Form.Controls.Button()
$Button3.FontSize = 8,25
$Button3.Height = 21
$Button3.Left = 100
$Button3.Text = "on/off ?"
$Button3.Top = 50
$Button3.Width = 50
$Button3.OnClick = 'PingEmAll()'

$ButtQuit = $Form.Controls.Button()
$ButtQuit.Anchor = 5
$ButtQuit.FontSize = 8,25
$ButtQuit.FontBold = "True"
$ButtQuit.Height = 23
$ButtQuit.Left = 120
$ButtQuit.Text = "Nokken"
$ButtQuit.Top = 520
$ButtQuit.Width = 75
$ButtQuit.OnClick = "quit"

$Form.Show
While $Form.Visible
$ev = $Form.DoEvents()
;$ev ? ; Shows DosBox, commented out
$=Execute($ev)
Loop
Exit 1

Function MakeVNC($pcName, $inputName,$inputClick)
dim $button2
if isDeclared($_VNCButton_TOP) ;is this the first time this udf is called?
$_VNCButton_TOP = $_VNCButton_TOP + 45
else
;it is, lets make the var and define the start location for the button.
Global $_VNCButton_TOP
$_VNCButton_TOP = 105
endif

$button2 = $Form.Controls.Button()
$button2.FlatStyle = 3
$button2.FontSize = 8
$button2.Height = 24
$button2.Left = 165
$button2.Text = $inputName
$button2.Top = $_VNCButton_TOP
$button2.Width = 95
$button2.OnClick = $inputClick

redim preserve $_vncers[ubound($_vncers)+1]
endfunction

Function MakeKamer($pcName, $inputName,$inputClick)
dim $button,$checkBox
if isDeclared($_GamerButton_TOP) ;is this the first time this udf is called?
$_GamerButton_TOP = $_GamerButton_TOP + 45
else
;it is, lets make the var and define the start location for the button.
Global $_GamerButton_TOP
$_GamerButton_TOP = 105
endif

$button = $Form.Controls.Button()
$button.FlatStyle = 3
$button.FontSize = 8
$button.Height = 24
$button.Left = 15
$button.Text = $inputName
$button.Top = $_GamerButton_TOP
$button.Width = 95
$button.OnClick = $inputClick

$CheckBox = $Form.Controls.CheckBox()
$CheckBox.BackColor = 128,255,255
$CheckBox.CheckAlign = 16
$CheckBox.CheckState = 0
$CheckBox.FontSize = 8
$CheckBox.Height = 21
$CheckBox.Left = 120
;$CheckBox.Text = $pcName ; Commented out, no need to show $pcname again
$CheckBox.Top = $_GamerButton_TOP
$CheckBox.Width = 10
$CheckBox.tag = $pcName ;pinger uses this tag.

redim preserve $_pingers[ubound($_pingers)+1]
$_pingers[ubound($_pingers)] = $CheckBox
endfunction

Function PingEmAll()
dim $system
For each $system in $_pingers
If Ping($system.tag)
$system.Checked = "True"
Else
$system.Checked = "False"
EndIf
Next
EndFunction

Function Ping($PC)
DIM $PC
shell '%Comspec% /C ping -n 1 ' + $PC + ' | find /C "TTL=" > nul'
$Ping = NOT @ERROR
EndFunction

Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 809 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.061 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org