Hi I've been playing around with this and I'm noticing something strange (at least to me).
Please find my (working) code below.
The issue I'm having is, when I replace
If Instr(Value, Orderno)
with
if (Value := Orderno)
It only gives the value of the top row of the file with
if instr() included it skips through each line containing my searchstring,
like intended. However I don't want to use
instr because it would also give data when only inputting one digit.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
FileEncoding, UTF-8
InputBox, Orderno, Ordernumber, Ordernumber to find:
LineArray := [] ; start with an empty Array
Loop, read, orders_export.csv
{
LineNumber = %A_Index%
Loop, parse, A_LoopReadLine, CSV
LineArray[A_Index] := A_LoopField
For Index, Value In LineArray
{
If Instr(Value, Orderno) ; <--------------- IF CHANGE THIS, STUFF GOES WRONG
MsgBox, % "Ordernumber: " LineArray[1] "`nStatus: " LineArray[3] "`nSubtotal: " LineArray[9]
. "`nShipping " LineArray[10] "`nLineNumber " LineNumber
}
}