コピーしたExcelデータを配列に入れる例を次に示します。
MyClipBoard=%ClipBoard% ; Remove any non-text (format) data
Loop, parse, MyClipBoard, `n,`r ; Place Excel content from clipboard in 2 dimentional Array
{ ; Start-Loop Read through each Line (record) in the ClipBoard data from Excel
FullRecord:=A_LoopField ; Put a whole row in the variable FullRecord
RecordNumber:=A_Index ; Store the current record (row) number.
Loop, parse, FullRecord, %A_Tab% ; Parse the row content (FullRecord) in separate fields
{ ; Start-Loop Read through each Field in the ClipBoard data from Excel
FieldNumber:=A_Index ; Store the current Field number.
Array%RecordNumber%_%FieldNumber% := A_LoopField ; Array1_1 is Excel Row 1 column A, Array1_2 = Excel Row 1 column B
} ; End-Loop Read through each Field in the ClipBoard data from Excel
} ; End-Loop Read through each Line (record) in the ClipBoard data from Excel
あなたがあなたを動かすためにもっと多くの例が必要な場合は、私に知らせてください。
OKここにいくつかの例があります。Variable+=1の代わりにVariable++を使用するなど、他の回答の例を見ると、これをクリーンアップできます。
; Read data from text file into one dimentional Array
ArrayCount = 0
Loop, Read, %A_ScriptDir%\SearchTerms.txt ; This loop retrieves each line from the file, one at a time.
{
ArrayCount += 1 ; Keep track of how many items are in the array.
Array%ArrayCount% := A_LoopReadLine ; Store this line in the next array element.
}
TextCounter = 1
IniWrite, %TextCounter%, C:\Temp\SearchTerms.ini, Counter, Nr ; Write counter in ini so I can restart at latest counter
SearchText:= Array1 ; Put data from Array1 into variable SearchText
MouseClick, left
Send, %SearchText%{Enter}
SplashTextOn, 200, 20,Searchterm,F%TextCounter% %SearchText%
WinMove, Searchterm, , , 0
Return
Browser_Favorites::
IniRead, TextCounter, C:\Temp\SearchTerms.ini, Counter, Nr ; Read latest counter
TextCounter += 1
IniWrite, %TextCounter%, C:\Temp\SearchTerms.ini, Counter, Nr
SearchText:=Array%TextCounter% ; Put data from Array+number into variable SearchText
; Examples with Array of 2 deep.
MyClipBoard=%ClipBoard% ; Remove any non-text (format) data
Loop, parse, MyClipBoard, `n,`r ; Place Excel content from clipboard in 2 dimentional Array
{ ; Start-Loop Read through each Line (record) in the ClipBoard data from Excel
FullRecord:=A_LoopField ; Put a whole row in the variable FullRecord
RecordNumber:=A_Index ; Store the current record (row) number.
Loop, parse, FullRecord, %A_Tab% ; Parse the row content (FullRecord) in separate fields
{ ; Start-Loop Read through each Field in the ClipBoard data from Excel
FieldNumber:=A_Index ; Store the current Field number.
Array%RecordNumber%_%FieldNumber% := A_LoopField ; Array1_1 is Excel Row 1 column A, Array1_2 = Excel Row 1 column B
} ; End-Loop Read through each Field in the ClipBoard data from Excel
} ; End-Loop Read through each Line (record) in the ClipBoard data from Excel
DLCounter:=1
DLSub:=1
DLData:=Array%DLCounter%_1
While (DLData <> "")
{
While (DLData <> "")
{
MsgBox, %DLData%
DLSub += 1
DLData:=Array%DLCounter%_%DLSub%
}
DLSub:=1
DLCounter += 1
DLData:=Array%DLCounter%_%DLSub%
}
Return
これは最もクリーンなコードではないかもしれませんが、何ができるかがわかります。