Metadata Report Generator (Was: Future of Applescript?)

I am convinced enough from all the Applescript discussion and examples here that it will be worth my time to invest in a deep-dive reading program to become proficient in Applescript - DT3 alone is clearly worth that efffort.

I am curious though - Apple seems somewhat less than committed to Applescript for the long-term and a number of previously active Applescript blogs/websites are no longer functioning. How long do you think Applescript will remain usable/supported? Do we face a risk of a future macOS release which no longer supports Applescript even though we are still using DT3 when that time comes?

1 Like

Might have the same future as the Safari extensios

Do we face a risk of a future macOS release which no longer supports Applescript even though we are still using DT3 when that time comes?


But we also face a future when Apple stops making Macs altogether, or they unify the operating systems into one dumbed down, child’s toy.

Or they may continue making great Macs and keeping things separate.

PS: Many blogs and websites about AppleScript have become defunct because people have moved to different languages or just lost interest.

But we also face a future when Apple stops making Macs altogether

I have long thought that the world would come to a halt at January 1st 2000, but that didn’t happen after all. Then I thought doomsday would arrive at January 1st 2038. But currently I have set my aim for the year after the coming 292 billion years or so, which is… a very long time into the future :slight_smile:

(I do still plan on taking that month long minimalistic hiking trip around new year 2038 though)

Do we face a risk of a future macOS release which no longer supports Applescript even though we are still using DT3 when that time comes?

Who knows? My bet would be that Apple moves its automation the coming years towards a Shortcuts integration with iOS. Which also supports some scripting by the way, but that’s still far from AppleScript level of course.

1 Like

I doubt AppleScript will stop being functional anytime soon, on the order of decades. It seems to be used extensively in business use cases—niches we don’t hear from very often, but that might get vocal if this collapses without a viable and easy replacement (and a sensible transition process).

1 Like

I actually agree with this. I have professionally scripted in multiple corporations, things that are still in use to this day. Some are absolutely critical to day to day operations too.

Full deprecation of AppleScript would hamstring many, many, many individuals and businesses.


Smart rules were not only added because they’re much more user-friendly than AppleScript but also because they do not depend on AppleScript. Of course smart rules will never be as powerful as AppleScript but in the worst case (hopefully never) there’s at least an alternative already.

Personally I wouldn’t worry about AppleScript as long as there’s still Automator (as it’s less powerful and less popular than AppleScript).

I think that:

(1) Learning how to “script in DT” is quite different from learning AppleScript. If the former is the objective, and you have some programming experience (i.e know the common flow of programming and know how to fork), there are many simple/elegant scripts in the DT’s standard scripts and this forum that can be used as basic template. Honestly, the simpler a script, the better it is. My script is always (too) complicated because I use programming as a leisure activity!

(2) I know @bluefrog may disagree with this: try to download a trial version of Script Debugger. For me, it is much easier to use SD to debug a script step by step. SD presents all properties of each elements of DT involves in the script. My understanding of DT dictionary is dramatically accelerated by using SD for debugging. There might be other 3rd party editor that can do the same job, but I don’t know them.

(3) Personally, I think if you have a specific task wanting to accomplish, the first stop is smart group/rule. DT and other forum members can provide many ideas and small script to be embedded in the smart rule. If you have a particular task that you believe can only be achieved by customised script, then that will be the best time to start learning AppleScript. My personal experience is wanting to learn AppleScript is very un-motivating until I have a specific task.

(4) There are many info on web re AppleScript. But I find going through a book is the best way to understand the subject (for older guys like me. coz I think grown-ups reply on declarative learning more - they need to make-sense of the grammar and structure of a new language before they are able to use it. Younger persons learn in procedural manner - they just get it by exposing to the new language ). There might be many books, but I find AppleScript 1-2-3 by Soghoian and Cheeseman gave me the best starting point.


Thank you - much appreciated

Script Debugger looks excellent by their description. Agree a book is a good idea.

My specific task that I want to accomplish is a report generator which will let me take information from a Sheet and transform it to a nice vertical format. The ultimate task would be to integrate that with template software like Smarty templates or similar to define the report format, but that integration probably will be beyond my capability. I should be able to learn it well enough to hardcode a specific report format that I like - maybe others can take it further and make it more generalizable after that.

