JavaScript for Automation curiosity (was "Script that "Tells" Finder just Focuses on Finder instead of running")
JavaScript for Automation curiosity (was "Script that "Tells" Finder just Focuses on Finder instead of running")
- Subject: JavaScript for Automation curiosity (was "Script that "Tells" Finder just Focuses on Finder instead of running")
- From: 2551 <email@hidden>
- Date: Mon, 05 Jan 2015 18:12:43 +0700
> On 4 Jan 2015, at 22:00, 2551 <email@hidden> wrote:
>
> If the former is wanted, I'd suggest going into Cocoa and using the NSFileManager Foundation class (it might be interesting to play around with that using JSA).
Branching from Alex's thread about recursively enumerating a folder, I thought I'd see if I could do this with Cocoa and JavaScript for Automation. Here's what I came up with:
var filePath = Path('/Users/sphil'); //my home directory
var fm = $.NSFileManager.defaultManager;
var contents = $.NSArray.alloc.init;
contents = fm.subpathsOfDirectoryAtPathError(filePath.toString(), $());
This works fine for small to medium sized folders. It works on my Downloads folder, which is a couple of levels deep, returning in a few seconds. However, it totally chokes on my home folder (the script is still running after 2 minutes, which I consider a fail. I never let it run longer than that to see if it would ever complete).
I'm curious to know why that should be the case, and whether others get the same "small success / large fail" effect.
Best
Phil
_______________________________________________
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