CDs/DVDs automatisch nach dem Einlegen kopieren und auswerfen

Ich sichere gerade meine gesammelten DVDs/CDs auf meinem NAS und das sind so ca. 200.Alle von Hand zu kopieren ist nicht nur nervig, sonder kostet auch viel Zeit, da ich nicht immer gleich mitbekommen, wenn ein Kopiervorgang fertig ist.Deshalb habe ich eine Ordner-Aktion geschrieben, die ich an den unsichtbaren "Volumes" Ordner angehängt habe. Sobald nun ein neues Medium eingelegt wird, wird dieses nach einem kurzen Dialog mit Timeout auf das NAS kopiert und anschließend ausgeworfen.Hier zunächst einmal der Code:  
Code zum markieren einmal anklicken

--Folder action to copy contents of inserted media to some other place...

on adding folder items to this_folder after receiving these_items

try

tell application "Finder"

set b to POSIX path of ((original item of alias file "COPYALIAS" of startup disk) as alias)

end tell

repeat with this_ in these_items

tell application "Finder"

display dialog ("copy " & (name of this_) & "?") as text giving up after 3

set itemname to name of this_

set copypath to (original item of alias file "COPYALIAS" of startup disk)

set a to POSIX path of this_

--set a to (characters 1 through -2 of a) as text

end tell

set bb to checkname_now_suffix(itemname, copypath, false)

do shell script "cp -R " & quoted form of a & " " & quoted form of b & quoted form of bb

tell application "Finder"

eject this_

end tell

end repeat

on error msg

tell application "Finder"

activate

display dialog msg

end tell

end try

end adding folder items to


on checkname_now_suffix(n, D, looped)

tell application "Finder"

set thefiles to name of every item of D

end tell

if thefiles contains n then

if looped = false then

set n to n & " 1"

else

set cc to count of every character of last word of n

set cn to ((last word of n) as integer) + 1

set n to ((characters 1 through (-1 * (cc + 1)) of n) as text) & cn

checkname_now_suffix(n, D, counter, true)

end if

else

return n

end if

end checkname_now_suffix


Man zieht einen Alias von dem Zielverzeichnis direkt auf das Start-Volumen und nennt ihn "COPYALIAS" so weiss das Skript, wohin kopiert werden soll.
This entry was posted in AppleScript 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:


six − 3 =

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...