• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unusual calling script problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unusual calling script problem


  • Subject: Re: Unusual calling script problem
  • From: Shane Stanley <email@hidden>
  • Date: Tue, 23 Dec 2014 10:03:44 +1100

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.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Unusual calling script problem
      • From: Brian Christmas <email@hidden>
References: 
 >Re: Unusual calling script problem (From: Shane Stanley <email@hidden>)
 >Re: Unusual calling script problem (From: Brian Christmas <email@hidden>)

  • Prev by Date: Re: Unusual calling script problem
  • Next by Date: Re: Unusual calling script problem
  • Previous by thread: Re: Unusual calling script problem
  • Next by thread: Re: Unusual calling script problem
  • Index(es):
    • Date
    • Thread