• 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: Simple Syntax Question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple Syntax Question...


  • Subject: Re: Simple Syntax Question...
  • From: Don Fuller <email@hidden>
  • Date: Sun, 3 Aug 2008 22:20:59 -0500

Thanks Ed,

That works perfectly. I tried to avoid the verbose file reference but that was another mistake I was making and found that I was able to "fix" it by using that file reference.
Thanks for the code example for me to compare what I did to something that works.


Don
Coast Posters and Photography
"My part-time profession and full-time passion"


On Aug 3, 2008, at 10:11 PM, Ed Stockly wrote:


...but not for me, apparently. I am trying to check a known, specific directory for folders that contain only one directory. When those directories are found they are to be labeled "RED" so that they can subsequently be manually checked and deleted.

You're on the right track.

Here's how I would handle this:

tell application "Finder"
set checkFolder to folder "MBPro:Users:donmini:Desktop:Test Directory:"
repeat with a from 1 to (count of items of checkFolder)
if (count of items of (item a of checkFolder)) = 1 then
set label index of item a of checkFolder to 2
end if
end repeat
end tell


I avoid this method of file reference:

folder "Test Directory" of folder "Desktop" of folder "donmini" of folder "Users" of disk "MBPro"

I find this much easier to work with:
  folder "MBPro:Users:donmini:Desktop:Test Directory"

To get the finder to return the simpler file reference coerce it to text:

testFolder as text

Also, simply asking appleScript for the count of the folder won't work.

In my version those commands are included in the Finder tell and the Finder gets a list of items in the folder and appleScript counts the items in the list. (I added some optional parens () in the script to better illustrate what's happening)

It should be simple but I obviously have my syntax all fouled up. Can someone provide some insight into what I'm missing or doing wrong?


Once you get the hang of it, it is pretty simple, but even AppleScript has a learning curve!

HTH,

ES

_______________________________________________ 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: 
 >Simple Syntax Question... (From: Don Fuller <email@hidden>)
 >Re: Simple Syntax Question... (From: Ed Stockly <email@hidden>)

  • Prev by Date: Re: Simple Syntax Question...
  • Next by Date: Re: Simple Syntax Question...
  • Previous by thread: Re: Simple Syntax Question...
  • Next by thread: Re: Simple Syntax Question...
  • Index(es):
    • Date
    • Thread