Renumbering

Need some help & new to this site.
I have Mac OS 9.1, I have been tring to figure out how to re number the following files with
out changing the naming convention using a droplet.

BHMGZ080305.58
BHMGZ080305.59
BHMGZ080305.60

I want to change BHMGZ080305.58 to BHMGZ080305.70 then change BHMGZ080305.59 to BHMGZ080305.71
this way its in sequential order.
The BHMGZ is the name, the 080305 is the date & .58 is a page number.
Thanks MAXJR

I’m running Tiger, but i think this will work.

--tell application "Finder" to set aliasListOfFiles to (get selection)
on open aliasListOfFiles
	repeat with i from 1 to number of items in aliasListOfFiles
		set this_item to (item i of aliasListOfFiles)
		tell application "Finder"
			set nom to name of this_item
		end tell
		set noml to textToList(nom, ".")
		set noml2 to (item 2 of noml) as number
		set item 2 of noml to (noml2 + 2)
		set newnom to ""
		repeat with i from 1 to number of items in noml
			set this_item2 to item i of noml
			if i is not 1 then
				set newnom to (newnom & "." & this_item2) as string
			else
				set newnom to (this_item2) as string
			end if
		end repeat
		tell application "Finder" to set name of this_item to newnom
	end repeat
end open

on set_item_name(this_item, new_item_name)
	tell application "Finder"
		--activate
		set the parent_container_path to (the container of this_item) as text
		if not (exists item (the parent_container_path & new_item_name)) then
			try
				set the name of this_item to new_item_name
			on error the error_message number the error_number
				if the error_number is -59 then
					set the error_message to "This name contains improper characters, such as a colon (:)."
				else --the suggested name is too long
					set the error_message to error_message -- "The name is more than 31 characters long."
				end if
				--beep
				tell me to display dialog the error_message default answer new_item_name buttons {"Cancel", "Skip", "OK"} default button 3
				copy the result as list to {new_item_name, button_pressed}
				if the button_pressed is "Skip" then return 0
				my set_item_name(this_item, new_item_name)
			end try
		else --the name already exists
			--beep
			tell me to display dialog "This name is already taken, please rename." default answer new_item_name buttons {"Cancel", "Skip", "OK"} default button 3
			copy the result as list to {new_item_name, button_pressed}
			if the button_pressed is "Skip" then return 0
			my set_item_name(this_item, new_item_name)
		end if
	end tell
end set_item_name

on textToList(theText, theSep)
	set soFar to {}
	set textSoFar to theText
	repeat until theSep is not in textSoFar
		set thePos to the offset of theSep in textSoFar
		set thenewPos to thePos
		if thenewPos is 1 then set thenewPos to 2
		set nextBit to text 1 through (thenewPos - 1) of textSoFar
		if textSoFar is not theSep then
			set textSoFar to text (thePos + (count of text items in theSep)) through -1 of textSoFar
			copy nextBit to the end of soFar
		else
			set textSoFar to ""
		end if
	end repeat
	copy textSoFar to the end of soFar
	return soFar
end textToList

Thanks,
I do have a problem I dropped in a folder & got an error message saying “Cant get Item {folder name}”
them prompted me to edit this line “set noml2 to (item 2 of noml) as number” & number was highlighted. Can you help…

MAXJR

try selecting a bunch of files and dropping them in

Thanks themacgeek, that worked but I still have one small problem, you see if I have a multiple of files for example
A.2
A.3
A.4
it tells me that page A.4 already exist. Thanks for you patients.

MAXJR

garsh, sometimes i amaze even myself…

--tell application "Finder" to set aliasListOfFiles to (get selection)
on open aliasListOfFiles
	--set foldersource to container of (item 1 of (get selection))
	set ih to 0
	set noi to number of items in aliasListOfFiles
	repeat until (noi is ih)
		set ih to (ih + 1)
		--display dialog noi & " " & ih as text
		--repeat with i from 1 to number of items in aliasListOfFiles
		set this_item to (item ih of aliasListOfFiles)
		tell application "Finder"
			set nom to name of this_item
		end tell
		set noml to textToList(nom, ".")
		set noml2 to (item 2 of noml) as number
		set item 2 of noml to (noml2 + 2)
		set newnom to ""
		repeat with i from 1 to number of items in noml
			set this_item2 to item i of noml
			if i is not 1 then
				set newnom to (newnom & "." & this_item2) as string
			else
				set newnom to (this_item2) as string
			end if
		end repeat
		try
			tell application "Finder" to set name of this_item to newnom
		on error
			set end of aliasListOfFiles to this_item
			set noi to noi + 1
		end try
	end repeat
end open

on set_item_name(this_item, new_item_name)
	tell application "Finder"
		--activate
		set the parent_container_path to (the container of this_item) as text
		if not (exists item (the parent_container_path & new_item_name)) then
			try
				set the name of this_item to new_item_name
			on error the error_message number the error_number
				if the error_number is -59 then
					set the error_message to "This name contains improper characters, such as a colon (:)."
				else --the suggested name is too long
					set the error_message to error_message -- "The name is more than 31 characters long."
				end if
				--beep
				tell me to display dialog the error_message default answer new_item_name buttons {"Cancel", "Skip", "OK"} default button 3
				copy the result as list to {new_item_name, button_pressed}
				if the button_pressed is "Skip" then return 0
				my set_item_name(this_item, new_item_name)
			end try
		else --the name already exists
			--beep
			tell me to display dialog "This name is already taken, please rename." default answer new_item_name buttons {"Cancel", "Skip", "OK"} default button 3
			copy the result as list to {new_item_name, button_pressed}
			if the button_pressed is "Skip" then return 0
			my set_item_name(this_item, new_item_name)
		end if
	end tell
end set_item_name

on textToList(theText, theSep)
	set soFar to {}
	set textSoFar to theText
	repeat until theSep is not in textSoFar
		set thePos to the offset of theSep in textSoFar
		set thenewPos to thePos
		if thenewPos is 1 then set thenewPos to 2
		set nextBit to text 1 through (thenewPos - 1) of textSoFar
		if textSoFar is not theSep then
			set textSoFar to text (thePos + (count of text items in theSep)) through -1 of textSoFar
			copy nextBit to the end of soFar
		else
			set textSoFar to ""
		end if
	end repeat
	copy textSoFar to the end of soFar
	return soFar
end textToList

:D----awsome----:D, thanks for all your help you can’t imagine how much this is going to help me—best regards.

MAXJR—:lol: