Results 1 to 3 of 3
  1. #1


    Member Since
    Sep 24, 2009
    Posts
    3
    Post Terminal vs. Applescript
    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.

  2. #2

    Sur3Mac's Avatar
    Member Since
    Aug 03, 2009
    Location
    The Netherlands
    Posts
    1,563
    Specs:
    Late 2011 MBP 13" i5/16GB RAM,Early 2007 MB white 13", 2x TV 3rd Gen, ᣦ
    Someone will come along who will actually know this, but it's way out of my league.

    Good luck

  3. #3


    Member Since
    Sep 24, 2009
    Posts
    3
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Basic AppleScript w/Terminal Question
    By salgala2000 in forum OS X - Development and Darwin
    Replies: 1
    Last Post: 03-14-2012, 03:30 PM
  2. Applescript to Copy from Clipboard to Terminal
    By kspin in forum OS X - Apps and Games
    Replies: 3
    Last Post: 12-11-2009, 11:37 PM
  3. Use Applescript to run a terminal command
    By Turk182 in forum OS X - Development and Darwin
    Replies: 1
    Last Post: 02-12-2009, 12:08 PM
  4. Applescript and Terminal applications
    By Ge64 in forum OS X - Operating System
    Replies: 0
    Last Post: 09-17-2008, 08:46 AM
  5. Terminal and Applescript
    By bigpixl in forum OS X - Development and Darwin
    Replies: 0
    Last Post: 08-09-2005, 12:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •