PDA

View Full Version : UNIX command "Touch" as droplet?


nassau
2004-08-27, 18:28
does anyone know if it is possible to create a droplet performing the UNIX command "Touch" on the files dropped on it? This is in OSX of course.

Thanks

cudaboy_71
2004-08-31, 22:42
i can give you a damn good start.


on run
tell application "Finder"
set change_list to selection
end tell

open change_list

end run

on open change_list

tell application "Finder"

repeat with thefile in change_list
set newFile to POSIX path of thefile
do shell script "touch " & newFile & ""
end repeat

end tell
end open


i havent even tested this. but, it should be a hearty shove in the right direction. the main thing to note is the 'do shell script' line. with that you can basically paste any shell code and execute from an applescript. the " &newFile &" lets you create a list of files to 'operate on' in the finder, and process them in the shell.

also of note--there is no escape character handling. im sure you can do a little searching to find/lift some code.

good luck. let us know if you get it working (and paste the working code)

nassau
2004-09-01, 02:03
thanks cuda.. since i posted last i managed to get some help from the apple forums. the script is working perfectly!

get it from mu iDisk: hot.tamales! finlename=Touch

peace

Koodari
2004-09-06, 11:46
I have a related question, how would you do a script that is put in the Finder toolbar, and just makes (touches) a new empty file in the current folder, and puts focus to the filename so you can write your own?

Never done a single script...