 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Wed Mar 12, 2008 5:42 am Post subject: Read line after A_LoopReadLine |
|
|
Can anyone help me out here? Im trying to read the contents of the line after A_LoopReadLine into a variable. Ive tried dozens of variations to no avail. The IfInString works fine and displays the "constant" line text, the text I want is below that line and is "variable"
| Code: |
IfInString, A_LoopReadLine, cust_ord_t col2 col3
{
Out13 = %A_LoopReadLine%
}
|
Here's a few things I have tried :
| Code: |
Out13 := %A_LoopReadLine% ++
Out13 := %A_LoopReadLine% + 1
A_LoopReadLine ++
A_Index ++
|
Thanks
Matt |
|
| Back to top |
|
 |
Lurker1457
Joined: 10 Mar 2008 Posts: 11
|
Posted: Wed Mar 12, 2008 7:35 am Post subject: |
|
|
AFAIK, there is no mechanism to force a file read loop or a parsing loop to take the next line (aside from 'waiting' until the next iteration).
Is there a problem with storing the current line in a variable at the end of the loop block so you can check the previous line as you progress through the file? |
|
| Back to top |
|
 |
BoBoĻ Guest
|
Posted: Wed Mar 12, 2008 9:25 am Post subject: |
|
|
Is that file using `r (Unix) or `n (Mac) instead of `n`r (PC) ?
There's no 'below' a line bc this is the next line, right?
Can you provide a part/excerpt of your file (or for download)? |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Mar 12, 2008 2:47 pm Post subject: |
|
|
@Lurker-
Nope, I have no problem using whatever method works. Since Im going by IfInString though and not A_Index, Im not sure how I would tell it to pick that specific line still.
@Bobo-
The file is acually stored in the clipboard on a windows machine, originally from an outlook email attachment. Here is the sample:
| Code: |
CUST_ORD_TYPE SHIP QTY SPANISH PROG
cust_ord_t col2 col3
001 1943 285 ;This is the first line I want
0012 567 0 ;This is the second line I want
RETAIL FULFILLMENT BREAKOUT
D => Direct Retail
I => Indirect Retail
cust_ord_t cust_t col3
0012 D 567
|
Thanks |
|
| Back to top |
|
 |
BoBoĻ Guest
|
Posted: Wed Mar 12, 2008 3:10 pm Post subject: |
|
|
| Code: | Content =
(
CUST_ORD_TYPE SHIP QTY SPANISH PROG
cust_ord_t col2 col3
001 1943 285 ;This is the first line I want
0012 567 0 ;This is the second line I want
RETAIL FULFILLMENT BREAKOUT
D => Direct Retail
I => Indirect Retail
cust_ord_t cust_t col3
0012 D 567
)
MsgBox % Content
Loop, Parse, Content,`n`r
If A_Index in 3,4
Line%A_Index% := A_LoopField
MsgBox, % Line3 "`n" Line4 |
|
|
| Back to top |
|
 |
Guest
|
Posted: Wed Mar 12, 2008 9:07 pm Post subject: |
|
|
Im still not sure how to get that section of the clipboard isolated. This section Im having problems with occurs 1/2 to 3/4 of the way through the email depending on the length of the email. Sometimes the email is 10 pages, and sometime 25 so pretty unpredictable. Im also outputting other chunks from the email/clipboard to display in the same MsgBox, I think I may just scrap the idea though.
| Code: |
^h::
ClipWait
FileAppend, %Clipboard%, C:\Clip.tmp
Loop, Read, C:\Clip.tmp,
{
IfInString, A_LoopReadLine, PHONE Tot Accessory
{
Out1 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, ACCS Tot Accessory
{
Out2 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, BULK Tot Accessory
{
Out3 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, BO Tot Accessory
{
Out4 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, BO Tot Accessory
{
Out5 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, ACCESSORY ONLY UPS
{
Out6 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, ACCESSORY ONLY USPS
{
Out7 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, COLLATERAL ONLY UPS
{
Out8 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, COLLATERAL ONLY USPS
{
Out9 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, PHONE Tot Collateral
{
Out10 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, BULK Tot Collateral
{
Out11 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, Tot Collateral
{
Out12 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, cust_ord_t col2 col3
{
IfInString, A_LoopReadLine, 001
{
Out13 = %A_LoopReadLine%
}
}
IfInString, A_LoopReadLine, 0012
{
Out14 = %A_LoopReadLine%
}
IfInString, A_LoopReadLine, NDP-091-001 ,
{
Out15 = %A_LoopReadLine%
}
}
MsgBox, %Out1% `n %Out2% `n %Out3% `n %Out4% `n %Out5% `n %Out6% `n %Out7% `n %Out8% `n %Out9% `n %Out10% `n %Out11% `n %Out12% `n %Out13% `n %Out14% `n %Out15%
FileDelete, C:\Clip.tmp
^k::
Reload
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|