Sample Header Ad - 728x90

Getting AppleScript function to pass string correctly

1 vote
1 answer
638 views
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: "The variable theText is not defined." Does anybody see what's going on?
on strTest()
	set returntest to "this is a test"
	return returntest
end strTest

tell application "BBEdit"
	set theText to strTest()
	tell window 1
		set insertionP to get selection
		set text of insertionP to (theText & (text of insertionP))
	end tell
end tell
Asked by A Nichole (13 rep)
Aug 1, 2020, 04:02 AM
Last activity: Aug 1, 2020, 04:58 AM