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
Create a true or false list based on a list of numbers
Create a true or false list based on a list of numbers
- Attachments
-
- Screenshot_4.png (8.31 KiB) Viewed 740 times
Re: Create a true or false list based on a list of numbers
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
Re: Create a true or false list based on a list of numbers
thanks a lot
it works
it works