On 23 Dec 2014, at 9:38 am, Brian Christmas <email@hidden> wrote:
Thanks Shane, but I’m still struggling with trying to get my head around calling a Class, and calling an Instance.
Here's a script:
tell application "Finder" set x to name of file end tell
Why won't it do anything?
All I know is that when I used…
set temp to current application's MainProcessingLoops's mainLoop:{mailManagerDesktopFolderPath, MailBoxProcessName, MailBoxStoreName, MailBoxReCycleName, ReCycleFlag, sayEveryErrorMessage, theMailManagerState, MMWorkingDate, theLastMidnight, ftpPrintFlag, serverFolder, dailyServerFolder, yearlyEmailOrdersServerFolder, didItPrint, serverBackupState, RunForOz, mainMessagesView, dailyName, theZeroedDate, dailyServerEmailStorage, theMailManagerErrorMessages}
It worked, (and most of the variables are properties), but when I use…
set temp to current application's OddsNSods's setPathToMMFolder:{mailManagerDesktopFolderPath} # Note this property is being used successfully in the method above
It's failing because you're presumably trying to use properties defined in OddsNSods in setPathToMMFolder:, and you didn't in mainLoop:. You're doing the equivalent of the script I posted above: you're asking a class to give you something that only an instance stores. how can I call a script ‘delegate’ when the script is called ‘AppDelegate’???
So let's say you have an NSString stored in a variable called myString, and you want to get its length. What would you ask: the class NSString, or the instance referred to by myString? It's exactly the same situation.
You don't want to call a script -- a script is a class. You want to call an instance of that class -- the one that is the delegate of your application. I’ve spent most of the night trying to find a terminology that did not work.
Stop banging on at trial-and-error code. The fact that it sometimes works is only confusing you further. You need to understand the *concept* first. A class is like a template, but only instances can store values in the form of properties.
|