Re: A bit of philophy about Database events
Re: A bit of philophy about Database events
- Subject: Re: A bit of philophy about Database events
- From: Bill Cheeseman <email@hidden>
- Date: Tue, 16 Mar 2010 16:55:35 -0400
On Mar 16, 2010, at 10:26 AM, Vittorio wrote:
> Is there any plausible reason why SQL support (e.g., thru ODBC which is an instrument of MAC OSX too) hasn't been implemented in Applescript, as it was in the main computer languages?
AppleScript is many things to many people. To me, it is an English-like scripting language intended to make it relatively easy for non-programmers to automate relatively simple repetitive tasks, including in particular those that require manipulating one or more target applications. As a language, its command set is intentionally sparse, leaving it to application developers to extend the language. AppleScript really shines when application developers extend the language by making their applications scriptable and thus enhancing the range of tasks that AppleScript can perform.
One must therefore assume that the extent of database support via AppleScript reflects market realities. I haven't followed the scriptable database market in particular, but if there isn't much available in the specific area you're interested in, it must be because developers haven't seen a market for it. Of course, FileMaker Pro is scriptable, largely through its built-in scripting language, which can be controlled with AppleScript, but that may not meet your needs. Excel is scriptable. As I recall, both FileMaker Pro and Excel include ODBC support, but whether that support is accessible via AppleScript, I don't know. There may be other scriptable applications with database capabilities, too.
Apple's Core Data technology uses SQLite under the hood, and it is possible to write Core Data applications that are scriptable. I haven't researched whether anybody has done that for general use, as opposed to a specific database application.
> And, as a workaround, is it possible in applescript to call programs written in other languages such as Perl?
There are three direct ways to use AppleScript to control a program:
1. If the target application is "scriptable" in the sense that it has a terminology dictionary and supports AppleScript commands, it can be scripted using those commands. It doesn't matter what language the application was written in, so long as its developer took the necessary steps to make it scriptable. Many applications, especially those written in non-standard (for Mac OS X) languages, are not scriptable. If you're thinking of writing a Perl application that is scriptable, I would say that isn't feasible unless you have very focused technical skills -- writing an application that supports AppleScript is a very big project. (But I'm not experienced with Perl or other scripting languages, so I don't know what's out there.)
2. If the target application is not "scriptable" in that sense, then AppleScript can still control it through its GUI using what is known as "GUI Scripting." GUI Scripting scripts use AppleScript commands that are specified in the terminology dictionary of Apple's System Events application (located in /System/Library/CoreServices). In general, GUI Scripting lets you tell any application process to click a menu or a button or to control other UI elements. The only requirement the target application must meet is that it support the Mac OS X accessibility API. All applications that are built using standard Carbon or Cocoa user interface elements automatically support the accessibility API, but applications using custom UI element code must be written specially to support it. Again, therefore, it seems unlikely that writing a simple Perl application will make it scriptable via GUI Scripting, unless perhaps the Perl application is using a library of UI element code that supports the accessibility API. (But again I'm no Perl expert.)
3. Developers can write "scripting additions" that add terminology to the language without regard to a target application. For example, somebody could write a scripting addition providing complete ODBC support. I have the vaguest of recollections that somebody once did something like that, a long time ago, but I might be hallucinating.
As others have mentioned, AppleScript allows you to execute shell commands, and you can do some database work in that fashion. I haven't had any experience in that area.
--
Bill Cheeseman
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden