Wo liegt hier der Fehler

master07

master07

Aktives Mitglied
Thread Starter
Dabei seit
10.10.2006
Beiträge
330
Reaktionspunkte
3
Hi Leute,

habe ein Skript, das mir alle Bilder eines Ordners automatisch skalieren soll auf 80%.

Es kommt aber immer folgende Meldung:
Code:
Expected end of line, etc. but found identifier.

Wo liegt hier der Fehler:
Code:
set this_folder to (choose folder with prompt "Pick the folder containing the images to process:") as string
tell application "System Events"
	set these_files to every file of folder this_folder whose name does not start with "." and (file type is "TIFF" or file type is "JPEG" or name extension is "tiff" or name extension is "tif" or name extension is "jpeg" or name extension is "jpg")
end tell
repeat with i from 1 to the count of these_files
	set this_file to (item i of these_files as alias)	
	tell application "Image Capture Scripting"
		set this_file to open 

		scale this_file by factor 0.8 --[COLOR="Red"]HIER MARKIERT ER MIR DEN FEHLER[/COLOR]
		save this_file in 

		close this_file
	end tell
end repeat
 
Hallo,

Code:
set this_folder to (choose folder with prompt "Pick the folder containing the images to process:") as string
tell application "System Events"
	set these_files to every file of folder this_folder whose name does not start with "." and (file type is "TIFF" or file type is "JPEG" or name extension is "tiff" or name extension is "tif" or name extension is "jpeg" or name extension is "jpg")
end tell
repeat with i from 1 to the count of these_files
	set this_file to (item i of these_files as alias)
	try
		tell application "Image Events"
			launch
			set this_image to open this_file
			scale this_image by factor 0.8
			save this_image with icon
			close this_image
		end tell
	on error error_message
		close this_image
		display dialog "Fehler"
	end try
end repeat

Viele Grüße
 
Zuletzt bearbeitet:
Ich habe noch ein paar Kleinigekeiten korregiert.
"Finder" ist die bessere Applikation, als "System Events" in diesem Fall ;-)

Code:
set fileListe to {"JPEG", "TIFF"}
set endungLsite to {"jpeg", "jpg", "tif", "tiff", "bmp", "gif"}

set this_folder to (choose folder with prompt "Ordner auswählen:") as string
tell application "Finder"
	set these_files to every file of folder this_folder whose name does not start with "." and (file type is in the fileListe or name extension is in the endungLsite)
end tell
repeat with i from 1 to the count of these_files
	set this_file to (item i of these_files as alias)
	try
		tell application "Image Events"
			launch
			set this_image to open this_file
			scale this_image by factor 0.8
			save this_image with icon
			close this_image
		end tell
	on error error_message
		close this_image
		display dialog "Fehler"
	end try
end repeat

Viel Erfolg!
 
danke,

werde es gleich morgen im Buero testen und euch dann Bescheid geben.

lg,
master07

PS: Vielen Dank nochmals! ;)
 
danke funktioniert bestens.

Jetzt moechte ich aber, dass das Bild komprimiert wird und nicht verkleinert.
Weisst du wie das geht little_pixel?

Vielleicht weiss jemand wie ich jetzt sagen kann, dass er nur Bild Dateien nehmen soll die zum Beispiel groesser als 2 MB sind.

Ich weiss es ist ein bisschen kompliziert, aber ich hoffe ich konnte mich klar ausdruecken.

Danke fuer eure Hilfe!

lg,
master07
 
Zurück
Oben Unten