• 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
Storing Script Snippets - Follow-up with Enhancement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Storing Script Snippets - Follow-up with Enhancement


  • Subject: Storing Script Snippets - Follow-up with Enhancement
  • From: Rob Jorgensen <email@hidden>
  • Date: Wed, 11 Apr 2001 23:22:53 -0400

Howdy :-)

For all of you who recently contacted me regarding the FileMaker Pro database for storing script snippets, here are a couple of scripts to enhance things a bit if you use Scripter and/or Script Debugger.

When run from within the requested FileMaker Pro database, these scripts will write the text from the "Script Code" field (cell) to a text file on the desktop. The scripts will set the file's creator code to that of the respective editors and then open the file in the related editor. Script Debugger will attempt to compile the text. Scripter isn't scriptable (I hate to say that), so the attempt to compile is absent. I use both editors, and have attached these scripts to buttons, which works out quite nicely. :-)

These scripts are based on a similar script which takes selected text from a Eudora message and sends it to Script Debugger in the same fashion. If you are interested in that script, it's named "Eudora to Script Debugger" and it can be found in the ScriptTools category at <http://macscripter.net/script-builder.t>.

Note: << and >> have been used as substitutes for the guillemets in the Script Debugger script below to avoid ALSMS (Apple List Server Mangling Syndrome).

-- Begin script for Scripter users --

tell application "FileMaker Pro"
set theText to cell "Script Code"
end tell

set thePath to (path to desktop) as text
set theName to thePath & "Script from FMP"

if application "Finder"'s (exists item theName) then
set x to 1
repeat
beep
set newName to theName & "." & x
if not application "Finder"'s (exists item newName) then exit repeat
set x to x + 1
end repeat
set theName to newName
end if

tell application "Finder"
set outFile to open for access theName with write permission
write theText to outFile
close access outFile
end tell

tell application "Finder"
try
set creator type of file theName to "MEme"
open file theName using application file id "MEme"
on error
try
open file theName using application file id "MEme"
end try
end try
end tell

-- End script for Scripter users --


-- Begin script for Script Debugger users --

tell application "FileMaker Pro"
set theText to cell "Script Code"
end tell

set thePath to (path to desktop) as text
set theName to thePath & "Script from FMP"

if application "Finder"'s (exists item theName) then
set x to 1
repeat
beep
set newName to theName & "." & x
if not application "Finder"'s (exists item newName) then exit repeat
set x to x + 1
end repeat
set theName to newName
end if

tell application "Finder"
set outFile to open for access theName with write permission
write theText to outFile
close access outFile
end tell

tell application "Finder"
try
set creator type of file theName to "asDB"
open file theName using application file id "asDB"
on error
try
open file theName using application file id "asDB"
end try
end try
end tell

tell application "Script Debugger"
<<event asDBCOMP>> front window
end tell

-- End script for Script Debugger users --

I hope you find them useful. :-)
--
Later,

Rob Jorgensen
Ohio, USA


  • Follow-Ups:
    • Re: Storing Script Snippets - Follow-up with Enhancement
      • From: Rob Jorgensen <email@hidden>
    • Re: Storing Script Snippets - Follow-up with Enhancement
      • From: Paul Skinner <email@hidden>
  • Prev by Date: Re: Dictionaries for apps inside 'packages'
  • Next by Date: Newbie to Applescript
  • Previous by thread: Re: Dictionaries for apps inside 'packages'
  • Next by thread: Re: Storing Script Snippets - Follow-up with Enhancement
  • Index(es):
    • Date
    • Thread