• 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: Does the variable N have special status?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does the variable N have special status?


  • Subject: Re: Does the variable N have special status?
  • From: Matthew Smith <email@hidden>
  • Date: Mon, 04 Jan 2010 21:16:47 +1100

The reason is that you have had a variable called n already in your script and when you compile AppleScript it will change the case of any occurrence of variables to match the case of the first occurrence.

If I paste your script into my AppleScript Editor app it stays in uppercase.

As for programming style you should avoid using a single character as a variable name, even if the language allows it. The main reason is that it is not obvious what the variable is for. It is also better not to use single word nouns (e.g. point) as these may be key words in an application dictionary with a new version. In your example it would be better to have file_name instead of N and even better if you can qualify it even further (e.g. original_file_name).

Matthew Smith


On 04/01/2010, at 20:59 , Bruce Horrocks wrote:

> MacOS X 10.6.2, AppleScript 2.1.1, AppleScript Editor v2.3 (118)
>
> Paste the following script into AppleScript Editor:
>
> tell application "Finder"
>    set N to the name of a_file
> end tell
>
> Then press the compile button and the variable N is changed to lowercase. If you use Z, say, then it remains uppercase.
>
> Any reason or is this a quirk?
>
> Regards,
> --
> Bruce Horrocks
> Surrey
> England
> (bruce at scorecrow dot com)

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Does the variable N have special status? (From: Bruce Horrocks <email@hidden>)

  • Prev by Date: Does the variable N have special status?
  • Next by Date: Re: Does the variable N have special status?
  • Previous by thread: Does the variable N have special status?
  • Next by thread: Re: Does the variable N have special status?
  • Index(es):
    • Date
    • Thread