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 

Compare Number but Ignore the Date

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



Joined: 01 Sep 2008
Posts: 56

PostPosted: Sun Sep 21, 2008 9:54 am    Post subject: Compare Number but Ignore the Date Reply with quote

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?
Back to top
View user's profile Send private message MSN Messenger
n-l-i-d
Guest





PostPosted: Sun Sep 21, 2008 10:12 am    Post subject: Reply with quote

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.
Back to top
artbasement



Joined: 01 Sep 2008
Posts: 56

PostPosted: Sun Sep 21, 2008 10:50 am    Post subject: Reply with quote

Sorry, can you give me an example of how to insert that?
Back to top
View user's profile Send private message MSN Messenger
n-l-i-d
Guest





PostPosted: Sun Sep 21, 2008 11:15 am    Post subject: Reply with quote

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.
Back to top
Hasso



Joined: 23 Mar 2005
Posts: 321
Location: Germany

PostPosted: Mon Sep 22, 2008 11:20 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
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