|
|
#1 |
|
Prospect
Join Date: Feb 2013
Posts: 3
|
open file that has been added to a folder
Hi guys,
i'm mostly new to scripting, besides a few little "new txt-file"-scripts ... but i wanted to add a function to my system: i'd like have automatically opened all new (txt-)files that will be added to a certain folder. i thought i'd use launchd and the 'watchpath'-function, but i don't get it, how i exactly to write the script ... anyone to give me a little tutorial? thanks Tim |
|
|
|
|
|
#2 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,938
|
Google for: applescript folder actions
__________________
hayne.net/macosx.html |
|
|
|
|
|
#3 |
|
Prospect
Join Date: Feb 2013
Posts: 3
|
thank you, i should have mentioned, that was something i thought first of.
But i wasn't sure how to replace the alert-message part with a correct string to open the newly added files. I tried this: Code:
on adding folder items to this_folder after receiving added_items try tell application "Finder" --get the name of the folder set the folder_name to the name of this_folder end tell -- find out how many new items have been placed in the folder set the item_count to the number of items in the added_items --create the alert string if the item_count is greater than 1 then tell application "Finder" activate open the added_items end tell end if end try end adding folder items to |
|
|
|
|
|
#4 |
|
Hall of Famer
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,945
|
I use Hazel to do that, but for setting up launchd, I recommend Lingon 3. Either of those approaches is much more reliable than a Folder Action.
__________________
17" MBP, OS X 10.8.3; 27" iMac, OS X 10.8.3 |
|
|
|
|
|
#5 |
|
Prospect
Join Date: Feb 2013
Posts: 3
|
great, thank you! Hazel did the trick for me!
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|