Hey,
Can this be modified to set theImage to the most recent file added as opposed to it’s name?
set theImage to last file of folder EyeFiToProcessFolder whose name starts with "D"
Thanks,
Carl
Hey,
Can this be modified to set theImage to the most recent file added as opposed to it’s name?
set theImage to last file of folder EyeFiToProcessFolder whose name starts with "D"
Thanks,
Carl
tell application "Finder"
set theFolder to "/Users/ckeyes888/EyeFiToProcessFolder"
set xxx to first item of (every paragraph of (do shell script "ls -t " & theFolder))
end tell
Thanks a bunch. Shouldn’t this work? Can’t get it going.
set EyeFiToProcessFolder to (path to desktop as text) & "EyeFi to Process:"
set theOutputFolder to "/Users/TV/Sites/1.jpg"
tell application "Finder"
set theImage to first item of (every paragraph of (do shell script "ls -t " & EyeFiToProcessFolder))
end tell
Carl
Actually, might be better to show you the whole script.
on adding folder items to this_folder after receiving added_items
try
set EyeFiToProcessFolder to (path to desktop as text) & "EyeFi to Process:"
---set theOutputFolder to (path to desktop as text) & "EyeFi Images:1.jpg"
set theOutputFolder to "/Users/TV/Sites/1.jpg"
tell application "Finder"
set theImage to first item of (every paragraph of (do shell script "ls -t " & EyeFiToProcessFolder))
end tell
tell application "Image Events"
launch
set theImageReference to open file (theImage as text)
tell theImageReference
scale it to size 700
save in theOutputFolder as JPEG
close
tell application "IndigoServer"
execute group "EyeFi on Display Screen"
end tell
end tell
end tell
set theFolder to (path to desktop as text) & "EyeFi to Process:"
set numberOfFiles to count of (paragraphs of (do shell script "mdfind -onlyin " & quoted form of POSIX path of theFolder & " kMDItemFSInvisible == 0"))
tell application "IndigoServer"
set the value of variable "EyeFi_Count" to numberOfFiles
end tell
end try
end adding folder items to
Someday I’ll figure out how to add applescript correctly here.
With your script selected, click on the AppleScript button above the entry pane, or click on the button and paste your script between the BBCodes. BBCodes have to be stopped, so the second one always begins with a slash.
Adam
Thanks,
Carl
Hi, Carl (and John).
Hope this helps. I haven’t posted a corrected script because I don’t understand what’s supposed to be happening with the folder action and, as I’ve said, I’m not familiar with IndigoServer.
Carl, to find the name of the latest file in a folder, you can use this:
(Nigel’s corrections are incorporated)
set theFolder to "/Users/ckeyes888/EyeFiToProcessFolder"
set xxx to first paragraph of (do shell script "ls -t " & theFolder)
Also, why don’t you explain from beginning to end what you are trying to accomplish with your script, listing each step.
The process I’m after is when I take a photo my home automation software, Indigo, displays it on a screen.
The camera has an Eye Fi card which can send images from the camera to any folder on your computer.
The script is setup as a folder action to scale, rename and save the incoming image to the folder where Indigo can
use it for display. It also tells Indigo the number of files in the folder that Eye Fi uses to store the images.
All seems to be working pretty well. I know the script is a hodgepodge but considering how little I know
about AppleScript I’m surprised it works at all.
Thanks,
Carl
You can attach this folder action to the EyeFi to Process folder. I can’t test the IndigoServer portion of the script.
property theOutputFolder : "/Users/TV/Sites/"
on adding folder items to this_folder after receiving added_items
repeat with anItem in added_items
tell application "Image Events"
activate
set theImageReference to open anItem
tell theImageReference
scale it to size 700
save in theOutputFolder as JPEG
close
end tell
end tell
(*
tell application "IndigoServer"
execute group "EyeFi on Display Screen"
end tell
*)
set numberOfFiles to count of (list folder ((path to desktop) & "EyeFi to Process" as text) without invisibles)
(*
tell application "IndigoServer"
set the value of variable "EyeFi_Count" to numberOfFiles
end tell
*)
end repeat
end adding folder items to