AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Parser

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
w00tstick
Guest





PostPosted: Thu Oct 22, 2009 3:49 am    Post subject: Parser Reply with quote

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

PostPosted: Thu Oct 22, 2009 3:51 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
w00tstick
Guest





PostPosted: Thu Oct 22, 2009 4:19 am    Post subject: Reply with quote

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

PostPosted: Thu Oct 22, 2009 4:30 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Guest






PostPosted: Thu Oct 22, 2009 4:58 am    Post subject: Reply with quote

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





PostPosted: Sun Oct 25, 2009 12:05 am    Post subject: Thanks Reply with quote

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

PostPosted: Sun Oct 25, 2009 10:54 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group