Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chidambaram

macrumors member
Original poster
Mar 9, 2008
67
0
Hi all,

I want to save the list of applications in my machine in a text file.

In terminal i did as "cd /Applications" and in next line "ls" . I received all the applications in my machine.

How can i save this list in text file using applescript.

Thanks in advance...
 

Tygernoot

macrumors member
Jul 3, 2003
69
22
Brussels
I don't know about Applescript, but you can simply do this to save the list in a text file:

cd /Applications
ls > file.txt

If you specifically need Applescript I hope someone else can help you :)
 

chidambaram

macrumors member
Original poster
Mar 9, 2008
67
0
thanks for all replies...

its working fine in terminal.

But i need in applescript...
 

steveca

macrumors 6502
Mar 9, 2005
256
0
Malta
not sure if i am understanding this right, but maybe i can help you...

Try to select all the applications and copy them. then open up textedit and paste and match style (do not paste as it wont work and will quit textedit). You will have a list of the applications you have copied...

hope it helps you
 

chidambaram

macrumors member
Original poster
Mar 9, 2008
67
0
not sure if i am understanding this right, but maybe i can help you...

Try to select all the applications and copy them. then open up textedit and paste and match style (do not paste as it wont work and will quit textedit). You will have a list of the applications you have copied...

hope it helps you

I get the list of applications. I want to save that my code is

tell application "TextEdit"
activate
make new application
tell application "Terminal"
do script "cd /Applications"
do script "ls" in window 1
end tell
end tell


how can i save the result coming in ls command in text file?
 

Guiyon

macrumors 6502a
Mar 19, 2008
771
4
Cambridge, MA
What sort of information do you need? Using the below command may be a bit more thorough:
Code:
/usr/sbin/system_profiler SPApplicationsDataType
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,852
9
USA
Here's simplified AppleScript. You don't need all those tell applications. It'll ask for a name of the file with a prompt, then use it in the output command. If it'll be a fixed name for the output you can skip the prompt and tie it in directly to the cmd. It's also currently set to save the file to your home directory.

Code:
display dialog "Enter name of file to be saved" default answer ""
set dialogInfo to result
set filename to text returned of dialogInfo
-- create command for script
set cmd to "ls /Applications/ > ~/" & filename
do shell script cmd
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.