I'm really struggling with below code, perhaps someone can help me out ?
What is the correct syntax to show the country on the first line of the examples text (Utopia) ??
If you want to test the code, please copy below text to clipboard and then press CTRL-1, after it finishes, press CTRL-2
I'm struggling with this part:
Code: Select all
MsgBox(SplitLines.No[8]) ; this shows Btopia< the last line of the text how do I get the value of the line above it ?
MsgBox(SplitLines2[8]) ; I thought this should work, but it doesn't. What is the mistake ??
full code
Code: Select all
;========================================================================
#Requires AutoHotkey v2.0
;========================================================================
;;;;;;;;;;;;;;;;;;PLEASE CODE BELOW TEXT AND THEN RUN THE CODE AND PRESS CTRL-1, AFTER IT'S FINISHED PRESS CTRL-2;;;;;;;;;;;;;;;;;;
/*
Interne ID document Klant-/leveranciersnaam Provincie Gebouw Straat Postcode Plaats Land Artikelnummer Naam in vreemde taal Hoeveelheid Regeltotaal EUR Regeltotaal (VV) Prijsvaluta Gewicht 1 Documentnummer HS-Number Land van herkomst
953012 Kevin Baker 20 Riverbend Rd. 12345 FairyTale City Utopia PS6 PlayStation 6 1,00 68,16 72,00 USD 1,4700 5772440 4820105000 China
953012 Kevin Baker 20 Riverbend Rd. 12345 FairyTale City BUtopia P Packing and delivery 1,00 27,45 29,00 USD 0,1000 5772440
*/
;;;;;;;;;;;;;;;;;;PLEASE CODE BELOW TEXT AND THEN RUN THE CODE AND PRESS CTRL-1, AFTER IT'S FINISHED PRESS CTRL-2;;;;;;;;;;;;;;;;;;
DHL_Data_Lines := []
SplitLines := []
No := 1
^1::
{
global
if !InStr(A_Clipboard, "Interne ID document") ; Clipboard must contain the text "Interne ID document, otherwise reload the script"
Reload
else
{
DHL_Data_Lines := StrSplit(A_Clipboard, "`n") ; store each line in the an array
Loop DHL_Data_Lines.Length
{
if (DHL_Data_Lines[A_Index]) != ""
{
SplitLines.No := StrSplit(DHL_Data_Lines[A_Index], A_Tab)
}
else
{
DHL_Data_Lines.RemoveAt(A_Index) ; remove line from array if it's empty (not sure if working)
}
Sleep 2000
Test := SplitLines.No[8]
ToolTip("Test :=" . Test)
No++
}
}
;SplitLines.No := StrSplit(DHL_Data_Lines[1], A_Tab)
Goto MyLabel
MyLabel:
;MsgBox("No := " . No "-" . SplitLines2[4])
;MsgBox(SplitLines.2[3])
return
}
^2::
{
if !InStr(A_Clipboard, "Interne ID document") ; Clipboard must contain the text "Interne ID document, otherwise reload the script"
Reload
MsgBox(SplitLines.No[8]) ; this shows Btopia< the last line of the text how do I get the value of the line above it ?
MsgBox(SplitLines2[8]) ; I thought this should work, but it doesn't. What is the mistake ??
}
ESC::Reload