Stefan helped me with following shell/script. It is folder action script which uploads files to the FTP server
property ftpserverPath : "ftp://123.456.789.9/abc/defhij/kl/"
property user_name : "xxx"
property pass_word : "yyy"
on adding folder items to this_folder after receiving added_items
set added_items to choose file with multiple selections allowed
repeat with this_item in added_items
set fileName to name of (info for this_item)
do shell script "/usr/bin/curl " & quoted form of (ftpserverPath & fileName) & " -u " & user_name & ":" & pass_word & " -T " & quoted form of POSIX path of this_item
end repeat
end adding folder items to
My question is…can cURL shell scripts be used for afp? Can the above be modified to do afp transfer?
and can it be used to send files to a mounted or unmounted volume>folder
to move or copy files from and to the local network, use the shell commands /bin/mv (move), /bin/cp (copy)
or /usr/bin/ditto (copy with ability to create or extract zip files and create intermediate directories)
Acrobat Distiller has a Watch Folder feature. Essentially, you point it at a folder and it nests a IN and OUT within the folder.
If you export a EPS file to the IN folder - Distiller takes that EPS file and automatically generates a PDF into the OUT folder.
You can set Distller to delete the EPS from the IN folder or pass it to the OUT folder (along with the PDF)
Now here is will the script comes in:
Since I am able to send the original EPS to the OUT folder (which will also contain its PDF offspring), I would like to write a script that
would send the EPS to one Volume and the PDF to another. IF PDF Then Shell Script/Move To FileServer Path ELSE Shell Script/Move To FileServer Path.
Make sense?? Easy peasy right? (nothing is easy…lol)
would i still need the transfer function ( " -T " & quoted form of POSIX path of this_item) I tried it with it and it does compile
the script assumes, that the server is mounted and the destination folders for eps and pdf files are in the same base folder
adjust the literal strings to your appropriate values, save the script in /Library/Scripts/Folder Action Scripts and attach it to the Out folder.
The slash character at the end of the destinationFolder variable is necessary
on adding folder items to thisFolder after receiving theseItems
repeat with oneItem in theseItems
set {name:Nm, name extension:Ex} to info for oneItem
if Ex is "pdf" then
set destinationFolder to "PDF/"
else
set destinationFolder to "EPS/"
end if
do shell script "/bin/mv " & quoted form of POSIX path of oneItem & space & quoted form of ("/Volumes/myServer/path/to/" & destinationFolder & Nm)
end repeat
end adding folder items to
Thank you for the above but I am still having trouble with mounting volume and move function.
property displayserverPath : "afp://x:y@111.111.111.11/AD-GRAPHICS/Display Ads HighRes Folder/"
on adding folder items to this_folder after receiving added_items
repeat with this_item in added_items
set vol to displayserverPath
mount volume vol
set fileName to name of (info for this_item)
do shell script "/usr/bin/mv" & quoted form of (displayserverPath & fileName) & " -T " & quoted form of POSIX path of this_item
end repeat
end adding folder items to
it mounts the volume nicely (have to figure out how to unmounted once the mv is complete) but the real issue is that it doesnt move the file
ok…i see what you are doing in the above…i will give it a try
Of course you have, because the syntax in the shell script line is completely messed up. mv is in /bin and there is no -T parameter at all, the proper syntax is /bin/mv path/to/source /path/to/destination
To mount a shared volume you need the AFP address like afp://user:pass@server/sharedVolume
Once the shared volume is mounted, the path is /Volumes/sharedVolume
property serverAddress : "afp://x:y@111.111.111.11/AD-GRAPHICS"
property serverPath : "/Volumes/AD-GRAPHICS/Display Ads HighRes Folder/"
on adding folder items to thisFolder after receiving theseItems
if "AD-GRAPHICS" is not in "/bin/ls /Volumes" then
mount volume serverAddress
end if
repeat with oneItem in theseItems
set {name:Nm, name extension:Ex} to info for oneItem
if Ex is "pdf" then
set destinationFolder to "PDF/"
else
set destinationFolder to "EPS/"
end if
do shell script "/bin/mv " & quoted form of POSIX path of oneItem & space & quoted form of (serverPath & destinationFolder & Nm)
end repeat
end adding folder items to
Note: the folders /Volumes/AD-GRAPHICS/Display Ads HighRes Folder/EPS and /Volumes/AD-GRAPHICS/Display Ads HighRes Folder/PDF must exist
property serverAddress : "afp://x:y@111.111.111.11/AD-GRAPHICS"
property serverPath : "/Volumes/AD-GRAPHICS/"
on adding folder items to thisFolder after receiving theseItems
if "AD-GRAPHICS" is not in "/bin/ls /Volumes" then
mount volume serverAddress
end if
repeat with oneItem in theseItems
set {name:Nm, name extension:Ex} to info for oneItem
if Ex is "pdf" then
set destinationFolder to "Display Ads High PDF Folder/"
else
set destinationFolder to "Display Ads High EPS Folder/"
end if
do shell script "/bin/mv " & quoted form of POSIX path of oneItem & space & quoted form of (serverPath & destinationFolder & Nm)
end repeat
end adding folder items to
Does that make sense? Becuase in reality the two folders arnt going to be labeled PDF or EPS…I could lable them andything I want as long as the exist as they are defined.
Plus, the PDF will be going to one volume and folder and the EPS files will be going to whole other Volume and folder.
My guess is I could hard write the path into each shell…instead of calling out two different properties?? Either way… right?
You can do (almost) everything.
If the paths are completely different, I recommend to use 2 different shell lines
property serverAddress : "afp://x:y@111.111.111.11/AD-GRAPHICS"
property PDFPath : "/Volumes/AD-GRAPHICS/Display Ads HighRes Folder/Display Ads High PDF Folder/"
property EPSPath : "/Volumes/otherVolume/path/to/Display Ads High EPS Folder/"
on adding folder items to thisFolder after receiving theseItems
if "AD-GRAPHICS" is not in "/bin/ls /Volumes" then
mount volume serverAddress
end if
repeat with oneItem in theseItems
set {name:Nm, name extension:Ex} to info for oneItem
if Ex is "pdf" then
do shell script "/bin/mv " & quoted form of POSIX path of oneItem & space & quoted form of (PDFPath & Nm)
else
do shell script "/bin/mv " & quoted form of POSIX path of oneItem & space & quoted form of (EPSPath & Nm)
end if
end repeat
end adding folder items to
thank you!! that works
but now i have to back up…
ugh i forgot the limitation of Distiller watch folders…the need to be upper level folders and not nested.
so if you must export your EPS files to 8 different volumes (depending on what publication the doc belongs too …the naming constraints are all the same 12345.EPS)
…you will need 8 different watch folders with the 8 volumes mounted on the desktop… thats a bit of desktop clutter
i guess i will need the “mount the volume” portion of the script… so that i can minimize the clutter.
is there a way to hide the volume? make them invisible? or disconnect from them after the export has been complete?
OR should I script Distiller? - mimic the watch folders process? create a folder action script for a IN folder that says upon adding items to this folder tel distiller make a pdf using these distller prefs - move the resulting PDF to OUT folder - move orginal EPS to OUT and then let the move move if then move shell do its thing.
UGH UGH UGH!
or MAYBE i wouldnt even need an out folder? could I do upon adding items make a PDF wait 10second then move the contents (if PDF go here…if EPS go there) to he appropriate volume?
ok i am officially over my head with distiller…can it even be scripted?
what would happen if i put distiller on the volume and created a script for each individual folder - upon adding items it would copy then distill then move…but what would happen if multiple users all EPS to a single folder at the same time.
does this make sense?? sort of? kind of? no : (
(i am the poster child for script illiteracy)
on adding folder items to thisFolder after receiving theseItems
repeat with this_item in added_items
tell application "Acrobat Distiller 7.0"
set resultAnything to Distill this_item
sourcePath is POSIX path of thisFolder
adobePDFSettingsPath / me / Library / Preferances
destinationPath is POSIX path of thisFolder
end tell
end repeat
end adding folder items to
the file won’t move… it would just create a pdf in the source folder…so you end up with the original EPS and the PDF in the same folder
on adding folder items to thisFolder after receiving theseItems
repeat with this_item in theseItems
tell application "Acrobat Distiller"
Distill sourcePath quoted form of POSIX path of this_item ¬
destinationPath quoted form of POSIX path of thisFolder ¬
adobePDFSettingsPath "Standard"
end tell
end repeat
end adding folder items to
the parameters adobePDFSettingsPath and destinationPath are optional
Caution: creating the PDF file in the same folder causes a infinite loop, because the new file will trigger the folder action again.
It’s recommended to use a different folder or filter the .ps files
property outfolder : "/Users/sawtooth/Desktop/"
on adding folder items to thisFolder after receiving theseItems
repeat with this_item in theseItems
tell application "Acrobat Distiller 7.0"
Distill sourcePath quoted form of POSIX path of this_item ¬
destinationPath quoted form of outfolder ¬
adobePDFSettingsPath "Standard"
end tell
end repeat
end adding folder items to
it manages to launch distiller but it doesnt do anything…i thought maybe it would be easier to have it drop the pdf on the desktop