Applescript doesn't understand replace_chars

Discussion in 'Mac Programming' started by blackboxideas, Oct 27, 2015.

  1. blackboxideas macrumors member

    Oct 17, 2012
    I was attempting to figure out a way to strip out text from the 'calendar summary' action within Automator.
    (Attempting to answer an old question raised on the Automator G+ group).

    Currently my workflow grabs the weeks calendar events, attempts to strip out the information from the summary action to just leave the event names, then sends these to notification event.

    I figured I'd be able to use Applescript to replace the text I didn't need but when I run the action I get the error:

    <<script>> doesn't understand the "replace_chars" message.

    Now I may be trying to pass Applescript something in a format it doesn't like, but I'm not too familiar with how this works...

    Here's a link to my workflow (can't seem to attach a zip of it!), but does anyone know what I may be doing wrong, or can point me in the right direction?
  2. Red Menace macrumors 6502

    Red Menace

    May 29, 2011
    Littleton, Colorado, USA
    You need to include the code for the replace_chars handler.
  3. superscape macrumors 6502a


    Feb 12, 2008
    East Riding of Yorkshire, UK

    To expand on what Red Menace says, "replace_chars" is a handler (or function, if you prefer). Think of it as a user-defined command that takes some parameters. If you haven't defined that function in your code then you'll get an error like the one you see.

    There should be something in your code like this:

    on replace_chars(something)
    --some stuff here

    More info about handlers here:
  4. blackboxideas thread starter macrumors member

    Oct 17, 2012
    Brilliant, thank you guys. I'd been doing some googling and had assumed replace_chars was something I could just call, rather than needing to define the function.
    Cheers for the link to the docs too - somehow I'd missed that, should help massively!

Share This Page