5 Replies Latest reply: Oct 18, 2012 8:21 AM by Jacques Rioux
MattJayC Level 1 Level 1 (0 points)

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)
  • MattJayC Level 1 Level 1 (0 points)

    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.

  • Jacques Rioux Level 4 Level 4 (2,705 points)

    Hi,

     

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

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

    try

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

    on error

          return -- no Finder window

    end try

     

    set tDate to (current date)

    repeat

          set b to false

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

                try

                      set currDate to current date

                      tell application "Finder" to document files of currFolder whose name extension is "jpg" and creation date > tDate

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

                            set tDate to currDate

                            set b to true

                      else if b and (current date) - tDate > 29 then -- no new image from the last thirty seconds.

                            set tDate to currDate

                           

                            tell application "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

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

                end try

                delay 2 -- wait before checking the new file.

          end repeat

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

    end repeat

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

  • MattJayC Level 1 Level 1 (0 points)

    Superb! Runs exactly like it should.

    Many Thanks!!

  • MattJayC Level 1 Level 1 (0 points)

    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?

  • Jacques Rioux Level 4 Level 4 (2,705 points)

    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" using command 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

    end tell

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