Applescript -- programming language from hell

Hi,

I’m an old COBOL programmer and I find Applescript one of the worst programming languages I have ever worked with.

I can’t count the times I have tried to write a script that did not continue to generate compile or run-time errors.

Even when I copy scripts from this site, I can’t get them to compile or run without errors.

I know Apple has changed Applescript every time it has an OS upgrade or update. I can see fixing bugs to make a language support an OS version, or add new capabilities, but you don’t change the rules or language format when doing so.

I have been trying to wright a script to retrieve information from my Keychain files.
I would like to import the information to a spreadsheet.

I have tried several scripts from MacScripter and have not been able to get one to compile cleanly.

I have also tried versions from other sites. I’m beginning to think Applescript is something that is just not worth working with.

””””””””””””””””””””””””””””
Never let Murphy’s law rule your live ” :wink:
””””””””””””””””””””””””””””

Model: 17" MacBook Pro
AppleScript: AppleScript 2.1.2
Browser: Firefox 12.0
Operating System: Mac OS X (10.6)

ROFL

Sorry to hear you were fooled by this “read-only” language.

To write, you actually have to RTFM. Really read it, like it was K&R’s The C Programming Language. Go figure!

More particularly, to access your keychain from a script, download Daniel Jalkut’s “Usable Keychain Scripting.app” and put it in your Library/Scripting Additions/ folder. Here’s an example (in Lion):


tell application "Usable Keychain Scripting"
	launch
	tell current keychain
		tell (some generic item whose name is "ASPW")
			set myPW to password
		end tell
	end tell
end tell

The variable myPW will hold the password for ASPW. I’m an old Fortran II & IV programmer and I managed to struggle through.

Well if you talk technically it is one of the worst indeed but from a programmer’s perspective it’s one of the most user friendly languages there is. COBOL is a programming language (AppleScript a scripting language BTW) which I would describe as horrific to write.

Those changes are typically with scripting languages. The virtual machine their running in gets constantly updated and so is the language. If I got a nickel for all those times I needed to add an ternary just to make my PHP code compatible with PHP 4 and 5. And don’t get me started about JavaScript. I can only say: ‘welcome to the world of scripting’.