get the numbers from a filenamem looking like 000234-cf.jpg

How can i get the numbers from this filename then divide it by 80.

What i need to do is this:

filename: 00234-cf.jpg
step 1:
delete the 00 < – not needed, and the -cf.jpg

step 2:
shoul dbe left with 234, not either do:
234/80 or
234%80 ← in java and other languages this returns the whole number and not the decimal.

so for example of this filename, the result hopefully should be:
234%80 = 2 <— not 2.95 as i dont want the .95

another example:

012345-af.jpg:
12345%80 = 154

01204-gy.jpg
1204/80 = 15

do you koow what i mean?? and can you help me???

cheers

Try this:

Jon

Here’s another way.

set f to "01205-gy.jpg"
my divide_filenum_by_80(f)

on divide_filenum_by_80(filename)
	set oldDelims to AppleScript's text item delimiters
	try
		set AppleScript's text item delimiters to {"-"}
		set num to (((text item 1 of filename) as number) / 80) div 1
		set AppleScript's text item delimiters to oldDelims
	on error
		set AppleScript's text item delimiters to oldDelims
	end try
	return num
end divide_filenum_by_80

– Rob