Getting AppleScript function to pass string correctly Someone please help me here and show me how to get this to work. I've checked examples on returning values from functions with this AppleScript, but something I am missing here.
I'm trying to get the function, strTest(), to pass a string that will then be printed to the BBEdit editor. If I were to replace the variable with a static string, that works. But this isn't working at all. I'm getting: &quot;The variable theText is not defined.&quot;
Does anybody see what's going on?
on strTest()
    set returntest to &quot;this is a test&quot;
    return returntest
end strTest

tell application &quot;BBEdit&quot;
    set theText to strTest()
    tell window 1
        set insertionP to get selection
        set text of insertionP to (theText &amp; (text of insertionP))
    end tell
end tell
If you are going to call a handler from within an application's tell block, use the my reserved word in front of the handler, e.g.:
set theText to my strTest()