Create a true or false list based on a list of numbers

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
way2000
Posts: 58
Joined: 15 Jul 2016, 08:57

Create a true or false list based on a list of numbers

23 Apr 2018, 10:26

i have a list of numbers and based on the difference of amounts i have to create a corresponding true or false list

the first number is always True
any number (on the entire list of numbers) that is lower than the first number is always True
any number higher than the previous number is False
there should be 2 files, source (numbers list) and result (to create a true or false) list


source.txt
0.00001698
0.00001602
0.00002157
0.00001079
0.00001476
0.00001827
0.00001042
0.00001021

results.txt
True
True
False
True
True
False
True
True
Attachments
Screenshot_4.png
Screenshot_4.png (8.31 KiB) Viewed 742 times
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Create a true or false list based on a list of numbers

23 Apr 2018, 11:33

Code: Select all

#SingleInstance,Force
SetWorkingDir,%A_ScriptDir%
Input_Array:=[]
IfExist, source.txt
	{
		FileRead,temp,source.txt
		Loop,Parse,temp,`n
			Input_Array[A_Index]:=A_LoopField
	}
else
	{
		msgbox, file does not exist.`n`nScript will now exit
		ExitApp
	}
FileDelete,results.txt
Loop,% Input_array.Length()
	{
		if(A_Index=1||Input_array[A_Index]<=Input_Array[1]||Input_array[A_Index]<=Input_Array[A_Index-1])
			FileAppend,True`n,results.txt
		else
			FileAppend,False`n,results.txt		
	}
msgbox, Done
ExitApp



*esc::ExitApp

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AHKScriptingTest and 335 guests