4 Replies Latest reply on Dec 21, 2015 10:05 AM by JJMack

    Simple focus magic script help please

    foyle3

      Dipping my toes for the first time - more code to learn - brain hurting.

       

      I've recorded a very simple script to run a basic sharpening step in focus magic before creating web galleries.   It works except it asks for a decision in focus magic which is a pain running 40-70 pictures through (200 in show jump season).

       

      the desired aim is each photo to be "out of focus" sharpening at 1 pixel @ 100% and what I have is as follows.  I think there may be a yes/no return step I want rid of and I'm hoping sorting this out will be a good first step in learning.  Thanks for any help

       

      REM =======================================================

      DIM objApp

      SET objApp = CreateObject("Photoshop.Application")

      REM Use dialog mode 3 for show no dialogs

      DIM dialogMode

      dialogMode = 3

      DIM idOpn

      idOpn = objApp.CharIDToTypeID( "Opn " )

          DIM desc1

          SET desc1 = CreateObject( "Photoshop.ActionDescriptor" )

          DIM idnull

          idnull = objApp.CharIDToTypeID( "null" )

          Call desc1.PutPath( idnull, "C:\\APRESSbox\\ExRaw2process\\0812GlensEX\\MagstoGO\\0812GlentoranWEB\\WK08008DS Glentoran.JPG" )

      Call objApp.ExecuteAction( idOpn, desc1, dialogMode )

       

      REM =======================================================

      DIM objApp

      SET objApp = CreateObject("Photoshop.Application")

      REM Use dialog mode 3 for show no dialogs

      DIM dialogMode

      dialogMode = 3

      DIM idFltr

      idFltr = objApp.CharIDToTypeID( "Fltr" )

          DIM desc2

          SET desc2 = CreateObject( "Photoshop.ActionDescriptor" )

          DIM idUsng

          idUsng = objApp.CharIDToTypeID( "Usng" )

          Call desc2.PutString( idUsng, "Fix Out-of-focus Blur" )

      Call objApp.ExecuteAction( idFltr, desc2, dialogMode )

       

      REM =======================================================

      DIM objApp

      SET objApp = CreateObject("Photoshop.Application")

      REM Use dialog mode 3 for show no dialogs

      DIM dialogMode

      dialogMode = 3

      DIM idCls

      idCls = objApp.CharIDToTypeID( "Cls " )

          DIM desc3

          SET desc3 = CreateObject( "Photoshop.ActionDescriptor" )

          DIM idSvng

          idSvng = objApp.CharIDToTypeID( "Svng" )

          DIM idYsN

          idYsN = objApp.CharIDToTypeID( "YsN " )

          DIM idN

          idN = objApp.CharIDToTypeID( "N   " )

          Call desc3.PutEnumerated( idSvng, idYsN, idN )

      Call objApp.ExecuteAction( idCls, desc3, dialogMode )

        • 1. Re: Simple focus magic script help please
          Michael L Hale Level 5

          The open and close steps you should be able to do using the DOM and not have to use scriptlistener.

           

          For the filter You might want to see if it can be recorded and played back as an action. If so then just calling that action would be an easy way to run the filter. If it can be recorded you may be able ( at least with javascript ) to make the executeAction call with dialogMode set to all and assign the results to a variable. That variable with contain an Action Descriptor. With most filters the setting you used in the filter dialog will be in that descriptor. You just need to pull the descriptor apart to find what the setting are. Or( again using javascript ) xtools has a script that will convert an action into javascript. It is mostly action manager( scriptlistener ) so you should be able to translate the output to VBS.

          1 person found this helpful
          • 2. Re: Simple focus magic script help please
            foyle3 Level 1

            focus magic is notoriously "unbatchable" - a major failing.  Scripting

            I've learned is the only possible answer.  First time I tested this the

            filter automatically chose pixel width requiring an active intervention

            to enter my preferred value.  Last time this behaviour had changed to my

            preferred 1 pixel @ 100% requiring only a "return" click.  No idea why

            it has changed but the xtools utilities promise a half-way house between

            pure code and helpful remarks and notes.  Many thanks

             

            www.derek-simpson-photo.com

            • 3. Re: Simple focus magic script help please
              munecito

              Thread revival here.I am trying to implement a script for Focus Magic to process a couple of thousands photos from a timelapse camera that was bumped out of focus but can't for the life of me find a way.

               

              I tried to run your script and it gives me syntax errors. Also I couldn't see where was the line in which you selected the pixel input.f files

               

              With the amount of files that I need to process I would be happy if all I need to do is one click, but even happier if I don't need to intervene at all.

               

              If it is not much trouble. Could you please give me some pointers regarding the script you wrote? It would be fantastic if you had the time to drop me one or two lines regarding this.

               

              Thanks very much.

               

              Will

              • 4. Re: Simple focus magic script help please
                JJMack Most Valuable Participant

                That VSB script was posted nearly 4 years ago and was not a working script.  There does not seem to be an answer in the thread.  Layer the OP appended that  " focus magic is notoriously "unbatchable" - a major failing.  Scripting I've learned is the only possible answer. " They never wrote they were successful automating Focus Magic'

                 

                "Michael L Hale" was the only one who responded to the thread has passed away since then.   You should check with the developer to see if there have been any improvement made to Focus Magic to support automation like Scripts and Actions.  There may also be forums on their site for Focus Magic.

                1 person found this helpful