I have an App that accepts user input and passes the input for processing to an applescript file that isn’t part of the Xcode project. The app has a label that displays error Messages. I want to know how I can access this label from the file?
This is the code that I have so far:
App Code:
script FormAppDelegate
property parent : class "NSObject"
property aFname : missing value
property aLname : missing value
property aWindow : missing value
property aErrorMsg : missing value
on button_commitClick_(sender)
set Firstname to aFname's stringValue() as string
set Lastname to aLname's stringValue() as string
set myLib to ((path to applications folder) as string) & "Common Scripts:Library:"
set myProclib to load script (myLib & "ProcessLib.scpt") as alias
myProclib's checkInput(Firstname, Lastname)
end button_commitClick_
end script
This is the checkInput function inside the ProcessLib.scpt file:
on checkInput(Firstname, Lastname)
if Firstname is equal to "" or Lastname is equal to "" then
aErrorMsg's setStringValue_("Required information missing.")
end if
end checkInput
Obviously this gives rise to an error “The variable aErrorMsg is not defined. (error -2753)”. Can I access the label aErrorMsg from this file?