Ordneraktion -> bestimmten Dateityp öffnen

.maxx

.maxx

Aktives Mitglied
Thread Starter
Dabei seit
13.01.2005
Beiträge
514
Reaktionspunkte
128
Servus liebe Macuser,

ich benötige Hilfe bei folgendem Script:

Ich möchte, dass ein bestimmter Dateityp nach dem Download mit Safari in den Download Ordner sich mit dem Standardprogramm öffnet, und direkt nach dem öffnen sich löscht.

Das hier habe ich zusammengeschrieben und das Script als Ordneraktion angefügt. Das Problem dabei ist, dass es nicht funktioniert.
Code:
property fileTypes : {"NZB"}
property exts : {"nzb"}

on adding folder items to this_folder after receiving added_items
	tell application "Finder"
		repeat with an_Item in added_items
			if (file type of an_Item is in fileTypes) or (name extension of an_Item is in exts) then
				open an_Item
				tell application "Finder"
					move added_items to the trash
				end tell
			end if
		end repeat
	end tell
end adding folder items to

Bitte um hilfe.
 
...

Hallo .maxx,


Code:
...
repeat with an_Item in added_items
			if (file type of an_Item is in fileTypes) or (name extension of an_Item is in exts) then
				open an_Item
				tell application "Finder"
					move added_items to the trash
				end tell
			end if
		end repeat
...
Vorausgesetzt Deine Schleife funktioniert so:

Code:
repeat with i from 1 to number of items in added_items
			set an_Item to item i of added_items
end repeat
Die muss nicht unbedingt der Finder ausführen.

Bevor die Schleife abgearbeitet ist bewegst Du added_items schon in den Trash. An der Stelle wird aber an_Item bearbeitet.

Die Bedingung erscheint mir auch nicht richtig. file type und name extension ist in info of an_Item.

Also eher so:

Code:
... -- hier noch kein Finder
repeat with i from 1 to number of items in added_items
			set an_Item to item i of added_items
			set the item_info to the info for an_Item
			if ( the file type of the item_info is in the fileTypes) or (the name extension of the item_info is in the exts) then
				tell application "Finder"
...

Gruß Andi
 
ich denke du kannst nicht in einer repeat-schleife einfach so den container der die items enthält löschen..

und wieso willst du überhaupt alle added_items löschen nachdem du an_item geöffnet hast?

lösch doch nur den den du geöffnet hast - dann kann die repeat-loop weiterlaufen... bzw. beende die repeat loop nachdem du den letzten Eintrag gelöscht hast?

lg
Marc
 
sorry - zu langsam
 
Zurück
Oben Unten