Find missing in line
6/12/2009on open these
set AppleScript's text item delimiters to ""
set numberlist to {}
repeat with this in these
tell application "Finder"
set numberlist to numberlist & (((characters 1 through 3 of (name of this as text)) as text) as integer)
end tell
end repeat
set new_list to simple_sort(numberlist)
set missing_ to ""
display dialog ((item 1 of new_list) as integer)
repeat with i from ((item 1 of new_list) as integer) to ((last item of new_list) as integer)
if numberlist does not contain i then
set missing_ to missing_ & i & return
end if
end repeat
if missing_ ≠ "" then
set the clipboard to missing_ as text
display dialog "Es fehlen welche"
else
display dialog "Alles da!"
end if
end open
on simple_sort(the_list)
set old_delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {ASCII character 10} -- always a linefeed
set list_string to (the_list as string)
set new_string to do shell script "echo " & quoted form of list_string & " | sort -fn"
set new_list to (paragraphs of new_string)
set AppleScript's text item delimiters to old_delims
return new_list
return the the_list
end simple_sort