 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
w00tstick Guest
|
Posted: Thu Oct 22, 2009 3:49 am Post subject: Parser |
|
|
I need help making a parser from a CSV file.
For instance.
This is the data that I would want to parse out.
12,312,123,,,345
The Parser would do something like this.
Row A = 12
Row B = 312
Row C = 123
Row D = N/A
Row E = N/A
Row F = 345
Thanks. |
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Thu Oct 22, 2009 3:51 am Post subject: |
|
|
Check the manual: FileRead / Loop / File-reading Loop _________________ "Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried."
Antonio França
My stuff: Google Profile |
|
| Back to top |
|
 |
w00tstick Guest
|
Posted: Thu Oct 22, 2009 4:19 am Post subject: |
|
|
My mistake. I don't actually want to READ a file. I want to copy and paste data that is delimited by commas and parse it out. Like if I copied the text
12,312,123,,,345
into a box. It would at that time parser it out or store it in a hotkey. |
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Thu Oct 22, 2009 4:30 am Post subject: |
|
|
It's all in the manual.
- Clipboard
- Loop (parse)
- Send _________________ "Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried."
Antonio França
My stuff: Google Profile |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Oct 22, 2009 4:58 am Post subject: |
|
|
Here's a simple example to study along with links from MasterFocus: | Code: | letters = ABCDEFGHIJKLMNOPQRSTUMWXYZ
StringSplit, letter, letters
Loop, Parse, ClipBoard, `,
data .= "Row " letter%A_Index% " = " (A_LoopField ? A_LoopField : "N/A") "`n"
MsgBox, %data% |
|
|
| Back to top |
|
 |
W00tstick Guest
|
Posted: Sun Oct 25, 2009 12:05 am Post subject: Thanks |
|
|
I appreciate the practice code. One last question on it. I haven't added much to it. But here I go.
This is what I have
| Code: | letters = ABCDEFGHIJKLMNOPQRSTUMWXYZ
StringSplit, letter, letters
Loop, Parse, ClipBoard, `,
data .= "Row " letter%A_Index% " = " (A_LoopField ? A_LoopField : "N/A") "`n"
Sendinput %data% |
When I copy something like this:
| Quote: | | STOP,00270103,0x0001003B09ECC1C4,1991967974 |
This is the result I get when I type test1.
| Quote: |
Row A = STOP
Row B = 00270103
Row C = 0x0001003B09ECC1C4
Row D = 1991967974
|
I want to do 2 things to this.
One I want to alter row's to different names like
| Quote: |
Timer = STOP
Switch = 00270103
Hex = 0x0001003B09ECC1C4
Number = 1991967974
|
And second I want to only display certain rows that I want.
Like
| Quote: |
Timer = STOP
Hex = 0x0001003B09ECC1C4
|
Any help is appreciated. Thanks. |
|
| Back to top |
|
 |
SpiderGames
Joined: 09 Jun 2008 Posts: 936 Location: Canada
|
Posted: Sun Oct 25, 2009 10:54 am Post subject: |
|
|
| Code: |
Lables = Timer,Switch,Hex,Number
StringSplit,lable,lables,`,
Loop, Parse, ClipBoard, `,
data .= lable%A_Index% " = " (A_LoopField ? A_LoopField : "N/A") "`n"
Msgbox, % data
|
With input...
| Code: |
Lables = Timer,Switch,Hex,Number
StringSplit,lable,lables,`,
Loop, Parse, ClipBoard, `,
data .= lable%A_Index% " = " (A_LoopField ? A_LoopField : "N/A") "`n"
SendInput, % data
|
_________________
I know i have 6 legs. It's cuz I'm special. |
|
| 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
|