Become a MacRumors Supporter for $25/year with no ads, private forums, and more!

Mac Applescript doesn't understand replace_chars

blackboxideas

macrumors member
Original poster
Oct 17, 2012
47
3
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?
 

superscape

macrumors 6502a
Feb 12, 2008
930
218
East Riding of Yorkshire, UK
Yup.

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:

Code:
on replace_chars(something)
--some stuff here
end


More info about handlers here:

https://developer.apple.com/library...LangGuide/conceptual/ASLR_about_handlers.html
 
Comment

blackboxideas

macrumors member
Original poster
Oct 17, 2012
47
3
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!
 
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.