Using user defined handlers in a tell block?

I’m trying to use a handler in tell block btu I can’t get it to work :frowning:

The code looks like this:


tell application "some-app"
  ..blah..
  set x to userHandler(x, y, z)
  ..blah..
end tell

on userHandler(x,y,z)
  ..blah..
  return a
end userHandler

This gives me an error:
“some-app got an error: Can’t continue userHandler”

Can someone please tell me how to get around this?

Thanks,
Nick

Hi Nick,

Try using ‘my’ (i.e. belonging to the current script). So your example would be:

tell application "some-app"
  ..blah..
  set x to my userHandler(x, y, z)
  ..blah..
end tell

on userHandler(x,y,z)
  ..blah..
  return a
end userHandler

Best wishes

John M

Excellent! Thank you!
I had been banging my head off of google and forum searches for a while trying to work that one out.

Thanks again,
Nick