AutoHotkey Community

It is currently May 26th, 2012, 3:10 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: first_line
PostPosted: April 11th, 2008, 6:56 pm 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
hello

here
http://www.autohotkey.com/docs/commands ... adFile.htm
it says
last_line := A_LoopReadLine

can I do first_line, second_line, etc as well?

I need to read specific lines from a file and store them in variables

thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2008, 7:00 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
FileReadLine?

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2008, 10:33 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1933
Location: Germany
User function to read lines from variables:
http://www.autohotkey.com/forum/viewtop ... t=readline


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 12th, 2008, 12:19 am 
Offline

Joined: April 17th, 2007, 1:37 pm
Posts: 761
Location: Florida
If parsing or reading a file line by line, you could also do...
Code:
If (A_Index = 1)
   Var1:=A_LoopField
If (A_Index = 3)
   Var3:=A_LoopField
If (A_Index = 4)
   Var4:=A_LoopField
If (A_Index = 231)
   Var231:=A_LoopField
Etc...

_________________
[Join IRC!]
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 12th, 2008, 4:28 am 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
Or..

Code:
FileRead, Con, File.txt
Loop, Parse, Con, `n
{
   FileReadLine, Line, File.txt, %A_Index%
   Var%A_Index% := A_LoopField
}


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: 0x150||ISO, Pulover and 18 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group