Display newest image?

I am just getting into AppleScript so bear with me please. I need to create a method, preferably an applescript to display fullscreen the last image file dropped into a specified folder remotely. So when a networked computer sends a file into a folder on my mac the applescript jumps into action displaying the file with the most recent date/time to full screen on my mac.

I’ve tried using the fully scriptable Quicktime application to “present” the file in full screen with little success. Does this seem like a reasonable way to accomplish my task? I realize the most difficult part for me will be in determining the most recent file to display but I assume there is a way to look at creation dates and times with apple script.

Finally, the script will be invoked through a folder action, upon noticing a change in the specified folder. An example of this in action is: Once an image file is written to the watched folder my folder action triggers the applescript and displays the image fullscreen. The applescript closes and the image remains on the screen. Then a new file is uploaded to the folder remotely. Again the folder action sees this and invokes the applescript, which again displays the new image full screen and then closes.

I really need to get this figured out, thanks for any help you can provide!

This is what I got so far:

repeat 2 times
set f to choose file with prompt “Choose a picture:”
tell application “QuickTime Player”
launch
activate
open f
tell front movie
stop
rewind
present scale screen mode slide show
end tell
end tell
do shell script “sleep 5”
tell application “QuickTime Player” to quit
end repeat

One idea is that you might place the unix sleep command in a repeat loop that looks for a flag to exit the repeat. The flag might be set with your folder action.

I just got a better idea. The folder action would quit QuickTime and restart a new slide show.

Note that one thing bad about folder actions is if more than one location drops onto the same folder you may miss one or more of the drops.

Its been a while since I script QuickTime so I might come up with something better.

gl,