Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'To you AppleScript wizards:' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
To you AppleScript wizards:
Authored by: jecwobble on May 26, '04 10:51:06AM
Could you replace the hard coded path "/path/to/your/logfiles/" with the this_folder variable? If so, would that allow you to attach this script to any folder as is, without needing to modify the hard coded path- a one script, many folders type of thing?

[ Reply to This | # ]
To you AppleScript wizards:
Authored by: nhajratw on May 26, '04 11:10:13AM

I'm sure there is a way to do it... i don't think this_folder works though, since it has to be a unix style path.

I think it can be done with an applescript "POSIX" keyword or something...

Any AppleScript gurus want to help out?



[ Reply to This | # ]
Here's one solution
Authored by: saint.duo on May 26, '04 12:00:48PM
IF /path/to/your/logfiles/ is the same folder as this_folder, then changing this should work:

tell application "Terminal"
        activate
        do script with command ¬
         "/usr/bin/tail -100f '" & (quoted form of POSIX path of this_folder) & ¬
         theName & "';exit"
end tell
I hope I cleaned up the quotes properly. I'm not familiar with the tail command. There is a space and a single quote between -100f and the quotation mark.

---
--
duo

[ Reply to This | # ]

Here's one solution - quotes in wrong place
Authored by: Krioni on May 27, '04 10:34:26AM
Your quotes are in the wrong place - you have to combine the two strings BEFORE you quote them, otherwise you'd get 'something''somethingelse' which will not work.

tell application "Terminal"
	activate
	do script with command ¬
		"tail -100f " & (quoted form of ((POSIX path of this_folder) & theName)) & ";exit"
end tell
So, we combine the Posix path of this_folder with theName FIRST, then we get the quoted form of it. Note that also means you do NOT include the single quotes yourself - that's what "quoted form of" does.

Also, you don't need to specify where "tail" is by using the full path, unless you're afraid the user may have another version of tail that you don't want to use.

[ Reply to This | # ]