Posts

Showing posts with the label AppleScript

How to open file in some applicationl with AppleScript

The one way is: set the_application to path to application "TextEdit" tell application "Finder" open the_file using the_application end tell but the best seems to be: set f to choose file of type "TEXT" tell application "Finder" set a to application file id "com.apple.TextEdit" open f using a end tell

Folder Action to create TODAY folder

The script below, if used as Folder Action Script, will authomatically create a folder with the current date as a name and link to it named _Today in every folder for which the corrspondent action is activated. To use it put it in the ~/Library/Scripts/Folder Action Scripts/ folder on opening folder this_folder set tf_path to POSIX path of this_folder set dt to tf_path & "/" & (do shell script "date +%Y-%m-%d") set TODAY to tf_path & "/_Today" do shell script "DT=\"" & dt & "\" ; TODAY=\"" & TODAY & "\"; if [ ! -d $DT ] ; then mkdir $DT ; pwd > ~/aaa; else pwd > ~/aaa ; fi; if [ -h $TODAY ] ; then rm $TODAY ; fi; ln -s $DT $TODAY;" end opening folder