Hi,
I've a simple serial number database (really simple!), which stores the serial number itself with the number of times it can be used. Like this:
thisisatest123456,06,John Smith
0000ZZZZZZZZZZZZZ,05, Janet Jones
etc..
The list is stored in a simple text file (UTF-8 coding). My Applescript gets the serial number to test for using:
set numberFile to open for access list_path
set theNumbers to read numberFile
and
if theNumbers contains numberToCheck Then.... End If
to confirm the serial number's in the text file at all. Then, to get the activation times left I use:
set ActTimes to (offset of numberToCheck in theNumbers) + 18
My problem seems to be with this last line of code. Sometimes the offset works and sometimes it's out by +/- 1 so with some serial numbers my script tries to use ",0" and others it tries to use "5," as an activation count... I'm guessing that it's something to do with the encoding of the text file but I wonder if my lack of knowledge about Applescript is just at fault.
Could anyone shed any light? Thanks in advance!
I've a simple serial number database (really simple!), which stores the serial number itself with the number of times it can be used. Like this:
thisisatest123456,06,John Smith
0000ZZZZZZZZZZZZZ,05, Janet Jones
etc..
The list is stored in a simple text file (UTF-8 coding). My Applescript gets the serial number to test for using:
set numberFile to open for access list_path
set theNumbers to read numberFile
and
if theNumbers contains numberToCheck Then.... End If
to confirm the serial number's in the text file at all. Then, to get the activation times left I use:
set ActTimes to (offset of numberToCheck in theNumbers) + 18
My problem seems to be with this last line of code. Sometimes the offset works and sometimes it's out by +/- 1 so with some serial numbers my script tries to use ",0" and others it tries to use "5," as an activation count... I'm guessing that it's something to do with the encoding of the text file but I wonder if my lack of knowledge about Applescript is just at fault.
Could anyone shed any light? Thanks in advance!