How to check for blank variables and FileAppend?

Get help with using AutoHotkey and its commands and hotkeys
bballjoe12
Posts: 102
Joined: 20 Aug 2017, 09:11

How to check for blank variables and FileAppend?

09 Feb 2018, 09:31

How do I check to see if any of the variables, Notes2, Notes3, and Notes 4 are blank, and if they are, to disregard the blank variable and every other blank variable after it?

Code: Select all

FileAppend,
		(
	
!%SecondKeyNotes%::Send %Notes%{Enter}%Notes2%{Enter}%Notes3%{Enter}%Notes4%
	 		
	), %A_MyDocuments%\Keyboard2.ahk
	
	MsgBox, 64, Attention, Double click on the file, "Keyboard" after the window opens.
	Gui, Notes: Destroy
	Run, %A_MyDocuments%
	Sleep 100
	
Return
			}
	else
			{
			FileAppend,
			(
%DHK%`r
!%SecondKeyNotes%::Send %Notes%{Enter}%Notes2%{Enter}%Notes3%{Enter}%Notes4%`r1
	
		), %A_MyDocuments%\Keyboard2.ahk
		
	MsgBox, 64, Attention, Double click on the file, "Keyboard" after the window opens.
	Gui, Notes: Destroy
	Run, %A_MyDocuments%
	Sleep 100
	
Return
Could I run a loop?
garry
Posts: 1511
Joined: 22 Dec 2013, 12:50

Re: How to check for blank variables and FileAppend?

09 Feb 2018, 10:11

for blank variables , see 'AND' .. 'OR' etc

Code: Select all

;a1:="x"   ;- not empty
a1:=""
a2:=""
if (a1="" and a2="")
  msgbox,both EMPTY
else
  msgbox,NOT both empty
return
bballjoe12
Posts: 102
Joined: 20 Aug 2017, 09:11

Re: How to check for blank variables and FileAppend?

09 Feb 2018, 10:18

I basically need it to come to a variable, if it's blank, to skip it, get rid of the 'Send {Enter} and continue the script.
BoBo
Posts: 2515
Joined: 13 May 2014, 17:15

Re: How to check for blank variables and FileAppend?

09 Feb 2018, 11:17

bballjoe12 wrote:I basically need it to come to a variable, if it's blank, to skip it, get rid of the 'Send {Enter} and continue the script.
Feel free to click on the commands that are given within the code box above to get further details. Good luck.
Odlanir
Posts: 274
Joined: 20 Oct 2016, 08:20

Re: How to check for blank variables and FileAppend?

09 Feb 2018, 14:03

Code: Select all

notes1 := "AA"
notes2 := "BBB"
notes3 := ""
notes4 := "CCCC"
notes5 := ""
notes6 := "ZZZ"

loop, 6
    str .= notes%a_index% = "" ? "" : notes%a_index% "{enter}"
if (str <> "" )
    send %str%
ExitApp
____________________________________________________________________________
Windows 7 Home Premium 64 bit - Autohotkey v1.1.24.02 64-bit Unicode
garry
Posts: 1511
Joined: 22 Dec 2013, 12:50

Re: How to check for blank variables and FileAppend?

09 Feb 2018, 14:13

@Odlanir , thank you , this really short

Return to “Ask For Help”

Who is online

Users browsing this forum: Doc16743, Elgin and 54 guests