Find missing in line

War mal als Erweiterung für den Episode-Namer gedacht... Damit man bei 200 Episoden noch die findet, die einem fehlt... Geht so wie es aussieht, davon aus, dass der Name jeder Datei mit einer 3-stelligen Zahl anfängt... man zieht einfach die Dateien auf das AppleScript-Droplet und es sagt einem, welche Zahlen in der Reihe fehlen....
Code zum markieren einmal anklicken Code im Skript-Editor öffnen

on 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

This entry was posted in Finder and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CAPTCHA:


+ three = 12

Subscribe without commenting

  • Seite übersetzen:


    Paypal for Pizza:




  • Kategorien


  • Letzte Kommentare

    • Niklas: Vielen Vielen Dank! So klappt es!
    • hubi: Servus Niklas, ich habe mir den Quellcode noch einmal angesehen und habe nun unter 10.7.3 einen Weg gefunden...
    • Niklas: Klingt super das Script. Leider bekomm ich immer folgende Fehlermeldung: error “„Mail“ hat einen Fehler...
    • Jürgen: Hallo Hubi, beim Abfragen von Kennworten gibt es noch eine böse Falle: Das Format, in dem security antwortet,...
    • hubi: Am einfachsten Du öffnest im AppleScript-Editor mal das Funktionsverzeichnis (unter Ablage) von iTunes. Ein...