Jump to content

How to make a part of the script when Guictrlinput1/Guictrlinput2 has atleast a character when button is clicked


rrrm99
 Share

Recommended Posts

i need something that would run part of the script if Input1(in the GUI) is filled with atleast 1 character and run another part of the script if they put something in Input2(In GUI) and if they fill something in both Inputs it would show a msgbox

if you need the GUI i am using i can post here...

Edited by rrrm99
Link to comment
Share on other sites

Hi,

if you need the GUI i am using i can post here...

It's the best way to get quick help :rolleyes:

But i have a litle time, here it is:

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I need it only to the Funcs only if they pressed a buton

EDIT:nvm :rolleyes:

i have found what i was looking for in autoit help file and previous scripts

it involved HOURS of trial and error...

here was the final code...if anybody can improve it then please do

#NoTrayIcon
#include <GUIConstants.au3>

$Test = GUICreate(&quotÕÝ ][ÝËÌKLKLJBÕRPÝÜX]QÜÝ
    ][ÝÒ[]I][ÝË
KL#sÂS¢b33c´çWCÒuT7G&Ä7&VFTçWBgV÷C²gV÷C²ÂRÂ3Â#SÂ#¤)U%
Ñɱ
ÉÑɽÕÀ ÅÕ½Ðí%¹ÁÕÐÈÅÕ½Ðì°Ô°ØÔ°ÈÜÔ°ÔÀ¤(ÀÌØí%¹ÁÕÐÈôU%trlCreateInput ( "", 15 , 85 , 250 , 20)
$btn      =  GUICtrÜX]P]Û
    ][ÝÓÚÉ][ÝË
KMKL    ÌÍÐ×ÒPÓÓBT7G&Å6WDÖvRÓÂgV÷C·6VÆÃ3"æFÆÂgV÷C²ÃCBà ¤uT6WE7FFR ¢b33cµÍôÀ)]¡¥±ÀÌØíµÍ±ÐìÐìÀÌØíU%}Y9Q}
1=M(ÀÌØíµÍôIGetMsg()
       Select
       Case $msg = $btn
               IfÕRPÝXY
    ÌÍÒ[]JH  ÉÝÈ  ][ÝÉ][ÝÈ[ÕRPÝXY
    ÌÍÒ[]"fÇC²fwC²gV÷C²gV÷C²FVâ×6t&÷CÂgV÷C²gV÷C²ÂgV÷C²gV÷C²¢U%±Ñ ÀÌØíQÍФ(á¥Ñ±½½À( If GUICtrlRead($Input1) <> "" Then Input1()
         YÕRPÝXY
    ÌÍÒ[]JH  ÉÝÈ  ][ÝÉ][ÝÈ[[]
BWFÆö÷¢VæE6VÆV7@¥tVæ@¤gVæ2çWC¢¶6öFR½Ì¡É)¹Õ¹()Õ¹%¹ÁÕÐÈ ¤(í½½Ì¡É)¹Õ¹
Edited by rrrm99
Link to comment
Share on other sites

here was the final code...if anybody can improve it then please do

The way you have written your code you will never get to execute iput1() or input2(). Maybe this is what you meant-

;============not using Autoit tags because problem with reading afterwards until forum problem fixed

#NoTrayIcon

#include <GUIConstants.au3>

$Test = GUICreate("Test", 280, 325, -1, -1)

GUICtrlCreateGroup("Input1", 5, 10, 270, 50)

$Input1 = GUICtrlCreateInput ( "", 15, 30, 250, 20)

GUICtrlCreateGroup("Input2", 5, 65, 275, 50)

$Input2 = GUICtrlCreateInput ( "", 15 , 85 , 250 , 20)

$btn = GUICtrlCreateButton ("Ok", 5, 295, 120, 22,$BS_ICON)

GUICtrlSetImage (-1, "shell32.dll" ,144,0)

GUISetState ()

$msg = 0

While $msg <> $GUI_EVENT_CLOSE

$msg = GUIGetMsg()

Select

Case $msg = $btn

If GUICtrlRead($Input1) <> "" And GUICtrlRead($Input2) <> "" Then

MsgBox(48, "", "")

GUIDelete($Test);not needed if exiting

Exitloop;this will exit script

elseIf GUICtrlRead($Input1) <> "" Then

Input1()

else

Input2()

EndIf

exitloop; this will close the script

EndSelect

WEnd

Func Input1()

;code goes here

EndFunc

Func Input2()

;code goes here

EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...