Jump to content

Input - If input > 3 then


Recommended Posts

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

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

$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
Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...