Jump to content
Sign in to follow this  
Spenhouet

Input - If input > 3 then

Recommended Posts

Spenhouet

Hi AutoIT Forum ;)

Sorry for my bad english writing... i hope you can understand it anyway.

I have an Input field and want other input fields to be disabled as long as the user typed 3 things in the first input field.

(normaly it waits for ENTER)

I had tried this:

AdlibRegister ( "inputaktivornot" , 500)

Func inputaktivornot($outlook_name)
 
   $OutName = GUICtrlRead($outlook_name)
   If StringLen($OutName) >= 3 Then
   enableimap()
   Else
   disableimap()
   EndIf
 
EndFunc

That works... but not realy fine. Some input field flickers...

Thanks

Spenhouet

Share this post


Link to post
Share on other sites
water

Why do you use AdLibRegister to check for input in a GUI? Either use Message-Loop or OnEvent mode.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Spenhouet

Why do you use AdLibRegister to check for input in a GUI? Either use Message-Loop or OnEvent mode.

Sounds good. But how can i do this and how do it work?

Share this post


Link to post
Share on other sites
water

First you need to post the full script. There must be some GUI creating part.

Reading the link I posted is helpful too.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Spenhouet

$Form1_1 = GUICreate("Formular", 467, 700, 233, 127)
GUICtrlCreateLabel("Eingabemaske für die Kontodaten.", 27, 24, 211, 24)
GUICtrlSetFont(-1, 12, 400, 0, "Arial Narrow")

Thats the beginning of my GUI. I think the whole GUI is to long.

Thanks for the link. I found this: http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_MessageLoopMode.htm

But i still don't know how to do this.

Can you tell me what i have to do?

Edited by Spenhouet

Share this post


Link to post
Share on other sites
water

Open the link you posted and you will find a complete example with GUICtreate etc.

Can you please describe what you plan to do with your script? "Kontodaten" (aka "account details") looks like you try to process sensible data.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Spenhouet

You are right. I'm trying to process account details, but less sensible ;) (Creating an E-Mail Acc for a Programm on my PC.)

I was going through the link.... but didn't understand what i can do with it... :/

Share this post


Link to post
Share on other sites
water

In the help file you will find a complete and ready to run example for every GUI function. See how they worka nd modify them to your needs.

Example: GUICtrlCreateInput

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $file, $btn, $msg

    GUICreate(" My GUI input acceptfile", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
    $file = GUICtrlCreateInput("", 10, 5, 300, 20)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlCreateInput("", 10, 35, 300, 20) ; will not accept drag&drop files
    $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20)

    GUISetState()

    $msg = 0
    While $msg <> $GUI_EVENT_CLOSE
        $msg = GUIGetMsg()
        Select
            Case $msg = $btn
                ExitLoop
        EndSelect
    WEnd

    MsgBox(4096, "drag drop file", GUICtrlRead($file))
EndFunc   ;==>Example

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Spenhouet

But that have nothing to do with my problem!

*****
$profil_auswahl = GUICtrlCreateCombo("Wählen Sie ein Profil aus", 136, 114, 289, 25)
$neuP = GUICtrlSetData(-1, "Neues Profil anlegen")
*****
$o_name = GUICtrlCreateInput("", 136, 144, 289, 28)
GUICtrlSetState($o_name, $GUI_DISABLE)
*****
GUICtrlCreateLabel("Server:", 51, 381, 48, 24)
$i_server = GUICtrlCreateInput("", 147, 381, 273, 28)
GUICtrlSetState($i_server, $GUI_DISABLE)

GUICtrlCreateLabel("Benutzername:", 51, 421, 94, 24)
$i_benutzername = GUICtrlCreateInput("", 147, 421, 273, 28)
GUICtrlSetState($i_benutzername, $GUI_DISABLE)
*****
Case $profil_auswahl
   auswahlprofil($profil_auswahl,$o_name)
*****
Func auswahlprofil($profil_auswahl,$o_name)
   If GUICtrlRead($profil_auswahl) = "Neues Profil anlegen" Then
   GUICtrlSetState($o_name, $GUI_ENABLE)
   inputaktivornot($o_name)
   AdlibRegister ( "inputaktivornot" , 500)
  *****
   EndIf
EndFunc
*****
Func inputaktivornot($o_name)
  
   $OutName = GUICtrlRead($_name)
   If StringLen($OutName) >= 3 Then
   GUICtrlSetState($acc_name, $GUI_ENABLE)
   If GUICtrlRead($i_check) = 1 Then
   enablei()
   ElseIf GUICtrlRead($i_check) = 0 Then
   disablei()
   EndIf
   Else
   GUICtrlSetState($acc_name, $GUI_DISABLE)
   disablei()
   GUICtrlSetState($smtp_server, $GUI_DISABLE)
   GUICtrlSetState($inputmail, $GUI_DISABLE)
   EndIf
*****
Func enablei()
  
   GUICtrlSetState($i_server, $GUI_ENABLE)
   GUICtrlSetState($i_benutzername, $GUI_ENABLE)

EndFunc
Func disableimap()
  
   GUICtrlSetState($i_server, $GUI_DISABLE)
   GUICtrlSetState($i_benutzername, $GUI_DISABLE)

EndFunc
******

***** = That's quite immaterial.

I wan't the i_server and the i_benutzername input (normal disabled) to be enabled until 3 characters where typed in without pressing Enter/Ok... ect. and automatically disabled when 2 or less characters where typed in.

Edited by Spenhouet

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  

×