• 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: Executing a shell command from apple script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Executing a shell command from apple script


  • Subject: Re: Executing a shell command from apple script
  • From: Christopher Nebel <email@hidden>
  • Date: Thu, 26 May 2005 12:34:37 -0700

On May 25, 2005, at 8:19 AM, Anupama Nuthakki wrote:

I am trying to run an unix shell command from my apple script,and i attached this script to a hotfolder on my desktop. The functionality of my folder action is that when i drop a tif file in to my hot folder it will call rgbseps unix  script  passing filename as one argument and output filename as 2nd argument  and separations1 as 3rd,separations2 as 4th and separations3 as 5th arguments.

Below is my code.I am getting an error like separations can't be done.Could you please help me with this

Thanks
Anu.Nuthakki
DuPont

on adding folder items to this_folder after receiving dropped_items
    set item_count to number of items in dropped_items
    repeat with i from 1 to item_count
        set the_dropped_file_path to item i of dropped_items
        set item_info to info for the_dropped_file_path
        set item_path to the quoted form of the POSIX path of the_dropped_file_path
        if name extension of item_info is "tif" then
            try
                display dialog ("Item #" & i as string) & ": " & ((POSIX path of the_dropped_file_path) as string)

                do shell script ("rgbseps  " & item_path & "  test  1.0  1.0  1.0 ")
            on error
                display dialog "Error:Can't make separations"
                return
            end try
            --end tell
        end if
    end repeat
    display dialog "Separations done"
end adding folder items to

Two suggestions:

1. "do shell script" does not (necessarily) look in the same places for commands as the Terminal.  Try specifying the complete path to rgbseps.

2. By simply displaying a constant dialog, you don't get to see what the original error was, which would be quite helpful in diagnosing the problem.  Change it to this instead:

    on error msg
        display dialog "Can't make separations: " & msg
        return
    end

If you plan on using "do shell script" much, you should read TN2065 <http://developer.apple.com/technotes/tn2002/tn2065.html>.


--Chris Nebel
AppleScript and Automator Engineering

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Executing a shell command from apple script (From: Anupama Nuthakki <email@hidden>)

  • Prev by Date: Re: Any good text editors?
  • Next by Date: Re: Any good text editors?
  • Previous by thread: Re: Executing a shell command from apple script
  • Next by thread: [ann] TextCommands 0.4.0
  • Index(es):
    • Date
    • Thread