This functions as a droplet app. Save as an app and drop the files on top of it. The next email will have the structure for a watch folder.
Since I'm working in shell scripting, I use POSIX paths in this.
This converts images to PNG files.
-- Alex Zavatone
on xrun()
set myFile to "Macintosh HD:01.jpg"
Process(myFile)
end xrun
on open myFiles
set oldDelimiter to AppleScript's text item delimiters
repeat with myFile in myFiles
set ItemInfo to the info for myFile
if not folder of ItemInfo then
Process(myFile)
end if
end repeat
set AppleScript's text item delimiters to oldDelimiter
-- set myFile to "Macintosh HD:01.jpg"
end open
on Process(myFileAlias)
set myFile to myFileAlias as string
set AppleScript's text item delimiters to ":"
set myItemCount to the number of text items in myFile
set myFileName to the last text item of myFile
set myFilePath to text items 1 through (myItemCount - 1) of myFile
set AppleScript's text item delimiters to "."
set myItemCount to the number of text items in myFileName
set myExtension to the last text item of myFile
set myShortFilename to text items 1 through (myItemCount - 1) of myFileName
set AppleScript's text item delimiters to ""
set myPosixFile to the POSIX path of myFile
-- display dialog "myPosixFile " & myPosixFile
set AppleScript's text item delimiters to ":"
set newItem to myFilePath & myShortFilename as string
set AppleScript's text item delimiters to ""
set newItem to newItem & "-.png" as string
-- display dialog "newItem " & newItem
set myPosixNewItem to the POSIX path of newItem
-- display dialog "myPosixNewItem " & myPosixNewItem
set myShellString to "sips -s format png -s '" & myPosixFile & "' --out '" & myPosixNewItem & "'"
-- do it
do shell script myShellString
-- tell application "Finder" to set the label of newItem to "Green"
end Process
On Mar 11, 2010, at 11:59 AM, Richard Lake wrote:
Hi Alex,
Yeah I only need some basic structure to how this achieved. Google isn't yielding anything productive. I am currently looking at the possibility of using Adobe Acrobat's Distiller Applescript dictionary to see if that will help. ^^
I really need some direction on this one as I have hunted around for a for few days and getting no-where. :(
On 11 Mar 2010, at 17:53, Alex Zavatone wrote:
Want some code for that?
I can give you the basics and you can fill in the rest.
It's not perfect, parts of it are ugly and when doing file referencing, I ALWAYS (as in always) forget to wrap the file code in a Tell application "Finder" block.
Hi all,
I've been hunting around for a solution for what seems a popular request on the archives of the mailing list over the years.
How to let PC users drop EPSes in a folder and have them converted to a PDF on the fly?