• 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: New to OS 10 help Please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New to OS 10 help Please


  • Subject: Re: New to OS 10 help Please
  • From: Andrew Oliver <email@hidden>
  • Date: Tue, 01 Apr 2003 15:32:49 -0800

The simplest way is not to select any items at all

Since it looks like you're trying to collapse multiple subfolders into one
folder, a simple recursive script will do the job much better:

property destFolder : "Macintosh HD:MOVED" -- or wherever the destination
folder is

tell application "Finder"
set sourceFolder to folder "MOVE ME" -- of disk "blah", etc.
my moveFilesFrom(sourceFolder)
end tell

on moveFilesFrom(thisFolder)
tell application "Finder"
set filesToMove to every file of thisFolder
repeat with aFIle in filesToMove
move aFIle to folder destFolder
end repeat
set subFolders to (every folder of thisFolder)
repeat with aFolder in subFolders
my moveFilesFrom(aFolder)
end repeat
end tell
end moveFilesFrom

The idea here is that the script tells the finder to move 'every file' in
the folder. It then gets a list of every folder inside the current folder
and calls itself. This will repeat through all subfolders until all files
are moved.

It doesn't rely on any kind of object selection in the Finder, so it can run
quietly in the background while the user is performing other tasks -
something you can't do it you're trying to move the selected item in the
Finder.

On 4/1/03 11:53 AM, "email@hidden" <email@hidden> wrote:

> Having just migrated to OS X I have a script (from OS9 ) that I use a lot and
> can't figure out how to get it to work in OS X. I am trying to pull all the
> files out of a large number of folders and put them into one folder. I
> understand finder is different in 10 but can't figure out how to just select
> the files and not the folders.... I get "Finder got an error: Can't set
> expanded of selection to true" from the following script....
> tell application "Finder"
> with timeout of 300 seconds
> activate
> select {every folder of folder "MOVE ME"}
> set expanded of selection to true
> select {every item of every folder of folder "MOVE ME"}
> move selection to folder "MOVED"
> end timeout
> end tell
>
> Thanks for any help in this matter.
> Mark
> email@hidden
> _______________________________________________
> applescript-users mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/applescript-users
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: New to OS 10 help Please
      • From: Michelle Steiner <email@hidden>
References: 
 >New to OS 10 help Please (From: email@hidden)

  • Prev by Date: Re: Getting/setting the selection in cocoa apps
  • Next by Date: Re: Occasional missing value from Finder command
  • Previous by thread: New to OS 10 help Please
  • Next by thread: Re: New to OS 10 help Please
  • Index(es):
    • Date
    • Thread