I have a second script objects question for you all. I have two scripts in an applescript studio project. The file - main.applescript - contains:
on launched theObject
set theScript to load script file (second.scpt)
set objectTesting to objectTesting of theScript
tell objectTesting to initialize("test")
end launched
--handler for button 1
on clicked theObject
log someProperty of objectTesting
end clicked
The second file - second.applescript - contains:
global objectTesting
--handler for button 2
on clicked theObject
log someProperty of objectTesting
end clicked
script objectTesting
property someProperty: ""
on intitalize(x)
set someProperty to x
end initialize
end script
When button 1 is clicked, “test” is returned. When button 2 is clicked, “” is returned. I’d like “test” to be returned when button 2 is clicked. That is, I’d like the two on clicked handlers to refer to the same instance of the script object defined in second.applescript.
I hope my question makes sense. I guess what it comes down to is that I’m trying to figure out how to make one instance of a script object accessible to multiple scripts within an applescript studio project. Thanks in advance for any help.