Before I reinvent the wheel, any thoughts on existing report generators using Applescript?

I don’t have the experience in report generation in DT2/3.
But from the sound of it, the first choice would be using tools>create meta data overview and export to Excel using its formatting capability.

Else it sounds like a script job in which may take up some efforts. (1) before a script, use “create meta data” to create a full sheet and delete the ones that aren’t needed. In script (1) creates a new rtf, (3) use script to call up each cell in each row and add the cell as new paragraph. Thus the output will be vertical but won’t necessary be nice. (4) use other word processor to do the formatting.
It other words, it sounds like a full script job by combing different blocks of code in this forum in creating a new rtf (relatively easy to find in script menu or in this forum), pulling data in sheet (perhaps less easy to find. I also suspect that DT3 has new dictionary for sheet), and creating new paragraphs in rtf (relatively easy to find in script menu or in this forum). It sounds like a pretty big jump if u have never scripted before. Perhaps trying some smaller and single task job as a practice first… Anyway, other more experienced member may offer much more valuable advice.

I would love to do that. I have repeatedly asked Development, but they see no value or no other user interest in my request.

The Create Metadata is a wonderful option. With one fatal flaw - it outputs extra fields which may not be pertinent to a report and thus the report becomes hard to print and/or read.

I would love a tweak to Create Metadata which works just as it does now but only outputs the fields in the current view. But that does not seem to be in the plans for DT3 development, and that change by itself is not scriptable.

1 Like

It’s not that we don’t see the value but time & resources aren’t endless but the to-do list is already :slight_smile:

If it helps - last time we talked I thought the hardest part of this would be adding support for custom metadata. But another post pointed out that already works as long as there is custom metadata in a given field in at least one record.

That means the only real issue remaining is not including in the report any non-displayed columns. Surely that would be the preferred operation of the feature for almost all users. And it would require no user interface changes. Isn’t that pretty straightforward to do?

Hard to tell, so far I remember such requests only from you.

1 Like

IMHO, I don’t think it’s too much work for a user to use tools>“Create Meta Data Overview” and delete the unwanted columns, unless I misunderstood the request. If you can do this first step, this is a quick-and-dirty script to print the data that is presented in the sheet to a rtf file in vertical format. However, I wouldn’t suggest doing any formatting on rtf by script. At least for me, using script to work on formatting, particularly on rtf, is very time consuming and tricky.

Select the edited sheet generated from “Create Meta Data Overview”, run this script and a vertically format report will be created in a location specified by the user. You may have to try to debug by trial and error, it can be fun. DONOT include the annotation note (the big one in the “annotation and reminders”) in the edited sheet! I don’t know what will happen.

-- Created by Ngan 2019.09.23

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

tell application id "DNtp"
	set theSheet to content record of think window 1
	set theCells to cells of theSheet
	set hdl to columns of theSheet
	set theText to ""
	repeat with i from 1 to length of theCells
		repeat with j from 1 to length of hdl
			set theText to theText & (hdl's item j & ": " & (item j of (item i of theCells)) & return)
		end repeat
		set theText to theText & return & return
	end repeat
	set theRepName to display name editor "Name of the report" default answer "Report for " & (name of theSheet)
	set theRepLocation to display group selector "Create the report in:" for current database
	set theNewDoc to create record with {name:theRepName as string, source:theText as string, type:rtf} in theRepLocation
end tell

PS: Perhaps the moderator would consider moving this to the script section.

How about a screen cap of the final RTF file? :blush:

From this:

to this? I hope this is what the “vertical report” is about? If not, my apology …:grinning::pray:

1 Like

It agree is not a big deal to delete the unwanted columns for an occasional report. But I am hoping for this to be a daily update report for my team. I would set it up to run daily or maybe even to run by SmartRule anytime the underlying data is edited.

Thank you for the sample script - I will try that out later today.

1 Like

Yes that’s the basic idea of what the vertical report would look like - perhaps sorted/sortable by the various metadata parameters.

Sure. I feel that if u need to get different meta data fields and prepare the report for different purposes on a regular basis, then some sort of automation would be nice. It can be done by enhancing the current script. Picking fields on a standard meta data overview for reporting is not difficult, formatting the rtf report is…

1 Like