I have some code to increment a number in a text field by 1
but when i try and have say
001
in the txt originally and i +1 the number doesn’t go
002 but 101
the code is:
set DVDNumber to read file "Shared G4 HD:Users:karrenmay:Desktop:from CD/DVD - uploaded:DVD's:DVDIncrementNumber.txt"
set nxtDVD to DVDNumber
set nxtDVD to ((DVDNumber) + 1)
------
my incrementFile("" & nxtDVD & "", "Shared G4 HD:Users:karrenmay:Desktop:from CD/DVD - uploaded:DVD's:DVDIncrementNumber.txt", true)
on incrementFile(thisdata, targetfile, appenddata)
try
set the targetfile to the targetfile as text
set the opentargetfile to ¬
open for access file targetfile with write permission
if appenddata is false then ¬
set eof of the opentargetfile to 0
write thisdata to the opentargetfile --starting at eof
close access the opentargetfile
return true
on error
try
close access file targetfile
end try
return false
end try
end incrementFile
I cant seem to bedugg it, have tried a fair few things.