• 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: Labels and tags ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Labels and tags ?


  • Subject: Re: Labels and tags ?
  • From: Jean-Christophe Helary <email@hidden>
  • Date: Tue, 03 Mar 2015 14:47:48 +0900

It's been more than a month, but I eventually was able to check all that *and* make that work on my side. What a relief.

Now, I'm going to rewrite my job management script so that I can use it with the tag system, and then, I'll dig into all that to see how it really works :)

I've an idea for an application that deals with XML (subject of a recent thread) and I'm going to need some help too :)

Thank you again !

Jean-Christophe 

On Jan 24, 2015, at 20:52, Shane Stanley <email@hidden> wrote:

On 24 Jan 2015, at 10:14 pm, Shane Stanley <email@hidden> wrote:

tell application "Finder"
set project_folders to (make folder at project_location with properties {name:project_name}) as alias
end tell

Mind you, there's no reason to bother the Finder at all:

use scripting additions
use framework "Foundation"

set project_name to "My smashing project"
set project_location to choose folder with prompt "Choose folder:" --default location "/Default/path/to/folder"
set folderPath to (project_location as text) & project_name
my makeFolderAt:(POSIX path of folderPath)
my setTags:{"courant"} forPath:(POSIX path of folderPath)

on setTags:tagList forPath:posixPath -- set the tags, replacing any existing tags
set aURL to current application's |NSURL|'s fileURLWithPath:posixPath -- make URL
aURL's setResourceValue:tagList forKey:(current application's NSURLTagNamesKey) |error|:(missing value)
end setTags:forPath:

on makeFolderAt:posixPath
set theNSFileManager to current application's NSFileManager's defaultManager() -- get the file manager
set {theResult, theError} to theNSFileManager's createDirectoryAtPath:posixPath withIntermediateDirectories:true attributes:(missing value) |error|:(reference)
if theResult as boolean is false then -- happens if there was an error
error (theError's localizedDescription() as text) -- throw an error with the description
end if
end makeFolderAt:

One of the advantages of making folders this way is that it can create any intermediary folders required.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
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
  • Prev by Date: Re: XML script library?
  • Next by Date: Scripting SMS messages
  • Previous by thread: AUTO: Allyn Martin is out of office.
  • Next by thread: Scripting SMS messages
  • Index(es):
    • Date
    • Thread