Jump to content

New AppleScript Progress Support - FYI


Recommended Posts

Posted

Just noticed this after installing Yosemite:

 

Progress Reporting

AppleScript now has built-in support for reporting progress in a script. The global AppleScript object has four new properties:

  • progress total steps (an integer)

  • progress completed steps (an integer)

  • progress description (text)

  • progress additional description (text)

A script may set any of these properties at any time during the script to update the progress display. progress completed steps divided by progress total steps provides the fraction completed; if completed or total is -1, progress is considered indeterminate. progress description and progress additional description provide a message about what the script is doing.

Exactly how the progress is displayed depends on how the script is run: in Script Editor, it appears in the script window’s status bar; in script applications (applets), it appears as a progress dialog; and for scripts run from Script Menu, it appears in the Script Monitor menu. (Script Monitor appeared in previous system releases, but was only used for Automator workflows; it now displays any script run using NSUserScriptTask, which includes anything run from Script Menu.)

 

 

Posted

As far as I can tell, the only way to get this to display is by including an app bundle in a workflow, right?  I tried an Applescript object and a Script -> osascript object and neither produced a progress window or anything in the Alfred workflow log.

Posted

As far as I can tell, the only way to get this to display is by including an app bundle in a workflow, right?  I tried an Applescript object and a Script -> osascript object and neither produced a progress window or anything in the Alfred workflow log.

 

I think you're right. I let my enthusiasm take me away. :-) I'm not sure if it's possible for Alfred to serve as the progress display "handler". I notice that the script editor displays the progress with a pie chart and logging messages in the bottom of the script window, so at some level it should be possible.

  • 2 years later...
Posted

Does anyone have any updated info on whether there is a way to get this built-in applescript progress indicator to work for scripts in workflows? Is the only other alternative cocoaDialog?

 

Thanks for any pointers...

Posted

Thanks deanishe, very neat idea, however my applescript can run for 3-5 minutes in the background so blocking Alfred for this time wouldn't be much use.

 

I found this tool:

 

https://github.com/tsntsumi/ProgressDialog

 

However it uses "tell application" and I can't see how that would work if it is stored in the workflow bundle. So annoying Apple never made Applescript progress work for scripts...

Posted
3 hours ago, iandol said:

blocking Alfred for this time wouldn't be much use.

 

It doesn't block Alfred. Your long-running script should write its progress to a file, and a separate Script Filter then reads the file and shows the progress bar. You can open and close it as you please. 

Posted
1 hour ago, deanishe said:

 

It doesn't block Alfred. Your long-running script should write its progress to a file, and a separate Script Filter then reads the file and shows the progress bar. You can open and close it as you please. 

 

Woah, that is super cool. Will give it a go thanks!!!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...