• 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
Re: Script Starter Templates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script Starter Templates


  • Subject: Re: Script Starter Templates
  • From: Christopher Stone <email@hidden>
  • Date: Wed, 23 Dec 2015 12:52:28 -0600

On Dec 23, 2015, at 12:08, S. J. Cunningham <email@hidden> wrote:
I find myself needing to do the same thing in script after script so I have developed my own template as a "starter".
______________________________________________________________________

Hey Steve,

I have 4 libraries attached to all of my new scripts in Script Debugger, and these contain somewhere in the neighborhood of 150 handlers.

Then I use the SD text-expansion mechanism to enter select handlers with <tab> parameters at need.

I also use this for ASOGS (all sorts of good s#$t).

I export all of my handler calls to Typinator (with a script), so I can quick-search them.

Finally I have a script to "export" the front script with complete handlers, so it's easier to share stuff.

I have just a few purpose-specific templates in the Template system.

Here are my most used Satimage.osax handlers:

-------------------------------------------------------------------------------------------

cng("regex", "into", _src) of me
fnd("_find", _data, true, true) of me
fndUsing("_find", "_capture", _data, true, true) of me
fndBool("_find", _data, false, false) of me

-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on cng(_find, _replace, _data)
  change _find into _replace in _data with regexp without case sensitive
end cng
-------------------------------------------------------------------------------------------
on fnd(_find, _data, _all, strRslt)
  try
    find text _find in _data all occurrences _all string result strRslt with regexp without case sensitive
  on error
    return false
  end try
end fnd
-------------------------------------------------------------------------------------------
on fndUsing(_find, _capture, _data, _all, strRslt)
  try
    set findResult to find text _find in _data using _capture all occurrences _all ¬
      string result strRslt with regexp without case sensitive
  on error
    false
  end try
end fndUsing
-------------------------------------------------------------------------------------------
on fndBool(_find, _data, _all, strRslt)
  try
    find text _find in _data all occurrences _all string result strRslt with regexp without case sensitive
    return true
  on error
    return false
  end try
end fndBool
-------------------------------------------------------------------------------------------

In any given script on my system you'll only see the top and not the handlers section (because of the libraries).

I entered all the handler calls with text-expansions and then used my export script to create the complete (flattened) script you see above in a blink.

I'll read through your template again more carefully later this evening.

--
Best Regards,
Chris

 _______________________________________________
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: Script Starter Templates
      • From: "S. J. Cunningham" <email@hidden>
References: 
 >Script Starter Templates (From: "S. J. Cunningham" <email@hidden>)

  • Prev by Date: Script Starter Templates
  • Next by Date: Re: Script Starter Templates
  • Previous by thread: Script Starter Templates
  • Next by thread: Re: Script Starter Templates
  • Index(es):
    • Date
    • Thread