Thursday, October 6, 2022

#1 2022-05-24 09:47:11 pm

Registered: 2012-07-29
Posts: 2

Unable to increment Progress indicator inside tell application block

So I am trying to implement a progress bar in a script I am using to process several thousand files.  I have found examples of code such as the majority of the code below that demonstrate how to use it.  I have added a tell block to indicate where I would add AppleScript to operate on photos.  The problem is that Photos does not know about progress so I can not update the completed steps.

I could remove the tell block as it sits now and replace it with several tell blocks. It might be a bit painful and it seems to me to make more sense to use something like a tell block that applies to the set progress statement. I have just been unable to figure out what I need to provide to AppleScript to get it to understand.  I just have not found it in the "documentation". So I am hoping that folks here might be knowledgeable enough to point me in the right direction.
Chip T 


use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

on run
   -- your code goes here...
   set n to 2028
   set progress total steps to n
   set progress description to "Script Progress"
   set progress additional description to "This should be helpful"
   tell application "Photos"
-- This is where I would operate on photos

    repeat with i from 1 to n
           delay 1
           set progress completed steps to i
       end repeat
   end tell
end run

Filed under: applescript, Progress



#2 2022-05-25 03:39:13 am

Registered: 2020-09-18
Posts: 8

Re: Unable to increment Progress indicator inside tell application block

Photos doesn't know about progress!


repeat with i from 1 to n
           delay 1 --why??
           tell me
               set progress completed steps to i
           end tell
       end repeat



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)