accessing multiple scripts

I have a script called Viewer, a small section of which is shown below

on getMulti_(sender)
		--This button is for testing
		
		set hitlist to "tlable = 'Molecule 2' OR tlable = 'Molecule 5' OR tlable= 'Molecule 10'"
		set selOrUnselect to true
		set thehitlist to {hitlist, selOrUnselect}
		my tableselect_(thehitlist)
end getMulti_
	
	on tableselect_(thehitlist)
		set thehitlist to thehitlist as list
		set hitlist to item 1 of thehitlist
		log hitlist
		set selOrUnselect to item 2 of thehitlist
		log selOrUnselect
		set theArraysRows to theArrayController's arrangedObjects()
		
		set bPredicate to current application's class "NSPredicate"'s predicateWithFormat_(hitlist)
		set theSelList to theArraysRows's filteredArrayUsingPredicate_(bPredicate)
		log theSelList
		
		tell theSelList to setValue_forKey_(selOrUnselect, "isSelected")
		
		
	end tableselect_

This all work perfectly.

I now have another script called Search that allows the user to build complex queries that are run using a unix app. Shown below


property Viewer : missing value --linked in IB

set theData to do shell script the_script
				--log theData
				--set my hitlist to theData as text
-- for testing 
				set hitlist to "tlable = 'Molecule 2' OR tlable = 'Molecule 5' OR tlable= 'Molecule 10'"
				set selOrUnselect to true
				set thehitlist to {hitlist, selOrUnselect}
tell current application's Viewer
					tableselect_(thehitlist)
				end tell

For testing I have hard coded the hitlist, I’ve then tried to call tableselect_ in Viewer.

Looking at console both log hitlist and log selOrUnselect are correct but I get an error of

*** +[Viewer tableselect:]: The variable theArraysRows is not defined. (error -2753)

I do have property theArraysRows : missing value in the Viewer script so I’m not sure what I need to do?

You’re trying to call it as a method of the Viewer class, not an instance of it – that’s what the + means. Class methods can’t use properties because properties only make sense in instances (they are also known as “instance variables”).

Change:

tell current application's Viewer

to:

tell Viewer

Brilliant!!

Many Thanks