Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 15, 2009, 12:59 AM   #1
laynef
macrumors newbie
 
Join Date: Oct 2009
Copy names of folders, inside a folder and paste to a text doc

Hi, I'm trying to write an applescript to help me archive. I need a script to copy the names of the folders (which are jobs) and paste them into a text file.
laynef is offline   0 Reply With Quote
Old Oct 15, 2009, 01:12 AM   #2
chown33
macrumors 603
 
Join Date: Aug 2009
In Finder:
1. Open the folder.
2. Select all (command-A).
3. Copy (command-C).

In TextEdit:
4. Open a new or existing document.
5. Paste (command-V).

It took me at least 10 times longer to write this than to perform the actions.

Do you really need to write a script? Are these actions going to be performed repeatedly, without human intervention?

If you need a script, try this example:

Code:
list folder (path to home folder)
Paste it into Script Editor and run it. Note that it returns a list. So walk the list, or remove its first item until it's empty, appending each name to a string. Finally, write the string to a file.

If you can't figure it out from the example, please describe your scripting experience, and whether it needs to list the contents of a certain fixed folder, or the contents of any folder you choose.

Last edited by chown33; Oct 15, 2009 at 01:40 AM.
chown33 is offline   0 Reply With Quote
Old Oct 15, 2009, 05:37 AM   #3
mysterytramp
macrumors 65816
 
mysterytramp's Avatar
 
Join Date: Jul 2008
Location: Maryland
You don't need to walk the list. This will return a return-delimited list:

Code:
set dummyList to list folder (path to home folder)
set TID to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set dummyList to dummyList as text
set AppleScript's text item delimiters to TID
dummyList
mt
__________________
What looks large from a distance, close up ain't never that big.
mysterytramp is offline   0 Reply With Quote
Old Oct 15, 2009, 06:02 AM   #4
Angelo95210
macrumors 6502a
 
Angelo95210's Avatar
 
Join Date: Jan 2009
Location: Paris, France
Or there is a little free piece of software named "Print Window" that does it very well. Exports to excel, with spotlight comments etc.
__________________
Hackintosh G31M-S2L - Macbook 3,1
Angelo95210 is offline   0 Reply With Quote
Old Oct 15, 2009, 10:05 AM   #5
laynef
Thread Starter
macrumors newbie
 
Join Date: Oct 2009
Ok the copy and paste didn't work, it just pasted the folder icons into a text document. I tried the other script and that worked, although it made the of text go from 10,11,12,13,14,2,3,4,5,6,7,8,9. Is there any way to do it numerically? It doesn't matter that much, my next question is I can get it work on my local computer by using the path "Macintosh_HD:Users:admin:test"
Where Macintosh_HD is my computer and test is the folder I want to get the names out of. How do I do this off a mounted volume? I can't get it read off of there. This is what the path would be using UNC \\xraid1\Rsi Jobs.standby
my other question is there is a space in the folder name, will it let me use the name with a space?
laynef is offline   0 Reply With Quote
Old Oct 15, 2009, 10:15 AM   #6
Darth.Titan
macrumors 68020
 
Darth.Titan's Avatar
 
Join Date: Oct 2007
You need to go to the Format menu and click "Make Plain Text" before pasting in TextEdit.
Darth.Titan is offline   0 Reply With Quote
Old Oct 15, 2009, 08:47 PM   #7
mysterytramp
macrumors 65816
 
mysterytramp's Avatar
 
Join Date: Jul 2008
Location: Maryland
Quote:
Originally Posted by laynef View Post
Is there any way to do it numerically?
If you add the leading zero to the file name, it will:

01, 02, 04=3, 04 ,05, 06, 07, 08, 09, 10, 11, etc.

but if the files are named 1, 2, 3, 4, ... you'll get what you found.

Quote:
Originally Posted by laynef View Post
How do I do this off a mounted volume?
You have a couple of options. You can hard code the path:

set dummyList to list folder ("Volume name:First Folder:Second Folder:Third Folder") -- see? it works with spaces

You can also use a Posix path:

set dummyList to ("/Library/Contextual Menu Items/")

or you could give yourself more options by saying:

set dummyList to list folder (choose folder)

mt
__________________
What looks large from a distance, close up ain't never that big.
mysterytramp is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
do any of you have a weirdly named folder inside DCIM folder? pixelchild iPhone 2 Oct 16, 2011 06:49 PM
Need help when changing the name of the home directory folder in Lion huntert93 Mac OS X 10.7 Lion 3 Sep 20, 2011 05:31 PM
How to Copy and Paste to desktop dogtag1968 Mac Basics and Help 2 Apr 20, 2009 03:11 AM
Easy way to gather the names of all files or folders that are in one place? BeyondMountains Mac Pro 3 Nov 25, 2008 01:24 PM
Copy and Paste to Desktop Doesn't Work soccersquirt82 Mac Basics and Help 6 Apr 7, 2008 03:17 PM


All times are GMT -5. The time now is 11:37 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC