akira2891 3 Posted November 17, 2014 Hi, i have problem with this script. How can i check inputfield if empty go on second I tried like this but he dont skip first field even if its empty expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> GUICreate("Form 1", 682, 293, 561, 164) $input1 = GUICtrlCreateInput("", 16, 48, 649, 21) $input2 = GUICtrlCreateInput("", 16, 138, 649, 21) GUICtrlSetLimit(-1, 90) $input3 = GUICtrlCreateInput("", 16, 222, 649, 21) GUICtrlSetLimit(-1, 90) GUICtrlCreateLabel("Input 1", 16, 16, 100, 20) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlCreateLabel("Input 2", 16, 102, 78, 20) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlCreateLabel("Input 3", 16, 188, 46, 20) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUISetState(@SW_SHOW) HotKeySet("{F3}", "_msgSend") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _msgSend() If GUICtrlRead($input1) >= 0 Then Send("{ENTER}") Sleep(1000) Send(GUICtrlRead($input1)) Send("{ENTER}") Sleep(500) EndIf Send("{ENTER}") Sleep(1000) Send(GUICtrlRead($input2)) Send("{ENTER}") Sleep(500) Send("{ENTER}") Sleep(1000) Send(GUICtrlRead($input3)) Send("{ENTER}") Sleep(500) EndFunc Share this post Link to post Share on other sites
alienclone 24 Posted November 17, 2014 send tab instead of send enter? If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results Share this post Link to post Share on other sites
akira2891 3 Posted November 17, 2014 (edited) I have problem with this only, i need to check if field is not empty what operator to use > or = '' or = 0 If GUICtrlRead($input1) >= 0 Then its not like in other languages like in php for example, so if 1st field is empty skip it, else if 2nd field empty skip it else do stuff. Im confused with this comparsion operators in autoit <> >= =< If ($input) == '' { echo 'dont do enything'; } else if ($input2) == '' { echo 'dont do nothing'; } else { echo 'do stuff'; } Edited November 17, 2014 by akira2891 Share this post Link to post Share on other sites
alienclone 24 Posted November 17, 2014 https://www.autoitscript.com/autoit3/docs/intro/lang_operators.htm If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results Share this post Link to post Share on other sites
akira2891 3 Posted November 17, 2014 This is so confused :/ So zero is threated like empty field as i saw, why then when i compare if field is greater than nothing i get this message "Field 1 empty !" so if field is empty or i put something in it give me message that is empty there is no operator like if ( !empty ) or if ( empty ) ? If GUICtrlRead($input1) > 0 Then Send("{ENTER}") Sleep(1000) Send(GUICtrlRead($input1)) Send("{ENTER}") Sleep(500) Else MsgBox(48, "Error", "Field 1 empty !") EndIf Share this post Link to post Share on other sites
alienclone 24 Posted November 17, 2014 i use ="" to represent empty If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results Share this post Link to post Share on other sites
akira2891 3 Posted November 17, 2014 ok thx now it works Share this post Link to post Share on other sites
water 2,359 Posted November 17, 2014 If you need to make sure that spaces are treated as empty as well I suggest: #include <StringConstants.au3> If StringStripWS(GUICtrlRead($input1), $STR_STRIPALL) = "" Then 1 akira2891 reacted to this My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
akira2891 3 Posted November 17, 2014 its a bit hard because im learning autoit, i know php but this is diferent especialy this comparsion operators like this for example // php if (!empty($var1)) { // if not empty // do stuff } // autoit If GUICtrlRead($input1) = "" Then ; how to check here if not empty Send("{ENTER}") Sleep(1000) Send(GUICtrlRead($input1)) Send("{ENTER}") Sleep(500) EndIf Share this post Link to post Share on other sites
alienclone 24 Posted November 17, 2014 If GUICtrlRead($input1) <> "" Then ; this should work If not GUICtrlRead($input1) = "" Then ; this may also work 1 akira2891 reacted to this If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results Share this post Link to post Share on other sites
akira2891 3 Posted November 17, 2014 Now works normal Func _msgSend() If Not GUICtrlRead($input1) = "" Then Send("{ENTER}") Sleep(1000) Send(GUICtrlRead($input1)) Send("{ENTER}") Sleep(500) EndIf If Not GUICtrlRead($input2) = "" Then Send("{ENTER}") Sleep(1000) Send(GUICtrlRead($input2)) Send("{ENTER}") Sleep(500) EndIf If Not GUICtrlRead($input3) = "" Then Send("{ENTER}") Sleep(1000) Send(GUICtrlRead($input3)) Send("{ENTER}") Sleep(500) EndIf EndFunc Share this post Link to post Share on other sites