Droplet zum Dateien ablegen

S

swaino

Neues Mitglied
Thread Starter
Dabei seit
28.04.2013
Beiträge
15
Reaktionspunkte
0
Hey Community,

Ich möchte gerne ein Droplet erstellen, mit dem ich Dateien in vorher ausgewählte Ordner ablegen kann.
(Das ganze sollte so funktionieren, dass ich die Datei auf die App ziehe und ich dann per Button zwischen verschiedenen Zielordnern wählen kann.)

Danke schonmal,
swaino

...Vielleicht kann mir auch noch jemand erklären wie man Droplets genau erstellt.
Befasse mich noch nicht so lange mit ihnen.
 
Hallo swaino,

für ein Droplet brauchst Du einen open Handler z.B.

Code:
on open droppedItems
	display dialog "Datei verschieben nach..." buttons {"Bilder", "Filme", "Dokumente"}
	if button returned of result is "Bilder" then
		set destinationPath to (path to pictures folder) as alias
	else if button returned of result is "Filme" then
		set destinationPath to (path to movies folder) as alias
	else if button returned of result is "Dokumente" then
		set destinationPath to (path to documents folder) as alias
	end if	
	repeat with anItem in droppedItems
		tell application "Finder"
			move file anItem to folder destinationPath
		end tell
	end repeat
end open

Gruß Andi
 
Hi Andi,

Da hatte ich wohl ein bisschen zu kompliziert gedacht.
Danke für deine Hilfe.

Gruß swaino
 
Jetzt hab ich aber noch ein Problem.
Wie kann ich andere Ordner verwenden??
Ich hab alles dem neuen Ordner entsprechend ausgetauscht aber es funktioniert nicht!?
 
Hallo swaino,

... Ich hab alles dem neuen Ordner entsprechend ausgetauscht aber es funktioniert nicht!?

wenn es nicht funktioniert hast Du vermutlich etwas falsch gemacht.

Gruß Andi
 
Hallo Andi,

Wenn ich manche Ordner ersetze dann kommt das bei raus:

Code:
on opendroppedItems    
display dialog "Datei verschieben nach..." buttons {"Dropbox", "Schreibtisch", "Dokumente"}
    if button returned of result is "Dropbox" then
        set destinationPath to (path to dropbox folder) as alias
    else if button returned of result is "Schreibtisch" then
        set destinationPath to (path to Finder folder) as alias
    else if button returned of result is "Dokumente" then
        set destinationPath to (path to documents folder) as alias
    end if
    repeat with anItem in droppedItems
        tell application "Finder"
            movefileanItemtofolderdestinationPath
        end tell
    end repeat
end open

...allerdings funktioniert das nicht.
Warum?

Gruß swaino
 
Weil es dropbox folder und Finder folder nicht gibt. Stattdessen musst du den Pfad angeben:

folder "Dropbox" of home

Für den Schreibtisch gibt es bereits die Variable desktop
 
Danke.
Und wie binde ich das ganze dann in das Droplet ein?
 
Zurück
Oben Unten