Sign in to follow this  
Followers 0
infernothebest

third gui problem

2 posts in this topic

i got a problem if i wanna quit a third gui, click adresboek -> contact toevoegen and then try to quit the 1st gui using x and second gui then you see the problem, second how can i comunicate between 2 gui's? like reading a GUICtrlListView item or something else.

thx adv

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
#include <IE.au3>
#Include <GuiListView.au3>
#Include <File.au3>
#Include <String.au3>
$titel="SMS Sender 1.0  @"&@username
$username= ""
$password= ""
$callerID= ""
GUICreate($titel,300,300)
    $Ontvanger = GUICtrlCreateInput("", 10, 5, 100, 20,$ES_CENTER,$WS_EX_CLIENTEDGE)
    $adresboek = GUICtrlCreateButton("Adresboek", 115, 5, 60,20)
    $TEXT = GUICtrlCreateInput("", 10, 30, 278, 210,$ES_MULTILINE,$WS_EX_CLIENTEDGE )
    $Send = GUICtrlCreateButton("Verzend", 175, 250, 100,40)
    $length="0"
    $Characters= GUICtrlCreateLabel("Char: "&$length, 10, 250, 100)
    $SMSlength="0"
    $SMS= GUICtrlCreateLabel("SMS: "&$SMSlength, 10, 270, 155)
    $y=160
    GUISetState(@SW_SHOW)


    While 1
        
        $msg = GUIGetMsg()
$length = StringLen(GuiCtrlRead($TEXT))     

GUICtrlSetData ($Characters,"Char: "&$length)



if $length = 0 Then
    GUICtrlSetData($SMS,"SMS: 0  Remaining Char: 160")
Else
    
For $i = 1 To string($length/161) +1
    
if string ($y-$length) = 161 Then   
$y =string(160 * $i)
EndIf
    
    
if string ($y-$length) = -1 Then
$y =string(160 * $i)
EndIf
$remaining=string ($y-$length)
GUICtrlSetData($SMS,"SMS: "&$i &" Remaining Char: "&$remaining)
Next
EndIf
sleep(30)






        
If $msg =$adresboek Then
    Adresboek()

    
EndIf
If $msg = $Send Then
$readOntvanger=GUICtrlRead ($Ontvanger,0)
$readText=GUICtrlRead ($TEXT,0)
if StringIsDigit ($readOntvanger)Then


        
if $length = 0 Then
    
Else
GUICtrlSetState ($Send, $GUI_DISABLE)
    GUICtrlSetState ($TEXT, $GUI_DISABLE)
GUICtrlSetState ($Ontvanger, $GUI_DISABLE)
$leghhh=String($length/160) 
    
For $i = 0 To $leghhh
    
$trim=StringTrimLeft($readText,number(-1+$i*161))
$readtexstring=StringLeft ($trim, 160)
bericht()

Next
        

MsgBox(0,"","Bericht Verzonden naar "& $readOntvanger)
GUICtrlSetData ($TEXT,"")
GUICtrlSetState ( $Send, $GUI_ENABLE )
    GUICtrlSetState ($TEXT, $GUI_ENABLE)
    GUICtrlSetState ($Ontvanger, $GUI_ENABLE)
EndIf       
    Else
    
        MsgBox(16,"Ontvanger verkeerd", "Fout: ingave veld ontvanger.")
    EndIf
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then Exit
    WEnd


func bericht()
$oIE=_IECreate ("https://myaccount.VoipCheap.com/clx/sendsms.php?username="&$username&"&password="&$password&"&from="&$callerID&"&to="&$readOntvanger&"&text="&$readtexstring  ,0,0,1)
_IELoadWait ($oIE)
EndFunc


Func Adresboek()
Local $msg
    GUICreate("Adresboek",400,300)
$hListView = GUICtrlCreateListView("", 2, 2, 395, 230,"",$LVS_EX_CHECKBOXES)

    GUISetState()

    _GUICtrlListView_AddColumn($hListView, "Voornaam", 100)
    _GUICtrlListView_AddColumn($hListView, "Tussenvoegsels", 90)
    _GUICtrlListView_AddColumn($hListView, "Achternaam", 100)
    _GUICtrlListView_AddColumn($hListView, "Telefoonnummer", 100)
$smsdir=@scriptdir&"\data.sms"
if FileExists($smsdir) then
$countlines=_FileCountLines($smsdir)
for $i=1 to $countlines

$readline=FileReadLine($smsdir,$i)
$split=_StringSplit($readline, ",")
_GUICtrlListView_AddItem($hListView, $split[0], $i)
_GUICtrlListView_AddSubItem($hListView, string ($i-1), $split[1], 1, 1)
_GUICtrlListView_AddSubItem($hListView, string ($i-1), $split[2], 2, 1)
_GUICtrlListView_AddSubItem($hListView, string ($i-1), $split[3], 3, 1)
Next
Else
FileWrite($smsdir,"")
EndIf

$terug=GUICtrlCreateButton("Toevoegen geadresseerde",10,250)
$contact=GUICtrlCreateButton("Contact Toevoegen",250,250)
    While 1
        $msg = GUIGetMsg()
    

if $msg = $contact Then
     
    contactToevoegen()
EndIf
if $msg= $terug Then


for $i=0 to _GUICtrlListView_GetItemCount($hListView) 
    if _GUICtrlListView_GetItemChecked($hListView, $i)= true Then
    ControlSetText($titel,"","Edit1",_GUICtrlListView_GetItemText($hListView, $i,3))
    MsgBox(0,"Geselecteerd","U heeft "& _GUICtrlListView_GetItemText($hListView, $i,0)&" "& _GUICtrlListView_GetItemText($hListView, $i,1)&" "& _GUICtrlListView_GetItemText($hListView, $i,2)&" Geselecteerd.")
EndIf
Next
    
    


        ExitLoop
    EndIf
    
    
    
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

    GUIDelete()
EndFunc


Func contactToevoegen()
    Local $msg

    GUICreate("My GUI")  ; will create a dialog box that when displayed is centered
    GUISetState(@SW_SHOW)       ; will display an empty dialog box

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()
EndFunc

Share this post


Link to post
Share on other sites



i got a problem if i wanna quit a third gui, click adresboek -> contact toevoegen and then try to quit the 1st gui using x and second gui then you see the problem, second how can i comunicate between 2 gui's? like reading a GUICtrlListView item or something else.

thx adv

To use the native AutoIt GUI commands, first specify the GUI with GuiSwitch().

Alternatively, you use ControlCommand(), ControlGetText(), etc. where the window specification is in the parameters (just use the handle).

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  
Followers 0