getting collected data from another script

Apologies for being a bit of a noobie on this one (not for the first time!)

If I collected data in one script (ie. created a list of email addresses) could I get that data from another script


script 1
set b to (path to desktop)
tell application “Filemaker”
set emailaddress cell “email” of every record in document 1 as list
end tell

script 2

run script “blah:blah:script 1”

get variable emailaddress from script 1


Well here is one method, though I am sure there would be others.

emailUpdater.scpt aka (Script 1) saved to the desktop
the variable we want to retreive is a property so it saves it state until recomplied or
update from within itself ie the updateEmail handler.

property emailAddressList : {}

on updateEmail()
	set deskPath to path to desktop as Unicode text
	set fmFile to deskPath & "test.fp7"
	tell application "FileMaker Pro Advanced"
		open fmFile
		set emailAddressList to cell "email" of every record in database 1
	end tell
end updateEmail

on returnEmail()
	return emailAddressList
end returnEmail

Script 2
When you run this the first time if you choose saved state you will get nothing back, because you need
make Script 1 update it’s own property using the second option.

set deskPath to path to desktop as Unicode text
set emailPath to deskPath & "emailUpdater.scpt"
set emailLibrary to load script file emailPath

tell emailLibrary
	set collectMethod to button returned of (display dialog "Collect from?" buttons {"Saved State", "Query FM"})
	if collectMethod is "Saved State" then
		set theAddresses to returnEmail()
		set theAddresses to returnEmail()
	end if
end tell

Anyways hope that makes sense. Play around with it and feel free to ask any questions.

Happy Scripting!

Thanks James

Its that easy!!!