Jump to content

Recommended Posts

Posted

Hi there.

It's my first post here, so nice to meet you all.


I've been reading this forum for a some short time now,

and never have any background with apps developing in the past, so Im learning as I go.

My problem is that Im trying to make an app with 2 input boxes and depending on what user write in inputbox 

this will be the one to set up a variable. I did it like this but dosent seems to work and does not set $ip as I want.

Any help appriciated :)

#include <GUIConstantsEx.au3>


While 1

    $nmsg = GUIGetMsg()
    Switch $nmsg
        Case $gui_event_close
            Exit

            Dim $AccelKeys[1][2]=[["{ENTER}", $Enter_KEY]]
            GUISetAccelerators($AccelKeys)

<<  ta funkcja robiła kiedyś także za guzik "ok" - button 1

             If _WinAPI_GetFocus() = GUICtrlGetHandle($input1) Then
                $psd = GUICtrlRead($input1) ;                                           
                $ip = IniRead($dane, "PSD", $psd, "")   ;                               
                $adrespsd = IniRead($adresini, "ADRES", $psd, "")   ;                   
            ElseIf _WinAPI_GetFocus() = GUICtrlGetHandle($inputip) Then
                $ip = GUICtrlRead($inputip)
            EndIf
            if _IsChecked($radioip) Then    ;                                           
                ClipPut($ip)    ;                                                       
            EndIf

 

  • Moderators
Posted (edited)

@sakej you will find that it is difficult for people to assist when you post only non-runnable code. You have half an unterminated Switch statement here. How about posting the full code and helping us help you ;)

 

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

@JLogan3o13 true but this app has more 2k line of code now so wont post it all here ;)

But ... I just figure it out. My stupid mistake was to create 2 inputboxes but only state 1 case to read $input1

For anyone up there who stumble upon something similar in the future here's my working code:

#include <MsgBoxConstants.au3>
#Include <GuiButton.au3>
#Include <GuiMenu.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Global $list, $input1,$inputip, $dane, $adresini

Global $localini = @ScriptDir & "\dane.ini" ;

$ruchomatic = GUICreate("TEST ",793,541,-1,-1,-1,-1)
$inputip = GUICtrlCreateInput("lub wpisz IP",540,30,97,20,$ES_CENTER)

$input1 = GUICtrlCreateInput("Wpisz numer PSD",430,30,104,20,BitOr($ES_CENTER,$ES_NUMBER),$WS_EX_CLIENTEDGE)
GUICtrlSetState(-1,BitOr($GUI_SHOW,$GUI_ENABLE,$GUI_FOCUS))

Global $radioip = GUICtrlCreateCheckbox("Kopiuj IP do schowka",660,283,150,15)

$Enter_KEY = GUICtrlCreateDummy()

GUISetState(@SW_SHOW,$ruchomatic)

While 1

    $nmsg = GUIGetMsg()
    Switch $nmsg
        Case $gui_event_close
            Exit


        Case $input1 ;

            Dim $AccelKeys[1][2]=[["{ENTER}", $Enter_KEY]]
            GUISetAccelerators($AccelKeys)

             If _WinAPI_GetFocus() = GUICtrlGetHandle($input1) Then
                $psd = GUICtrlRead($input1) ;
                $ip = IniRead($dane, "PSD", $psd, "")   ;
                $adrespsd = IniRead($adresini, "ADRES", $psd, "")   ;
                            if _IsChecked($radioip) Then    ;
                ClipPut($ip)    ;
                            EndIf
                            EndIf

            MsgBox(0,"",$ip)

        Case $inputip

            If _WinAPI_GetFocus() = GUICtrlGetHandle($inputip) Then
                $ip = GUICtrlRead($inputip)
            EndIf
            if _IsChecked($radioip) Then    ;
                ClipPut($ip)    ;
            EndIf


            MsgBox(0,"",$ip)


    EndSwitch
WEnd

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

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