Jump to content

Recommended Posts

Posted

CODE

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <GuiIPAddress.au3>

#include <StaticConstants.au3>

#include <TabConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ###

;---------------------------------windows and icon used--------------------------------

$gui = GUICreate("REMOTE CONTROLLER V3.0 BY 4got", 548, 407, 341, 177)

;GUISetIcon("")

;----------------------------------disclaimer's page-----------------------------------

$tab = GUICtrlCreateTab(8, 40, 529, 345)

GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$Group1 = GUICtrlCreateGroup("Disclaimer:", 16, 56, 497, 161)

GUICtrlCreateEdit("xxx", 88, 96, 393, 89,$ES_READONLY)

$Icon1 = GUICtrlCreateIcon("xxx", 0, 24, 80, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Pic1 = GUICtrlCreatePic("xxx", 16, 224, 497, 153) ;Image

;-----------------------------------IP box---------------------------------------------

$ip_label = GUICtrlCreateLabel("IP Server", 8, 8, 63, 20)

GUICtrlSetFont(-1, 10, 800, 0, "Arial")

$ip_remote=GUICtrlCreateInput("0.0.0.0",72, 4, 89, 25)

;$IPAddress1 = _GUICtrlIpAddressCreate($gui, 72, 4, 137, 25)

;$ip_remote=_GUICtrlIpAddressSet($IPAddress1, "0.0.0.0")

;-----------------------------------menu----------------------------------------------

;-----ping menu-----

$ping = GUICtrlCreateMenu("Ping")

$ping_normal=GUICtrlCreateMenuItem("Normal Ping",$ping)

$ping_scan_ip=GUICtrlCreateMenuItem("IP scan",$ping)

$ping_scan_port=GUICtrlCreateMenuItem("Port scan",$ping)

;-------------------------------------------------------------------------------------

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

;-----------------------------function to clear the tab space--------------------------

Func clear($inside)

If $inside=0 Then

$tab1=$tab

$tab2=$Icon1

For $n=$tab1 To $tab2

GUICtrlDelete($n)

next

EndIf

EndFunc

;-------------------------------------------------------------------------------------

$tab_inside=0

While 1

$Msg = GUIGetMsg()

Select

Case $Msg=$ping_normal

clear($tab_inside)

$tab_inside="ping_normal"

$tab=GUICtrlCreateTab(8, 40, 529, 345)

$Label_port=GUICtrlCreateLabel("Port :",30,55)

$Label_delay=GUICtrlCreateLabel("Delay :",160,55)

$delay=GUICtrlCreateInput("10",200,50,60,25,$ES_READONLY)

$updown=GUICtrlCreateUpdown($delay)

GUICtrlSetLimit($updown,"100","1")

$port=GUICtrlCreateInput("80",60,50,60,25)

$listaip=GUICtrlCreateEdit("",15,100,515,100,$ES_READONLY)

$start_normal_ping=GUICtrlCreateButton("Ping",300,50,60,25)

$exit=GUICtrlCreateButton("EXIT",380,50,60,25)

while 1

$message=GUIGetMsg()

Select

Case $message=$start_normal_ping

MsgBox(0,"ping","ping")

$ip=GUICtrlRead($ip_remote) ;trova problema con loop

$del=GUICtrlRead($delay)

$por=GUICtrlRead($port)

$result=Ping($ip,$del)

If $result=0 Then ;if the ping hasn't a good result

;--------------------LIST OF VARIOUS ERROR -----------------------

$err=@error

Select

case $err=1

GUICtrlSetData($listaip,"Host is offline")

case $err=2

GUICtrlSetData($listaip,"Host is unreachable")

case $err=3

GUICtrlSetData($listaip,"Bad destination")

case $err=4

GUICtrlSetData($listaip,"Unknown error")

EndSelect

;-----------------------------------------------------------------

Else

GUICtrlSetData($listaip,"Host is online") ;if the ping has a good result

EndIf

Case $message=$exit

ExitLoop(1)

EndSelect

wend

;$result = RunWait(@ComSpec & " /c ping www.google.com", "", @SW_HIDE)

;MsgBox(0, "Trial 1", "Result of google ping: " & $result)

;$result = RunWait(@ComSpec & " /c ping www.goble-de-gook.com", "", @SW_HIDE)

;MsgBox(0, "Trial 2", "Result of garbage ping: " & $result)

Case $Msg=$GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

That code is totally messed up. I'll work with it tosay and post something new for you.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

That code is totally messed up. I'll work with it tosay and post something new for you.

what's wrong with the code? :P
Posted

what's wrong with the code? :P

Hmmmmmm. Did you post all of it? If you did, then lets start with the fact that you have created Tab controls and I don't see any TabItems. That accounts for why there are no tabs being displayed. Also $Tab was already declared up in the GUI code and then you went and re-declared (and re-created) it in the loop, still with no tabitems. I think this is probably better written using child windows. Your disclaimer doesn't need to be a group either. A simple label would suffice.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted (edited)

Hmmmmmm. Did you post all of it? If you did, then lets start with the fact that you have created Tab controls and I don't see any TabItems. That accounts for why there are no tabs being displayed. Also $Tab was already declared up in the GUI code and then you went and re-declared (and re-created) it in the loop, still with no tabitems. I think this is probably better written using child windows. Your disclaimer doesn't need to be a group either. A simple label would suffice.

I erased some part...That's the complete code:

CODE
#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <GuiIPAddress.au3>

#include <StaticConstants.au3>

#include <TabConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ###

;---------------------------------windows and icon used--------------------------------

$gui = GUICreate("", 548, 407, 341, 177)

;GUISetIcon("")

;----------------------------------disclaimer's page-----------------------------------

$tab = GUICtrlCreateTab(8, 40, 529, 345)

GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$Group1 = GUICtrlCreateGroup("xxx:", 16, 56, 497, 161)

GUICtrlCreateEdit("xxx", 88, 96, 393, 89,$ES_READONLY)

$Icon1 = GUICtrlCreateIcon("xx", 0, 24, 80, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Pic1 = GUICtrlCreatePic("xxx", 16, 224, 497, 153) ;Image

;-----------------------------------IP box---------------------------------------------

$ip_label = GUICtrlCreateLabel("IP Server", 8, 8, 63, 20)

GUICtrlSetFont(-1, 10, 800, 0, "Arial")

$ip_remote=GUICtrlCreateInput("0.0.0.0",72, 4, 89, 25)

;$IPAddress1 = _GUICtrlIpAddressCreate($Remote_controller, 72, 4, 137, 25)

;$ip_remote=_GUICtrlIpAddressSet($IPAddress1, "0.0.0.0")

;-----------------------------------menu----------------------------------------------

;-----ping menu-----

$ping = GUICtrlCreateMenu("Ping")

$ping_normal=GUICtrlCreateMenuItem("Normal Ping",$ping)

$ping_scan_ip=GUICtrlCreateMenuItem("IP scan",$ping)

$ping_scan_port=GUICtrlCreateMenuItem("Port scan",$ping)

;----send message menu-----

$send = GUICtrlCreateMenu("Send message")

;---fun menu-------

$fun = GUICtrlCreateMenu("Fun")

;----stats menu------

$stats = GUICtrlCreateMenu("Stats")

;-------------------------------------------------------------------------------------

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

;-----------------------------function to clear the tab space--------------------------

Func clear($inside)

If $inside=0 Then

$tab1=$tab

$tab2=$Icon1

For $n=$tab1 To $tab2

GUICtrlDelete($n)

next

EndIf

EndFunc

;-------------------------------------------------------------------------------------

$tab_inside=0

While 1

$Msg = GUIGetMsg()

Select

Case $Msg=$ping_normal

clear($tab_inside)

$tab_inside="ping_normal"

$tab=GUICtrlCreateTab(8, 40, 529, 345)

$Label_port=GUICtrlCreateLabel("Port :",30,55)

$Label_delay=GUICtrlCreateLabel("Delay :",160,55)

$delay=GUICtrlCreateInput("10",200,50,60,25,$ES_READONLY)

$updown=GUICtrlCreateUpdown($delay)

GUICtrlSetLimit($updown,"100","1")

$port=GUICtrlCreateInput("80",60,50,60,25)

$listaip=GUICtrlCreateEdit("",15,100,515,100,$ES_READONLY)

$start_normal_ping=GUICtrlCreateButton("Ping",300,50,60,25)

$exit=GUICtrlCreateButton("EXIT",380,50,60,25)

while 1

$message=GUIGetMsg()

Select

Case $message=$start_normal_ping

MsgBox(0,"ping","ping")

$ip=GUICtrlRead($ip_remote) ;trova problema con loop

$del=GUICtrlRead($delay)

$por=GUICtrlRead($port)

$result=Ping($ip,$del)

If $result=0 Then ;if the ping hasn't a good result

;--------------------LIST OF VARIOUS ERROR -----------------------

$err=@error

Select

case $err=1

GUICtrlSetData($listaip,"Host is offline")

case $err=2

GUICtrlSetData($listaip,"Host is unreachable")

case $err=3

GUICtrlSetData($listaip,"Bad destination")

case $err=4

GUICtrlSetData($listaip,"Unknown error")

EndSelect

;-----------------------------------------------------------------

Else

GUICtrlSetData($listaip,"Host is online") ;if the ping has a good result

EndIf

Case $message=$exit

ExitLoop(1)

EndSelect

wend

Case $Msg=$GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

that's it...but I'm still working on it,it's not finished yet...this is the part of code I've realized for now...In the $tab I don't need any tab it's only a place where the elements are displayed and every time I click on a different menu item this tab is cleared with the clear function and is recreated with other elements.. Edited by 4got
Posted (edited)

I erased some part...That's the complete code:

CODE
#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <GuiIPAddress.au3>

#include <StaticConstants.au3>

#include <TabConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ###

;---------------------------------windows and icon used--------------------------------

$gui = GUICreate("", 548, 407, 341, 177)

;GUISetIcon("")

;----------------------------------disclaimer's page-----------------------------------

$tab = GUICtrlCreateTab(8, 40, 529, 345)

GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$Group1 = GUICtrlCreateGroup("xxx:", 16, 56, 497, 161)

GUICtrlCreateEdit("xxx", 88, 96, 393, 89,$ES_READONLY)

$Icon1 = GUICtrlCreateIcon("xx", 0, 24, 80, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Pic1 = GUICtrlCreatePic("xxx", 16, 224, 497, 153) ;Image

;-----------------------------------IP box---------------------------------------------

$ip_label = GUICtrlCreateLabel("IP Server", 8, 8, 63, 20)

GUICtrlSetFont(-1, 10, 800, 0, "Arial")

$ip_remote=GUICtrlCreateInput("0.0.0.0",72, 4, 89, 25)

;$IPAddress1 = _GUICtrlIpAddressCreate($Remote_controller, 72, 4, 137, 25)

;$ip_remote=_GUICtrlIpAddressSet($IPAddress1, "0.0.0.0")

;-----------------------------------menu----------------------------------------------

;-----ping menu-----

$ping = GUICtrlCreateMenu("Ping")

$ping_normal=GUICtrlCreateMenuItem("Normal Ping",$ping)

$ping_scan_ip=GUICtrlCreateMenuItem("IP scan",$ping)

$ping_scan_port=GUICtrlCreateMenuItem("Port scan",$ping)

;----send message menu-----

$send = GUICtrlCreateMenu("Send message")

;---fun menu-------

$fun = GUICtrlCreateMenu("Fun")

;----stats menu------

$stats = GUICtrlCreateMenu("Stats")

;-------------------------------------------------------------------------------------

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

;-----------------------------function to clear the tab space--------------------------

Func clear($inside)

If $inside=0 Then

$tab1=$tab

$tab2=$Icon1

For $n=$tab1 To $tab2

GUICtrlDelete($n)

next

EndIf

EndFunc

;-------------------------------------------------------------------------------------

$tab_inside=0

While 1

$Msg = GUIGetMsg()

Select

Case $Msg=$ping_normal

clear($tab_inside)

$tab_inside="ping_normal"

$tab=GUICtrlCreateTab(8, 40, 529, 345)

$Label_port=GUICtrlCreateLabel("Port :",30,55)

$Label_delay=GUICtrlCreateLabel("Delay :",160,55)

$delay=GUICtrlCreateInput("10",200,50,60,25,$ES_READONLY)

$updown=GUICtrlCreateUpdown($delay)

GUICtrlSetLimit($updown,"100","1")

$port=GUICtrlCreateInput("80",60,50,60,25)

$listaip=GUICtrlCreateEdit("",15,100,515,100,$ES_READONLY)

$start_normal_ping=GUICtrlCreateButton("Ping",300,50,60,25)

$exit=GUICtrlCreateButton("EXIT",380,50,60,25)

while 1

$message=GUIGetMsg()

Select

Case $message=$start_normal_ping

MsgBox(0,"ping","ping")

$ip=GUICtrlRead($ip_remote) ;trova problema con loop

$del=GUICtrlRead($delay)

$por=GUICtrlRead($port)

$result=Ping($ip,$del)

If $result=0 Then ;if the ping hasn't a good result

;--------------------LIST OF VARIOUS ERROR -----------------------

$err=@error

Select

case $err=1

GUICtrlSetData($listaip,"Host is offline")

case $err=2

GUICtrlSetData($listaip,"Host is unreachable")

case $err=3

GUICtrlSetData($listaip,"Bad destination")

case $err=4

GUICtrlSetData($listaip,"Unknown error")

EndSelect

;-----------------------------------------------------------------

Else

GUICtrlSetData($listaip,"Host is online") ;if the ping has a good result

EndIf

Case $message=$exit

ExitLoop(1)

EndSelect

wend

Case $Msg=$GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

that's it...but I'm still working on it,it's not finished yet...this is the part of code I've realized for now...In the $tab I don't need any tab it's only a place where the elements are displayed and every time I click on a different menu item this tab is cleared with the clear function and is recreated with other elements..
That makes a major difference. Now I have something to work with that almost makes sense. You don't need separate msg loops to do it either.

Edit: Is there a particular reason for deleting the controls or is it just as good to hide them?

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

That makes a major difference. Now I have something to work with that almost makes sense. You don't need separate msg loops to do it either.

Edit: Is there a particular reason for deleting the controls or is it just as good to hide them?

It's the same thing ...But if you hide the controls every time you click on a menu item they're loaded on the previous elements.I've decided to delete the elements every time to avoid that too many elements were superimposed.
Posted

It's the same thing ...But if you hide the controls every time you click on a menu item they're loaded on the previous elements.I've decided to delete the elements every time to avoid that too many elements were superimposed.

Okay. I'm still not really sure where you want what controls to appear so just consider this as a concept. The code is messy because I just commented out a bunch of your code and added In what I needed but test it anyway, using just the first 2 menu items on the Ping menu. You need nothing in there that relates to Tabs.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ###
;---------------------------------windows and icon used--------------------------------
$Frm_Main= GUICreate("", 548, 407, 341, 177)
;-----ping menu-----
$ping = GUICtrlCreateMenu("Ping")
$ping_normal=GUICtrlCreateMenuItem("Normal Ping",$ping)
$ping_scan_ip=GUICtrlCreateMenuItem("IP scan",$ping)
$ping_scan_port=GUICtrlCreateMenuItem("Port scan",$ping)
;----send message menu-----
$send = GUICtrlCreateMenu("Send message")
;---fun menu-------
$fun = GUICtrlCreateMenu("Fun")
;----stats menu------
$stats = GUICtrlCreateMenu("Stats")
GUISetState()
$Frm_Ping_Normal = GUICreate("Ping Norm", 548, 347, 0, 0, $WS_CHILD, -1, $Frm_Main)
;GUISetBkColor(0xFF0000)
$Label_port=GUICtrlCreateLabel("Port :",30,55)
$Label_delay=GUICtrlCreateLabel("Delay :",160,55)
$delay=GUICtrlCreateInput("10",200,50,60,25,$ES_READONLY)
$updown=GUICtrlCreateUpdown($delay)
GUICtrlSetLimit($updown,"100","1")
$port=GUICtrlCreateInput("80",60,50,60,25)
$listaip=GUICtrlCreateEdit("",15,100,515,100,$ES_READONLY)
GUISetState()
$Frm_Btns = GUICreate("buttons", 548, 40, 0, 347, $WS_CHILD, -1, $Frm_Main)
$start_normal_ping=GUICtrlCreateButton("Ping",300,10,60,25)
$exit = GUICtrlCreateButton("EXIT",380,10,60,25)
GUISetState()
;GUISetIcon("")
;----------------------------------disclaimer's page-----------------------------------
$Frm_Disclaim = GUICreate("disclaimer", 548, 347, 0, 0, $WS_CHILD, -1, $Frm_Main)
;$tab = GUICtrlCreateTab(8, 40, 529, 345)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Group1 = GUICtrlCreateGroup("xxx:", 16, 56, 497, 161)
GUICtrlCreateEdit("xxx", 88, 96, 393, 89,$ES_READONLY)
$Icon1 = GUICtrlCreateIcon("xx", 0, 24, 80, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Pic1 = GUICtrlCreatePic("xxx", 16, 224, 497, 153);Image
;-----------------------------------IP box---------------------------------------------
$ip_label = GUICtrlCreateLabel("IP Server", 8, 8, 63, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$ip_remote=GUICtrlCreateInput("0.0.0.0",72, 4, 89, 25)
;$IPAddress1 = _GUICtrlIpAddressCreate($Remote_controller, 72, 4, 137, 25)
;$ip_remote=_GUICtrlIpAddressSet($IPAddress1, "0.0.0.0")
;-----------------------------------menu----------------------------------------------
#cs
;-----ping menu-----
$ping = GUICtrlCreateMenu("Ping")
$ping_normal=GUICtrlCreateMenuItem("Normal Ping",$ping)
$ping_scan_ip=GUICtrlCreateMenuItem("IP scan",$ping)
$ping_scan_port=GUICtrlCreateMenuItem("Port scan",$ping)
;----send message menu-----
$send = GUICtrlCreateMenu("Send message")
;---fun menu-------
$fun = GUICtrlCreateMenu("Fun")
;----stats menu------
$stats = GUICtrlCreateMenu("Stats")
#ce
;-------------------------------------------------------------------------------------
;GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;-----------------------------function to clear the tab space--------------------------
Func clear($inside)
If $inside=0 Then
$tab1=$tab
$tab2=$Icon1
For $n=$tab1 To $tab2
GUICtrlDelete($n)
next
EndIf 
EndFunc
;-------------------------------------------------------------------------------------
$tab_inside=0 
While 1

$Msg = GUIGetMsg()

Switch $Msg
Case $ping_scan_ip
GUISetState(@SW_Hide, $Frm_Ping_Normal)
GUISetState(@Sw_Show, $Frm_Disclaim)
Case $ping_normal
;clear($tab_inside) 
$tab_inside="ping_normal"
;$tab=GUICtrlCreateTab(8, 40, 529, 345)
GUISetState(@SW_Show, $Frm_Ping_Normal)
GUISetState(@Sw_Hide, $Frm_Disclaim)
#cs
$Label_port=GUICtrlCreateLabel("Port :",30,55)
$Label_delay=GUICtrlCreateLabel("Delay :",160,55)
$delay=GUICtrlCreateInput("10",200,50,60,25,$ES_READONLY)
$updown=GUICtrlCreateUpdown($delay)
GUICtrlSetLimit($updown,"100","1")
$port=GUICtrlCreateInput("80",60,50,60,25)
$listaip=GUICtrlCreateEdit("",15,100,515,100,$ES_READONLY)
$start_normal_ping=GUICtrlCreateButton("Ping",300,50,60,25)

$exit=GUICtrlCreateButton("EXIT",380,50,60,25)

while 1
$message=GUIGetMsg()
Select
Case $message=$start_normal_ping 
MsgBox(0,"ping","ping") 
$ip=GUICtrlRead($ip_remote);trova problema con loop
$del=GUICtrlRead($delay)
$por=GUICtrlRead($port)
$result=Ping($ip,$del)
If $result=0 Then;if the ping hasn't a good result
;--------------------LIST OF VARIOUS ERROR -----------------------
$err=@error
Select
case $err=1
GUICtrlSetData($listaip,"Host is offline")

case $err=2
GUICtrlSetData($listaip,"Host is unreachable")

case $err=3
GUICtrlSetData($listaip,"Bad destination")

case $err=4
GUICtrlSetData($listaip,"Unknown error")
EndSelect
;----------------------------------------------------------------- 
Else
GUICtrlSetData($listaip,"Host is online");if the ping has a good result
EndIf

Case $message=$exit
ExitLoop(1)
EndSelect
wend
#ce

Case $GUI_EVENT_CLOSE, $exit
ExitLoop
EndSwitch
WEnd

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

Okay. I'm still not really sure where you want what controls to appear so just consider this as a concept. The code is messy because I just commented out a bunch of your code and added In what I needed but test it anyway, using just the first 2 menu items on the Ping menu. You need nothing in there that relates to Tabs.

But the problem still remains...Perhaps I was not clear in explanation..I've solved the problem of the tab with the clear function that erases all the elements inside it. Now I have a problem with the while loop inside the first case of the select case cycle($Msg=$ping_normal):

CODE

$tab_inside=0 ;is a control variable that is setted depending on what is inside the tab

While 1

$Msg = GUIGetMsg()

Select

Case $Msg=$ping_normal

clear($tab_inside)

$tab_inside="ping_normal"

$tab=GUICtrlCreateTab(8, 40, 529, 345)

$Label_port=GUICtrlCreateLabel("Port :",30,55)

$Label_delay=GUICtrlCreateLabel("Delay :",160,55)

$delay=GUICtrlCreateInput("10",200,50,60,25,$ES_READONLY)

$updown=GUICtrlCreateUpdown($delay)

GUICtrlSetLimit($updown,"100","1")

$port=GUICtrlCreateInput("80",60,50,60,25)

$listaip=GUICtrlCreateEdit("",15,100,515,100,$ES_READONLY)

$start_normal_ping=GUICtrlCreateButton("Ping",300,50,60,25)

$exit=GUICtrlCreateButton("EXIT",380,50,60,25) ; button created to exit the ping loop

;-------------------ping loop----------------------

while 1

$message=GUIGetMsg()

Select

Case $message=$start_normal_ping

MsgBox(0,"ping","ping")

$ip=GUICtrlRead($ip_remote) ;trova problema con loop

$del=GUICtrlRead($delay)

$por=GUICtrlRead($port)

$result=Ping($ip,$del)

If $result=0 Then ;if the ping hasn't a good result

;--------------------LIST OF VARIOUS ERROR -----------------------

$err=@error

Select

case $err=1

GUICtrlSetData($listaip,"Host is offline")

case $err=2

GUICtrlSetData($listaip,"Host is unreachable")

case $err=3

GUICtrlSetData($listaip,"Bad destination")

case $err=4

GUICtrlSetData($listaip,"Unknown error")

EndSelect

;-----------------------------------------------------------------

Else

GUICtrlSetData($listaip,"Host is online") ;if the ping has a good result

EndIf

Case $message=$exit

ExitLoop(1)

EndSelect

wend

Case $Msg=$GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

We have the Ip server input,that must be always visible because is where the ip address to ping is inserted,the port input, the delay input,the edit where the result of the ping will be displayed,the ping button to start the ping and the exit button that is used only to exit the ping loop(that is marked in the code).The problem is that when I click the exit button the program exit not only the ping loop but also the other while loop.I hope you understand :P
Posted

But the problem still remains...Perhaps I was not clear in explanation..I've solved the problem of the tab with the clear function that erases all the elements inside it. Now I have a problem with the while loop inside the first case of the select case cycle($Msg=$ping_normal):

CODE

$tab_inside=0 ;is a control variable that is setted depending on what is inside the tab

While 1

$Msg = GUIGetMsg()

Select

Case $Msg=$ping_normal

clear($tab_inside)

$tab_inside="ping_normal"

$tab=GUICtrlCreateTab(8, 40, 529, 345)

$Label_port=GUICtrlCreateLabel("Port :",30,55)

$Label_delay=GUICtrlCreateLabel("Delay :",160,55)

$delay=GUICtrlCreateInput("10",200,50,60,25,$ES_READONLY)

$updown=GUICtrlCreateUpdown($delay)

GUICtrlSetLimit($updown,"100","1")

$port=GUICtrlCreateInput("80",60,50,60,25)

$listaip=GUICtrlCreateEdit("",15,100,515,100,$ES_READONLY)

$start_normal_ping=GUICtrlCreateButton("Ping",300,50,60,25)

$exit=GUICtrlCreateButton("EXIT",380,50,60,25) ; button created to exit the ping loop

;-------------------ping loop----------------------

while 1

$message=GUIGetMsg()

Select

Case $message=$start_normal_ping

MsgBox(0,"ping","ping")

$ip=GUICtrlRead($ip_remote) ;trova problema con loop

$del=GUICtrlRead($delay)

$por=GUICtrlRead($port)

$result=Ping($ip,$del)

If $result=0 Then ;if the ping hasn't a good result

;--------------------LIST OF VARIOUS ERROR -----------------------

$err=@error

Select

case $err=1

GUICtrlSetData($listaip,"Host is offline")

case $err=2

GUICtrlSetData($listaip,"Host is unreachable")

case $err=3

GUICtrlSetData($listaip,"Bad destination")

case $err=4

GUICtrlSetData($listaip,"Unknown error")

EndSelect

;-----------------------------------------------------------------

Else

GUICtrlSetData($listaip,"Host is online") ;if the ping has a good result

EndIf

Case $message=$exit

ExitLoop(1)

EndSelect

wend

Case $Msg=$GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

We have the Ip server input,that must be always visible because is where the ip address to ping is inserted,the port input, the delay input,the edit where the result of the ping will be displayed,the ping button to start the ping and the exit button that is used only to exit the ping loop(that is marked in the code).The problem is that when I click the exit button the program exit not only the ping loop but also the other while loop.I hope you understand :P
As I said "Conceptual" and if you looked at the code you will see that the second loop doesn't even exist anymore. Thats because I wasn't entirely clear on what you were trying to do. I think I now have the idea and I can fix that easily enough. Exit may be a bad explanation of that buttons function. Stop is probably more appropriate. Where does your disclaimer come in? Is that separate from all the others or should it be displayed along with something else? Hard to tell when I ran your code because there were controls stacked over other controls and they were displaying all at the same time. I was really pointing out that this is probably better done with child windows so you can either hide or destroy the entire window. In the case of using GUIDelete to destroy a window then it should be placed in a function all by itself.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

As I said "Conceptual" and if you looked at the code you will see that the second loop doesn't even exist anymore. Thats because I wasn't entirely clear on what you were trying to do. I think I now have the idea and I can fix that easily enough. Exit may be a bad explanation of that buttons function. Stop is probably more appropriate. Where does your disclaimer come in? Is that separate from all the others or should it be displayed along with something else? Hard to tell when I ran your code because there were controls stacked over other controls and they were displaying all at the same time. I was really pointing out that this is probably better done with child windows so you can either hide or destroy the entire window. In the case of using GUIDelete to destroy a window then it should be placed in a function all by itself.

Yes you're right ,stop is more appropriate than exit..the disclaimer are showed only when the program starts..for now the big problem is the second loop..by the way ,if you find a solution post it and ,if you want try to write an example on how you do with child windows...thx a lot :P
Posted

Yes you're right ,stop is more appropriate than exit..the disclaimer are showed only when the program starts..for now the big problem is the second loop..by the way ,if you find a solution post it and ,if you want try to write an example on how you do with child windows...thx a lot :P

Your whole concept is flawed here. First of all you are setting a timeout which defaults to 10 milliseconds (maximum = 100ms). In 10 ms you can barely trap the msg and thats why it appeared to be exiting 2 loops, it had timed out and exited the first already. Secondly AutoIts Ping() is a looping function as well so while it's in that function you can't do anything with it. I'll send you a PM later to get some other items sorted out.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

Your whole concept is flawed here. First of all you are setting a timeout which defaults to 10 milliseconds (maximum = 100ms). In 10 ms you can barely trap the msg and thats why it appeared to be exiting 2 loops, it had timed out and exited the first already. Secondly AutoIts Ping() is a looping function as well so while it's in that function you can't do anything with it. I'll send you a PM later to get some other items sorted out.

Sorry , could you be more clear about the timeout because I don't understand where is setted...
Posted

Sorry , could you be more clear about the timeout because I don't understand where is setted...

$del=GUICtrlRead($delay);; This defaults to 10 and has a max of 100
$result=Ping($ip,$del);; The second parameter of the Ping Function is in milliseconds

That second loop will be exited as soon as the delay time has been exceeded (max 100 ms) and either $result or @Error has been set.

Sorry, I forgot all about this. I'll try to get back at it shortly.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

$del=GUICtrlRead($delay);; This defaults to 10 and has a max of 100
$result=Ping($ip,$del);; The second parameter of the Ping Function is in milliseconds

That second loop will be exited as soon as the delay time has been exceeded (max 100 ms) and either $result or @Error has been set.

Sorry, I forgot all about this. I'll try to get back at it shortly.

ok then if I don't set the delay when I click the stop button it will exit the first loop only? Right?
Posted

ok then if I don't set the delay when I click the stop button it will exit the first loop only? Right?

No. Then it will take the default for Ping() which is 4000 milliseconds and as I pointed out earlier, there is no way to force the Ping() function itself to exit.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

No. Then it will take the default for Ping() which is 4000 milliseconds and as I pointed out earlier, there is no way to force the Ping() function itself to exit.

I see...I've tryied but it still doesn't work...So to solve the problem you think the only way is to use child windows or there is another way??

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
×
×
  • Create New...