 |
 |
Can Folder Actions do this for me?
|
 |
|
 |
|
Junior Member
Join Date: Jan 2002
Status:
Offline
|
|
I have my Safari downloads configured to go into my Desktop folder. However, I'd like to automatically move all PDFs to a separate folder (say Desktop/PDFs), and THEN open them from there. Safari is configured to open the PDFs as soon as they're downloaded, but I'd like it to wait until the file is moved before it is opened.
Can anyone help me set this up?
Thanks!
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 1999
Location: Always within bluetooth range
Status:
Offline
|
|
Originally posted by Propofol:
Can anyone help me set this up?
Thanks!
You can set up an Applescript that will selectively move pdf's to a new folder and then open them. HOWEVER ... if you have "Open safe files after downloading" checked on .. it would open the pdf before you had a chance to copy it.
The only solution I see for you is to turn off "Open safe files after downloading" completely ... but then you'll have to write the script such that
If filetype is pdf then move and open file
Else if its not a pdf, then open file.
In other words, you'll have to set up the script to manually deal with ALL things Safari downloads in order to get it to treat pdfs differently than non-pdfs. Make sense ??
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jan 2002
Status:
Offline
|
|
Yes,
I'll get on it now and post my results for others to see. Thanks!
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Los Angeles
Status:
Offline
|
|
You could also leave Open safe files... on and change your download folder to Desktop/PDFs. Then just write a script that moves everything BUT PDFs from that folder to your Desktop.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Location: New York City
Status:
Offline
|
|
I have a script that automatically moves PDFs to my Documents folder. Safari opens them on download, but they are still moved to the Documents folder.
Here's what I use:
Code:
on adding folder items to this_folder after receiving these_items
try
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set the item_info to the info for this_item
if the name extension of the item_info is "pdf" then
tell application "Finder" to move these_items to folder "Documents" of folder "zachs" of folder "Users" of startup disk
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end if
end try
end adding folder items to
Replace "zachs" with your short user name.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 1999
Location: Always within bluetooth range
Status:
Offline
|
|
Originally posted by zachs:
I have a script that automatically moves PDFs to my Documents folder. Safari opens them on download, but they are still moved to the Documents folder.
Hmmm ... so that actually works ? I was just guessing that it wouldn't work via an applescript since it would be in use by Safari already. But hey, if it works .. it works
Actually aaanorton's idea sounds like a good one as well. The desktop is used so commonly, it makes sense to attach the script to a lesser used folder (eg a dedicated "downloads" folder) and selectively copy back OUT to the desktop. Otherwise .. how would you ever be able to simply place a pdf on the desktop without it being whisked away immediately ?
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: May 2001
Location: Brisbane, Australia
Status:
Offline
|
|
Originally posted by zachs:
I have a script that automatically moves PDFs to my Documents folder. Safari opens them on download, but they are still moved to the Documents folder.
Here's what I use:
< code >
Replace "zachs" with your short user name.
I got a syntax error on the last line.
Syntax Error
A property can't go after this identifier.
end [adding folder] items
[ ] = selection.
PS. The Make new apple script Service is excellent in combination with web forums 
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 2001
Location: London
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Sep 2000
Location: Cupertino, CA USA
Status:
Offline
|
|
Originally posted by zachs:
I have a script that automatically moves PDFs to my Documents folder. Safari opens them on download, but they are still moved to the Documents folder.
Here's what I use:
Code:
on adding folder items to this_folder after receiving these_items
try
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set the item_info to the info for this_item
if the name extension of the item_info is "pdf" then
tell application "Finder" to move these_items to folder "Documents" of folder "zachs" of folder "Users" of startup disk
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end if
end try
end adding folder items to
Replace "zachs" with your short user name.
Good work! A couple things:
1) use the generic term "home" instead of hard-coding the path
2) the logic was a bit off in the repeat and it was attempting to move the entire group of items each time
Code:
on adding folder items to this_folder after receiving these_items
try
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set the item_info to the info for this_item
if the name extension of the item_info is "pdf" then
tell application "Finder" to move this_item to folder "Documents" of home
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end if
end try
end adding folder items to
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jan 2002
Status:
Offline
|
|
OK, the following script does what I wanted it to - it changes the location to the "Safari Downloads  DFs" folder, and then it opens the file. For all other file types, it simply opens the file with the appropriate application. As Krusty mentioned all files must be opened by the script, and therefore the Safari option "Open safe files after downloading" must be disabled.
Thanks to all who responded!
--------------------------------------
Code:
on adding folder items to this_folder after receiving these_items
try
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set the item_info to the info for this_item
if the name extension of the item_info is "pdf" then
tell application "Finder" to move this_item to folder "Safari Downloads:PDFs" of desktop
tell application "Finder" to open this_item
else
tell application "Finder" to open this_item
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end if
end try
end adding folder items to
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2002
Location: New York City
Status:
Offline
|
|
Originally posted by Sal:
Good work! A couple things:
1) use the generic term "home" instead of hard-coding the path
2) the logic was a bit off in the repeat and it was attempting to move the entire group of items each time
1. Yeah, I was trying "home folder", which wasn't working. So now I know it's just "home".
2. You didn't change anything? Do you have any suggestions on how to do it better?
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|