Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

get last group of images and open with app.

What I would like to do is take a series of images, and then open this series of images into helicon focus where it then merges the images together.


I'm hoping that with applescript. I can get the open the last set of images (jpg only, PSD's arrive in the same folder and don't need to be recognised) . That are shot within the 2 minutes. I have the script below might begin to help me. although I need it to select all of the images shot in the last minute. Then open with helicon Focus (that is not scriptable) i'll use system events from there.


It will need to run the script when there are no new files after 30 seconds then group all the images togethe and hightlight and open.




Can this be adapted?




try

tell application "Finder" to set currFolder to front Finder window -- get id of front Finder window

on error

return -- no Finder window

end try



set tDate to (current date) - 60

repeat

set b to false

try

tell application "Finder"

repeat with i in (get document files of currFolder whose creation date > tDate) -- get newer files

if (exists currFolder) then

reveal i

my selectionfullScreen()

set cDate to creation date of i

if cDate > tDate then set tDate to cDate -- store newer date

set b to true

end if

end repeat

end tell

on error number n

if n = -1728 then return --quit the script, the current Folder is closed

end try

if not b then delay 2 -- no recent files, wait 2 seconds

end repeat

iMac, Mac OS X (10.6.8)

Posted on Oct 12, 2012 6:21 AM

Reply
5 replies

Oct 12, 2012 6:42 AM in response to MattJayC

Just trying to re-clarify


1) wait until there are no new images

This is 30 seconds from the last shot.

2)highlight all the images shot in the last 120 secs.


3)Switch to Helicon Focus

System events ⌘⌥C

Back to Finder

4)Open all the images into Helicon Focus.


5)Use system events to ⌘G


in that time I will manually save the item. So no further images will be taken


6)Then wait for next batch of images to arrive.



5)repeat.

Oct 12, 2012 10:13 AM in response to MattJayC

Hi,


If I understood everything, this script should do what you want :

-------------------------

try

tellapplication "Finder" tosetcurrFoldertofrontFinder window -- get id of the front Finder window

onerror

return -- no Finder window

endtry


settDateto (current date)

repeat

set b to false

repeat -- loop to wait until there are no new images

try

set currDate to current date

tellapplication "Finder" todocument filesofcurrFolderwhosename extensionis "jpg" andcreation date > tDate

if the result is not {} then -- newer image(s)

set tDate to currDate

set b to true

elseifband (current date) - tDate > 29 then -- no new image from the last thirty seconds.

set tDate to currDate

tellapplication "Finder" -- get images shot in the last 120 secs.

set tFiles to (document files of currFolder whose name extension is "jpg" and creation date > (currDate - 120)) as alias list

select tFiles

end tell

activate application "Helicon Focus"

delay 0.2 -- adjust the time if necessary.

tell application "System Events"

tell process "Helicon Focus" to keystroke "c" using {command down, option down}

end tell

delay 1

tell application "Helicon Focus" to open tFiles

delay 2 -- to allow time for the application to display the files in the window. (adjust the time if necessary.)

tell application "System Events"

tell process "Helicon Focus" to keystroke "g" using command down

end tell

exit repeat

end if

on error number n

ifn = -1728 thenreturn --quit the script, the current Folder is closed

end try

delay 2 -- wait before checking the new file.

endrepeat

delay 10 -- waiting time after the images are opened in "Helicon Focus" to allow time for the user.

endrepeat

-------------------------

Oct 18, 2012 2:42 AM in response to MattJayC

How might I get the number images in tfiles?


set timeFiles to number of files in tfiles


I would like to add after this

tell process "Helicon Focus" to keystroke "g" using command down --render images


Delay (1.5 * timeFiles)


tell process"Helicon Focus" to keystroke "s" using command down -- to save the image



Unless there is a way to listen to know when it has finished the render?

Oct 18, 2012 8:21 AM in response to MattJayC

This is possible by checking that the menu "Save ..." is enabled, or by checking the ("render" button or progress bar) in the window.


I don't know about the latest version of the application, but this works on version 4.2.4

-----------------

tell application "System Events"

tell process "Helicon Focus"

keystroke "g" usingcommand down -- render images

tell menu item "Save Image…" of menu "File" of menu bar 1 to repeat

delay 1.5

if enabled then

click -- to save the image

exit repeat

end if

end repeat

end tell

endtell

-----------------

get last group of images and open with app.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.