Opening a file using a wildcard?

Having trouble getting this script to work. Just need it to open and process any file that begins with “1”.

tell application “Finder”
set myfolder to “/Users/TV/Desktop/EyeFi to Process”
set theImage to (every file of myfolder whose name starts with (“1”))
set theOutputFolder to “/Users/TV/Desktop/EyeFi Images/1.jpg”
end tell
tell application “Image Events”
launch
set theImageReference to open theImage
tell theImageReference
scale theImage to size 720
save in (theOutputFolder as string) as JPEG
close
end tell
end tell

Any help greatly appreciated!

Thanks,

Carl

Hi,

there are some problems:
AppleScript works with HFS paths (colon separated).
This represents the HFS path to the EyeFi to Process folder of the current user

set EyeFiToProcessFolder to (path to desktop as text) & "EyeFi to Process:"

the result of every file . whose is a list, so you have to use a loop to process multiple images.

Do you really want to save all images with the same file name?

I guess there is only one file which starts with 1 so try this (not tested)

set EyeFiToProcessFolder to (path to desktop as text) & "EyeFi to Process:"
set theOutputFolder to (path to desktop as text) & "Images:1.jpg"


tell application "Finder"
	set theImage to 1st file of folder EyeFiToProcessFolder whose name starts with "1"
end tell

tell application "Image Events"
	launch
	set theImageReference to open file (theImage as text)
	tell theImageReference
		scale it to size 720
		save in theOutputFolder as JPEG
		close
	end tell
end tell

You have a bunch of small errors, so try this. Hopefully it will help you identify where you went astray.

set inFolder to "/Users/TV/Desktop/EyeFi to Process/"
set outFolder to "/Users/TV/Desktop/EyeFi Images/"

set inFolderApplescriptStyle to (POSIX file inFolder) as text
set outFolderApplescriptStyle to (POSIX file outFolder) as text

tell application "Finder"
	set theImages to (every file of folder inFolderApplescriptStyle whose name starts with "1") as alias list
end tell


tell application "Image Events" to launch
repeat with theImage in theImages
	tell application "Finder" to set fileName to name of theImage
	tell application "Image Events"
		set theImageReference to open theImage
		tell theImageReference
			scale to size 720
			save in (outFolderApplescriptStyle & fileName & ".jpg") as JPEG
			close
		end tell
	end tell
end repeat
tell application "Image Events" to quit

As always, works perfect! Thanks a bunch Stefan!

Carl