• 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
Application-specific code in handler won't execute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Application-specific code in handler won't execute


  • Subject: Application-specific code in handler won't execute
  • From: Bill Planey <email@hidden>
  • Date: Sat, 16 Jul 2005 00:52:54 -0500

Title: Application-specific code in handler won't execute
Hello,

I don't know if it isn't possible to set up a handler that makes an application-specific command, but I wouldn't think so.  I successfully created handlers for Word that send Visual Basic commands.

But I cannot seem to create a handler that will work which has BBEdit perform some simple search/replace tasks. The purpose, obviously, is simply to save space in the code.

I could do it like this:

tell application "BBEdit"
    activate
   -- Circle
   replace " Cir " using " Circle " searching in text 1 of text document 1 options {search mode:literal, starting at top:false, wrap around:true, backwards:false, case sensitive:true, match words:false, extend selection:false}
    -- Street
   replace " St " using " Street " searching in text 1 of text document 1 options {search mode:literal, starting at top:false, wrap around:true, backwards:false, case sensitive:true, match words:false, extend selection:false}
end tell


...But I would rather do it more compactly, like the following:

tell application "BBEdit"
    activate
   my LiteralFix(" Ct ", " Court ") -- Court
   my LiteralFix(" Cir ", " Circle ") -- Circle
   my LiteralFix(" St ", " Street ") -- Street
   my LiteralFix(" Dr ", " Drive ") -- Drive
   my LiteralFix(" Ln ", " Lane ") -- Lane
   my LiteralFix(" Ave ", " Ave. ") -- Avenue
   my LiteralFix(" Rd ", " Road ") -- Road
   my LiteralFix(" Blvd ", " Blvd. ") -- Boulevard
end tell

on LiteralFix(FindText, ReplaceText)
    set quote to "\""
    set TheCommand to "replace " & quote & FindText & quote & " using " & quote & ReplaceText & quote & " searching in text 1 of text document 1 options {search mode:literal, starting at top:false, wrap around:true, backwards:false, case sensitive:true, match words:false, extend selection:false}"
    tell application "BBEdit"
        TheCommand
   end tell
end
LiteralFix


... The handler does absolutely nothing, even though the search candidates are there in the file. Maybe is has something to do with the quote marks?

Any ideas?

Thanks,

Bill Planey

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Application-specific code in handler won't execute
      • From: Sander Tekelenburg <email@hidden>
    • Re: Application-specific code in handler won't execute
      • From: Andrew Oliver <email@hidden>
    • Re: Application-specific code in handler won't execute
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Milliseconds to "formatted time"
  • Next by Date: Re: Application-specific code in handler won't execute
  • Previous by thread: Re: Milliseconds to "formatted time"
  • Next by thread: Re: Application-specific code in handler won't execute
  • Index(es):
    • Date
    • Thread