New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

OS 10.5 - Terminal vs. Applescript

Post Reply New Thread Subscribe

Thread Tools

Member Since: Sep 24, 2009
Posts: 3
tgaleza is on a distinguished road

tgaleza is offline
I run the following script successfully in terminal in order to split an mp3 file into 3 smaller mp3 files...

split -b 8667k -a1 Monday.mp3 Levin-Hour_; ls Lev* | sed "s/.*/mv '&' '&.mp3'/g" | zsh

However, when I run a similar script within Applescript using the 'do shell script' command, the files split yet none of the 3 newly created files include the 'mp3' extension (they are in mp3 format however). Although I realize that I can simply rename the files within Applescript, the purist in me wants to know how to fix this. Here's what my Applescript command looks like...

do shell script "split -b 8667k -a1 Monday.mp3 Levin-Hour_; ls Lev* | sed " & "s/.*/mv '&' '&.mp3'/g" & "| zsh"

By the way, I know that I can easily split the file via a GUI editor. However, I am trying to run an automated script that downloads several files in a scheduled fashion. Therefore, I want to correct this via scripting if at all possible.

Any insight would be greatly appreciated.
QUOTE Thanks

Sur3Mac's Avatar
Member Since: Aug 03, 2009
Location: The Netherlands
Posts: 1,563
Sur3Mac is a jewel in the roughSur3Mac is a jewel in the roughSur3Mac is a jewel in the rough
Mac Specs: Late 2011 MBP 13" i5/16GB RAM,Early 2007 MB white 13", 2x TV 3rd Gen, ᣦ

Sur3Mac is offline
Someone will come along who will actually know this, but it's way out of my league.

Good luck

QUOTE Thanks

Member Since: Sep 24, 2009
Posts: 3
tgaleza is on a distinguished road

tgaleza is offline
It's amazing how a good night's sleep can help one solve a problem. For those who ever want to do something similar using Applescript, I got it to work with these two lines...

set TheScript to "s/.*/mv '&' '&.mp3'/g"

do shell script "split -b 8667k -a1 Monday.mp3 Levin-Hour_; ls Lev* | sed " & quoted form of TheScript & "| zsh"

Bottom line - since the actual shell command included a statement with double quotes, I had to use Apple's quoted form statement to insure that the compiler read the double quotes as part of the script instead of just normal double quotes that would surround a string.
QUOTE Thanks

Post Reply New Thread Subscribe

« Editing my icons! | receive certain e-mails the text is garbled »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Starter
Last Post
Use Applescript to run a terminal command Turk182 OS X - Development and Darwin 1 02-12-2009 12:08 PM
Applescript to input terminal Password db2six9 OS X - Operating System 2 12-01-2008 10:36 PM
Applescript and Terminal applications Ge64 OS X - Operating System 0 09-17-2008 08:46 AM
Terminal and Applescript bigpixl OS X - Development and Darwin 0 08-09-2005 12:34 PM
Terminal Help rs2sensen OS X - Apps and Games 1 04-25-2005 10:52 PM

All times are GMT -4. The time now is 02:41 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?