• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Export AppleScript Library Text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Export AppleScript Library Text


  • Subject: Export AppleScript Library Text
  • From: Christopher Stone <email@hidden>
  • Date: Wed, 12 Nov 2014 00:42:28 -0600

Hey Folks,

A while back I finally changed all my AppleScript library files to bundles (.scptd).

I avoided doing this for a long time, because I could extract the script-recovery-resources of .scpt files saved by Script Debugger with the Satimage.osax in the blink of an eye.

I spent some time fiddling with more mundane methods of exporting the lib-text, and I ended up with a nice perl/osadecompile combination and a ASObjC-Handler kindly written for me by Shane Stanley.

While cleaning out a test directory this evening I came across this bit, which I'd forgotten about.

It's pretty fast and dead simple, so I'm passing it along.

One of the more useful things I've done with this type of code is to auto-export all library-handler-calls and import them into a couple of abbreviaton-completion groups in Typinator.  It has a QuickSearch function that gives me really fast access to all my handlers saving me mucho time and effort.  I used to have to do the export/import by hand, but thanks to a feature the guys at Ergonis added to Typinator for me it's now a one-keystroke process that takes less than two seconds.

--
Best Regards,
Chris

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2014/11/11 23:25
# dMod: 2014/11/11 23:42
# Appl: AppleScript-Runner ; Shell ; BBEdit
# Task: Export AppleScript Library Text to BBEdit
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Export, @Library, @Text
# Test: OSX 10.9.5
-------------------------------------------------------------------------------------------

set shCmd to text 2 thru -2 of "
#! /usr/bin/env bash

cd ~/'Library/Script Libraries/';

for i in `ls -d *Lb*` # Filter by name to only primary libraries.
  do
    libText+=\"\\n•• Library $i Begins ••\\n`osadecompile $i`\\n•• Library $i Ends ••\\n\"
  done

echo \"$libText\";
"
set applescriptLibraryText to do shell script shCmd
bbeditNewDoc(applescriptLibraryText, true)

-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on bbeditNewDoc(_text, _activate)
  tell application "BBEdit"
    set newDoc to make new document with properties {text:_text, bounds:{0, 44, 1920, 1200}}
    tell newDoc
      select insertion point before its text
    end tell
    if _activate = true or _activate = 1 then activate
  end tell
end bbeditNewDoc
-------------------------------------------------------------------------------------------

 _______________________________________________
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

  • Follow-Ups:
    • Re: Export AppleScript Library Text
      • From: Shane Stanley <email@hidden>
  • Prev by Date: What Apple event functionality is still missing from Cocoa?
  • Next by Date: Re: Export AppleScript Library Text
  • Previous by thread: What Apple event functionality is still missing from Cocoa?
  • Next by thread: Re: Export AppleScript Library Text
  • Index(es):
    • Date
    • Thread