Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'sorry, i assumed u would RTFC;-)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
sorry, i assumed u would RTFC;-)
Authored by: airdrummer on Jan 11, '07 05:40:22AM
replace this:
		set prefixName to ""
		if i < 1000 then
			set prefixName to "0" & prefixName
		end if
		if i < 100 then
			set prefixName to "0" & prefixName
		end if
		if i < 10 then
			set prefixName to "0" & prefixName
		end if
		set prefixName to prefixName & i & " - "
with my 1 liner...

i would also replace

		set alreadyNumbered to true
		repeat with j from 1 to 4
			if character j of oldPhotoName is not in {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} then
				set alreadyNumbered to false
			end if
		end repeat
		if (" - " is not (characters 5 thru 7 of oldPhotoName as string)) and not alreadyNumbered then
			set the name of item i of thePhotos to prefixName & oldPhotoName
			set renamedNumber to renamedNumber + 1
		end if
with
               try      -- resort to cli cuz a/s sux 4 pattern matching;-}
                    do shell script " echo "& quoted form of (oldPhotoName as string) & " | egrep '^[0-9]* - '"
			set the name of item i of thePhotos to prefixName & oldPhotoName
			set renamedNumber to renamedNumber + 1
		on error
                        -- dss throws exception when not found
                end try


[ Reply to This | # ]