variable location and do shell script

Hi there.

I tend to have a better understanding of shell scripts than apple script and as such I usally create shell scripts and then work out how to convert them to apple script.

As such I am having some trouble with a piece of code.

I want to open a finder and choose a folder as a path. (done).
I want to then write a file to that location using cat. (stuck).

So far I have

tell application "Finder"
	set the workingfolder to choose folder
end tell

do shell script "touch " & workingfolder & " /index.html"
do shell script "echo blah blah blah >>  "& workingfolder & " /index.html"

any one got any ideas. using the following in terminal works 100%

touch path/index.html
echo blah blah blah >> path/index.html

some how the working folder selection is not converting into the path.


the Finder is not needed at all.
AppleScript works with HFS paths (colon separated), the shell expects POSIX paths (slash separated)

set workingfolder to POSIX path of (choose folder)
do shell script "echo blah blah blah >>  " & quoted form of (workingfolder & "index.html")

Thanks that worked great. I understand now that it was not picking up the posix path.

one additional question if I may. I want to pick select a file name and am using

set image to POSIX path of (choose file)

this works, but gives me the path as well. All I want is the file name. Is there a way to filter out the path?


Not to worry.

A little digging and I found this.

set first_file to choose file without invisibles
set thepath to first_file as text
set theposix to POSIX path of thepath
tell application "Finder" to set image to (name of first_file)

Thanks again for your help.

set image to name of (info for (choose file))