AutoHotkey Community

It is currently May 26th, 2012, 9:27 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: September 21st, 2008, 10:54 am 
Offline

Joined: September 1st, 2008, 2:50 am
Posts: 56
I want to compare two txt files, one with a transaction number on the same line as the date like this....

Quote:
3417 21/09/2008

Test Item 1 5.00
_______
5.00
_______


and one with just the transaction number...

Quote:
3416


how can I make this code

Code:
FileReadLine, transactionNum1, c:\sa\currslip.txt, 14 ; reads 14th line currslip.txt
FileReadLine, transactionNum2, c:\sa\num.txt, 1 ; reads 1st line of num.txt

If (transactionNum1!=transactionNum2)
msgbox Number NOT the Same


Ignor the date on line 14?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2008, 11:12 am 
StringLeft

HTH
________________________________________________________
New here? Please, before you post...
1. Read the tutorial and try the examples. -> 2. Take a look at the command list to get an idea of what you could do. -> 3. Create your script. Consult the documentation and the FAQ if you get stuck. -> 4. Search the forum if you need help or examples, method 1 (forum), method 2 (site), method 3 (Google). -> 5. Post your code on the forum in the "Ask for Help" section if you still run into problems (but read this first). -> 6. There is more AHK on autohotkey.net and the Wiki and there is an AHK IRC chat.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2008, 11:50 am 
Offline

Joined: September 1st, 2008, 2:50 am
Posts: 56
Sorry, can you give me an example of how to insert that?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2008, 12:15 pm 
Code:
FileReadLine, transactionNum1, c:\sa\currslip.txt, 14 ; reads 14th line currslip.txt
FileReadLine, transactionNum2, c:\sa\num.txt, 1 ; reads 1st line of num.txt

StringLeft, transactionNum1, transactionNum1, 4 ; get the first 4 characters

If (transactionNum1!=transactionNum2)
msgbox Number NOT the Same

________________________________________________________
New here? Please, before you post...
1. Read the tutorial and try the examples. -> 2. Take a look at the command list to get an idea of what you could do. -> 3. Create your script. Consult the documentation and the FAQ if you get stuck. -> 4. Search the forum if you need help or examples, method 1 (forum), method 2 (site), method 3 (Google). -> 5. Post your code on the forum in the "Ask for Help" section if you still run into problems (but read this first). -> 6. There is more AHK on autohotkey.net and the Wiki and there is an AHK IRC chat.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2008, 12:20 pm 
Offline

Joined: March 23rd, 2005, 7:53 am
Posts: 321
Location: Germany
Or use stringSplit with %A_SPACE% as delimiter if the transaction number vary in its number of digits.

_________________
Hasso

Programmers don't die, they GOSUB without RETURN


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: iBob35555VR, tomoe_uehara, Yahoo [Bot] and 66 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